Repository navigation
lab: openai provider, any OpenAI-compatible API with its own key - #23
Merged
Merged
Conversation
AdvayMonga
force-pushed
the
lab/agent-gateway
branch
from
October 10, 2026 16:20
0a7c8f0 to
8adae54
Compare
LAB_AGENT_PROVIDER=openai runs the session loop in the harness against any
OpenAI-compatible chat-completions API (OpenAI, Gemini, DeepSeek, Mistral,
OpenRouter), called directly: https and a public host only, so nothing is
routed locally. The key never enters the jail. Built-in tools (Read, Write,
Edit, Glob, Grep, Bash) stay in the workspace; writes pass the same write
guard as the Claude provider; Bash runs jailed with no network. Sessions end
through a `finish` tool with the usual {status, note}. Cost is usage times
LAB_MODEL_PRICE, required; a response without usage is charged at the cap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A symlink written by jailed Bash let Grep (run outside the jail) read the lab's keys, ledger or held-out files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AdvayMonga
force-pushed
the
lab/agent-gateway
branch
from
October 10, 2026 17:03
33d8774 to
b74f655
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets any model drive the agent loop with its provider's own API key, not only Claude. Replaces the earlier gateway approach (no local routing).
lab/agent_openai.py, selected withLAB_AGENT_PROVIDER=openai+LAB_MODEL:LAB_OPENAI_BASE_URLmust be https and a public host (no localhost, private IPs,.localor.internal); defaults to OpenAI. The key comes fromOPENAI_API_KEY.hooks.allowedguard as the Claude provider, and Bash runs throughgrader.jailedwith no network. Lab tools are passed through unchanged.finishtool with the usual{status, note}, or at max turns, timeout or the session's dollar cap. Failures come back as a reply and never raise.LAB_MODEL_PRICE="in,out"($ per million tokens). The provider refuses to start without it. A response without usage is charged at the session cap (cost.estimated).lab/agent.py:load()registersopenai. The Claude provider is unchanged from main.tests/test_lab_agent_openai.py: 13 tests against a scripted fake API. They cover the tools, write-guard refusals, workspace escape, Bash, lab tools, the "no tool call" turn,finish, the cost cap, missing usage, API failure, URL refusals, and required settings.lab/README.mdandCLAUDE.md.Full lab suite: 231 passed, 5 skipped; ruff clean. Not yet run against a real provider API.
🤖 Generated with Claude Code