Skip to main content

Authentication methods

AIOHub supports multiple authentication headers for different client types:
MethodHeaderClient
Bearer authAuthorization: Bearer sk-xxxOpenAI SDK, Codex CLI, most OpenAI-compatible tools
Anthropic API Keyx-api-key: sk-xxxAnthropic SDK
Anthropic bearer authAuthorization: Bearer sk-xxxClaude Code (ANTHROPIC_AUTH_TOKEN)
Google API Keyx-goog-api-key: sk-xxxGemini CLI, Google SDK
All methods use the same sk- API key value. AIOHub automatically detects the authentication format.

Examples

curl https://api.aiohub.org/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hi"}]}'

Common authentication errors

StatusCauseFix
401API key is invalid, expired, or sent in the wrong headerCheck that the API key is complete, enabled, and sent in the expected header
403API key cannot access the requested modelConfirm the API key group includes the model and endpoint
429Rate limit reachedSlow down requests and check console announcements or current limits

Verify your API key

Send a small request to verify the API key:
curl https://api.aiohub.org/v1/models \
  -H "Authorization: Bearer sk-your-api-key"
A successful response with a model list confirms your API key is valid.