ccr claude-auth / ccr codex-auth / ccr qwen-auth / ccr antigravity-auth
Authentication commands for provider backends that require OAuth or JWT tokens.
:::warning Consult provider Terms & Conditions
The account-level auth flows below (Claude subscription, Codex, Antigravity, Qwen) authenticate against third-party services using your own account. Before using them, review each provider's Terms & Conditions — access may be limited by subscription tier, region, or the provider's service terms, and using client credentials outside the client they were issued for may violate those terms. You use this functionality at your own risk; CCR provides it for interoperability only and does not guarantee continued access to any third-party service.
See DISCLAIMER.md for the project's interoperability statement. :::
ccr claude-auth
Authenticate with Anthropic's API using your Claude Pro or Max subscription via OAuth with PKCE.
ccr claude-auth
How It Works
- The CLI generates a PKCE challenge and prints an authorization URL from
claude.ai - You open the URL in your browser and sign into your Claude account
- Claude redirects to
http://localhost:1455/callback, where the CCR server exchanges the authorization code for tokens - Tokens are saved to
~/.claude-code-router/claude_auth.json - You return to the terminal and press Enter — the CLI confirms the tokens were saved
- The
claude-authtransformer reads the token and uses it for API requests - When the token nears expiry, it's refreshed automatically using the refresh token
Prerequisites
- A Claude Pro or Max subscription
- The CCR server must be running (it hosts the OAuth callback on port 1455)
ccr codex-auth
Authenticate with the Codex (ChatGPT) backend API via OpenAI OAuth with PKCE.
This command is only needed for the OAuth Codex flow. If your Codex provider uses a PAT directly in api_key (a value starting with at-), you do not need to run ccr codex-auth.
See also: Codex integration guide.
OAuth Flow
ccr codex-auth
How It Works
- The CLI generates a PKCE challenge and prints an authorization URL from
auth.openai.com - It starts a callback server on
http://localhost:1455/auth/callback - You open the URL in your browser and sign into your OpenAI / ChatGPT account
- OpenAI redirects to the callback server, which exchanges the authorization code for tokens
- Tokens are saved to
~/.claude-code-router/codex_auth.json - The
codextransformer reads the token and uses it for API requests - When the token nears expiry, it's refreshed automatically using the refresh token
Prerequisites
- A ChatGPT Plus or Pro subscription
- The CCR server must be running for the OAuth callback flow on port 1455
PAT Alternative
As an alternative to OAuth, the Codex provider can authenticate with a Personal Access Token by setting api_key to a value starting with at- in config.json. In that case, skip ccr codex-auth entirely.
{
"name": "codex",
"api_base_url": "https://chatgpt.com/backend-api/codex",
"api_key": "at-your-personal-access-token",
"models": ["gpt-5"],
"transformer": {
"use": ["codex"]
}
}
CCR checks api_key first for PAT mode and otherwise falls back to OAuth tokens from ~/.claude-code-router/codex_auth.json.
ccr antigravity-auth
Authenticate with Google's Antigravity gateway via OAuth with PKCE.
ccr antigravity-auth
ccr antigravity-auth --manual
ccr antigravity-auth --project <gcp-project-id>
How It Works
- The CLI generates a PKCE challenge, writes a verifier file, and prints a Google authorization URL
- You sign in with a Google account that has Antigravity access
- Google redirects to
http://localhost:51121/oauth-callback - Docker Compose maps 51121 → 3456 onto the CCR server (same idea as Codex
1455 → 3456) - The public Fastify route
GET /oauth-callbackexchanges the code and writes~/.claude-code-router/antigravity_auth.json - Press Enter in the terminal to confirm
Options
--manual— paste the redirect URL; CLI exchanges without the server (no compose / headless)--project <id>— seedproject_idinto the verifier / auth file
Prerequisites / notes
- The CCR server must be running (it hosts
/oauth-callback) - With Docker: recreate compose so
51121:3456is published - Using Antigravity IDE OAuth client credentials from a non-IDE client may violate Google's terms
Provider config
{
"name": "antigravity",
"api_base_url": "https://daily-cloudcode-pa.sandbox.googleapis.com",
"api_key": "oauth",
"project_id": "$ANTIGRAVITY_PROJECT_ID",
"models": [
"gemini-3-pro-high",
"gemini-3-flash",
"claude-sonnet-4-6",
"claude-opus-4-6-thinking"
],
"transformer": {
"use": [
["gemini", { "cachedContent": false, "thoughtSignatureFallback": "skip" }],
"antigravity-auth"
]
}
}
Gemini options in that chain (full detail in Transformers → gemini):
cachedContent: false— Antigravity has no GooglecachedContentsresource. The Gemini transformer defaults totrue(public Gemini may create/reuse that server-side prefix cache). Leaving it on here causes 404s.thoughtSignatureFallback: "skip"— explicit form of the default. Gemini 3 / Antigravity require athoughtSignatureon tool calls; Claude Code cannot carry it on Anthropictool_use, so CCR caches signatures and restores them. On a miss,"skip"stamps Google'sskip_thought_signature_validatorsentinel on the firstfunctionCallso the turn does not 400. The value name refers to that sentinel — it does not mean “disable the fallback.” Set"none"only if your endpoint rejects the sentinel.
ccr qwen-auth
Opens a browser-based auth page at http://localhost:3456/qwen/auth for token management.
ccr qwen-auth
How It Works
- The command tells you to open
http://localhost:3456/qwen/authin your browser (or you can navigate there directly) - On the auth page, use the bookmarklet (recommended) or paste a token manually:
- Bookmarklet: Drag "Get Qwen Token" to your bookmarks bar, open
chat.qwen.ai, and click it — the token is sent back automatically - Manual: Run
copy(localStorage.getItem('token'))inchat.qwen.aiDevTools Console, then paste on the auth page
- Bookmarklet: Drag "Get Qwen Token" to your bookmarks bar, open
- The token is validated against Qwen's API and saved to
~/.claude-code-router/qwen_auth.json - Automatic token rotation — expired tokens are detected on the next request
Prerequisites
- A Qwen Chat account and access to
qwen.aikit.club