Skip to content

Make $OPG permits more explicit#161

Merged
adambalogh merged 10 commits intomainfrom
aba/permit
Feb 18, 2026
Merged

Make $OPG permits more explicit#161
adambalogh merged 10 commits intomainfrom
aba/permit

Conversation

@adambalogh
Copy link
Contributor

add function to create permit to spend X $OPG for inferences

@adambalogh adambalogh marked this pull request as ready for review February 18, 2026 13:27
balogh.adam@icloud.com added 2 commits February 18, 2026 14:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors OPG token Permit2 approval handling by moving the functionality from a standalone example script into the SDK's core client API. The change provides a more integrated and user-friendly way to ensure sufficient Permit2 allowances for x402 payments.

Changes:

  • Added opg_token.py module with ensure_opg_approval() function to check and grant Permit2 approvals
  • Exposed approval functionality through client.llm.ensure_opg_approval() method for streamlined access
  • Removed standalone x402_permit2.py example script and integrated approval flow into existing LLM examples

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/opengradient/client/opg_token.py New module implementing Permit2 approval utilities with ERC20 contract interaction
src/opengradient/client/llm.py Added wrapper method to expose approval functionality through the LLM namespace
examples/x402_permit2.py Removed standalone script - functionality moved into SDK
examples/run_x402_llm.py Updated to use new ensure_opg_approval() method
examples/run_x402_llm_stream.py Updated to use new ensure_opg_approval() method
examples/README.md Removed documentation for deleted example script

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

adambalogh and others added 6 commits February 18, 2026 14:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adambalogh adambalogh merged commit 843c02f into main Feb 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants