Authentication

Authenticate each supported API protocol safely with an AnyInt API key.

Every Developer API request requires an active AnyInt API key. Use the header expected by your client protocol so existing OpenAI, Anthropic, and Gemini SDKs continue to work.

ProtocolRecommended inputCanonical API base
OpenAI compatibleAuthorization: Bearer <AnyInt API Key>https://api.anyint.ai/openai/v1
Anthropic Messagesx-api-key: <AnyInt API Key>https://api.anyint.ai/anthropic/v1
Gemini Developer APIx-goog-api-key: <AnyInt API Key>https://api.anyint.ai/gemini/v1beta
Async mediaAuthorization: Bearer <AnyInt API Key>https://api.anyint.ai/v1/async-tasks

For client compatibility, the gateway also accepts the supported AnyInt key headers across protocol families and accepts Gemini's key query parameter on Gemini routes. Prefer headers so credentials do not appear in URLs or intermediary logs.

The gateway consumes the AnyInt credential before provider routing. It never forwards that credential as an upstream provider key. Invalid, expired, or revoked keys fail closed.

Create a Key

Create an API key in Console, then store it in a server-side secret manager or environment variable.

Newly issued AnyInt keys use the sk- prefix followed by 52 Base64URL characters (55 characters total). Existing ak_ keys remain valid until you rotate or disable them. Always copy the complete value shown by Console; do not add or remove a prefix yourself.

bash
export ANYINT_API_KEY="your_api_key"

Security Guidelines

  • Store keys in a server-side secret manager or environment variable.
  • Never place a key in frontend JavaScript, source control, logs, or URLs.
  • Use a separate key for each application and environment.
  • Rotate a key immediately if it may have been exposed.
  • Do not forward AnyInt keys to upstream providers.

Test Authentication

List models to verify the key before sending an inference request.

bash
curl "https://api.anyint.ai/openai/v1/models" \
  --header "Authorization: Bearer $ANYINT_API_KEY"

An authentication failure returns HTTP 401 with a protocol-shaped error. A valid key can still receive 402 for insufficient balance or 503 when no eligible provider is available.

Common Error Troubleshooting

When an API request fails, use this table to quickly identify the cause and solution:

HTTP StatusCommon CauseTroubleshooting & Solution
401 UnauthorizedInvalid or expired API key, or missing headerVerify your Bearer token or x-api-key header; ensure the key is active in Console API Keys.
402 Payment RequiredInsufficient balance or monthly budget limit reachedAdd credits in Console or increase the monthly budget limit for the API key.
403 ForbiddenIP restriction, environment mismatch, or insufficient permissionsCheck your API key scope and verify your client IP against the allowed IP list.
404 Not FoundIncorrect endpoint path or unknown model IDVerify the Base URL path; call GET /v1/models to confirm the model ID is active.
429 Too Many RequestsRate limit (RPM/TPM) or concurrency cap reachedReduce concurrency; configure exponential backoff retry; or request a quota increase in Console.
502 Bad GatewayUpstream provider network error or malformed responseAnyInt gateway automatically attempts failover across channels; if persistent, report via Console Request Logs.
503 Service UnavailableAll routing candidate channels are temporarily unavailableRetry after a brief delay or switch to an equivalent backup model.
504 Gateway TimeoutUpstream inference timeout (e.g. complex reasoning model)Check prompt complexity; increase client-side timeout; enable streaming (stream: true) for reasoning models.