Apache Casbin Gateway
3. Providers

3.3 No API key: a subscription instead

A ChatGPT or Claude subscription has no API key to paste. It does not need one. There are two ways to put one behind a provider, and they differ in who holds the sign-in.

Gateway holds it

Pick the ChatGPT subscription or Claude subscription source and press Sign in. The vendor's own page opens in your browser, and what it grants is stored here — encrypted like a key, renewed before it expires, never sent to any agent.

From then on the subscription is used exactly like a key: every agent can spend it, in whatever API it speaks, and the model routing, permissions and records all work as they do for a keyed provider.

  • The base URL is the endpoint that subscription is served from, which is not the vendor's API: https://chatgpt.com/backend-api/codex for ChatGPT, https://api.anthropic.com for Claude.
  • Models stays empty: what the account may ask for is decided by the plan behind it.
  • Requests are sent as the client that sign-in was granted to — that is what the endpoint answers.

Sign in again to put another account behind the same provider. Snapshots never carry a sign-in, so an imported provider has to be signed in again.

The agent holds it

Set Authentication to the caller's own login instead. Every request is then forwarded with the credentials the agent itself sent, so it keeps its own sign-in and nothing is stored here at all.

Only the agent holding that sign-in can use such a provider — Claude Code for a Claude one, Codex for a ChatGPT one. For Codex, Write configuration puts requires_openai_auth = true in ~/.codex/config.toml in place of a key, which is what makes it send the ChatGPT sign-in it already has.

The environment snippet of such a provider sets the base URL and nothing else:

export ANTHROPIC_BASE_URL="http://localhost:17000/v1/agents/claude-code"

A token there would replace the sign-in the agent already has, which is the one thing this mode exists to keep.

Codex's spend is on the Usage page either way, because that page reads the agent's own transcripts rather than the relay.

What you get either way

Everything except a key of your own:

  • LLM Records, in full (4.2).
  • Permissions over tools, models and providers (4.1).
  • Usage from the relayed traffic, on top of what the transcripts already gave you (4.3).

Next: 3.4 Authenticity.

Edit on GitHub
Apache Incubator

Apache Casbin (Incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Copyright © 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

Apache, Apache Casbin, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

On this page