Attach the Budget-Enforcing Proxy
ledger_proxy_attachPoint your provider traffic at the proxy so budget caps are enforced BEFORE the provider is contacted, instead of being reported afterwards.
This closes the gap where the brake was unreachable from MCP: an agent connected over MCP could record spend (ledger_track) but nothing could refuse a call. With this, the cap is enforced on every LLM call.
Returns the base_url to use, the two headers to send, and the exact change for the OpenAI and Anthropic SDKs. Your provider credential is NOT part of this: it stays in Authorization / x-api-key and is only forwarded, never stored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | the agent whose budget the proxied calls are billed to | |
| provider | No | which upstream to proxy: openai or anthropic | openai |
| agent_secret | No | the agent's own secret (either this or workspace_key) | |
| workspace_key | No | the owning workspace's key (either this or agent_secret) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||