The gateway
Why model calls go through opsen, and what that buys.
In the path, not in the logs
Your agent's model calls are proxied. That is what makes a budget a refusal rather than a notification: the call that would cross the cap is stopped before it is made, so the money is not spent. A system reading usage after the fact can only tell you what already happened.
Your agent needs no opsen code
import anthropic
client = anthropic.Anthropic() # no api_key, no base_urlThe sandbox starts with ANTHROPIC_BASE_URL,
OPENAI_BASE_URL and GOOGLE_GENAI_BASE_URL
pointing at the gateway, and the matching key variables set to the
session token. Any SDK that reads its own environment routes through
opsen without being told to.
Bring your own key, or use ours
| mode | what happens |
|---|---|
| your key | opsen uses the provider key you added; you are billed by them, metered by us |
| managed | opsen supplies model access from your prepaid balance |
Both are metered identically, so switching does not change what /costs can tell you.
Calling it directly
s.call_model({"model": "claude-sonnet-4-6",
"max_tokens": 200,
"messages": [{"role": "user", "content": "hi"}]})Rarely needed — an SDK inside the sandbox is the normal path — but useful when you are orchestrating from outside and want the call attributed to the session.