The OAuth endpoints handle authentication flows for providers that use OAuth 2.0, including Anthropic (Claude), Google (Gemini), Codex, and others.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/router-for-me/CLIProxyAPI/llms.txt
Use this file to discover all available pages before exploring further.
OAuth Flow Overview
- Client requests authorization URL from management API
- User opens URL and completes OAuth flow with provider
- Provider redirects to callback with
codeandstate - Client posts callback data to management API
- Management API writes callback file for processing
- Client polls for authentication status
Supported Providers
- anthropic / claude - Anthropic Claude API
- codex / openai - OpenAI Codex API
- gemini / google - Google Gemini API
- antigravity / anti-gravity - AntiGravity API
- qwen - Qwen API
- iflow / i-flow - iFlow API
- kimi - Kimi API
Get Authorization URL
Get the OAuth authorization URL for a specific provider./v0/management/{provider}-auth-urlAvailable Endpoints
GET /v0/management/anthropic-auth-urlGET /v0/management/codex-auth-urlGET /v0/management/gemini-cli-auth-urlGET /v0/management/antigravity-auth-urlGET /v0/management/qwen-auth-urlGET /v0/management/kimi-auth-urlGET /v0/management/iflow-auth-url
Request
Response
OAuth authorization URL to redirect user to
OAuth state parameter for CSRF protection (store this for callback validation)
Unix timestamp when the state expires (10 minutes from creation)
Submit OAuth Callback
/v0/management/oauth-callbackRequest
Request Body
Response
Status of callback processing (“ok” or “error”)
Error Responses
Invalid State
Unknown/Expired State
Already Completed
Provider Mismatch
Get Authentication Status
/v0/management/get-auth-statusRequest
Query Parameters
Filter by provider name
Check specific OAuth session by state
Response
OAuth Session Management
Session Lifecycle
- Created - Session registered when auth URL requested
- Pending - Waiting for callback (status = "")
- Completed - Callback received and processed (session deleted)
- Error - Callback failed (status contains error message)
- Expired - Session TTL exceeded (automatically cleaned up)
Session TTL
- Default TTL: 10 minutes from creation
- Automatic cleanup: Expired sessions purged periodically
- State validation: Must be alphanumeric with
-,_,.only - Max length: 128 characters
State Security
Thestate parameter:
- Must be provided in both auth URL request and callback
- Used for CSRF protection
- Cannot contain path separators (
/,\) - Cannot contain
..(path traversal) - Must match pattern:
[a-zA-Z0-9._-]+
Complete OAuth Flow Example
Step 1: Request Authorization URL
Step 2: User Completes OAuth Flow
User opensauth_url in browser and authorizes the application.
Provider redirects to callback URL:
Step 3: Submit Callback
Step 4: Poll for Completion
OAuth Callback File Format
When callback is received, the management API writes a file: Location:{auth-dir}/.oauth-{provider}-{state}.oauth
Format:
Alternative: Submit via Redirect URL
You can submit the entire redirect URL instead of parsing code/state:Error Handling
Provider Errors
If the provider returns an error:Session Expiration
If the state has expired (>10 minutes since auth URL request):Next Steps
- Configuration Endpoints - Manage API keys and providers
- Quota Endpoints - Configure quota behavior
- Log Endpoints - Monitor authentication events