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.
Recommended Authentication by Protocol
| Protocol | Recommended input | Canonical API base |
|---|---|---|
| OpenAI compatible | Authorization: Bearer <AnyInt API Key> | https://api.anyint.ai/openai/v1 |
| Anthropic Messages | x-api-key: <AnyInt API Key> | https://api.anyint.ai/anthropic/v1 |
| Gemini Developer API | x-goog-api-key: <AnyInt API Key> | https://api.anyint.ai/gemini/v1beta |
| Async media | Authorization: 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.
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.
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 Status | Common Cause | Troubleshooting & Solution |
|---|---|---|
| 401 Unauthorized | Invalid or expired API key, or missing header | Verify your Bearer token or x-api-key header; ensure the key is active in Console API Keys. |
| 402 Payment Required | Insufficient balance or monthly budget limit reached | Add credits in Console or increase the monthly budget limit for the API key. |
| 403 Forbidden | IP restriction, environment mismatch, or insufficient permissions | Check your API key scope and verify your client IP against the allowed IP list. |
| 404 Not Found | Incorrect endpoint path or unknown model ID | Verify the Base URL path; call GET /v1/models to confirm the model ID is active. |
| 429 Too Many Requests | Rate limit (RPM/TPM) or concurrency cap reached | Reduce concurrency; configure exponential backoff retry; or request a quota increase in Console. |
| 502 Bad Gateway | Upstream provider network error or malformed response | AnyInt gateway automatically attempts failover across channels; if persistent, report via Console Request Logs. |
| 503 Service Unavailable | All routing candidate channels are temporarily unavailable | Retry after a brief delay or switch to an equivalent backup model. |
| 504 Gateway Timeout | Upstream inference timeout (e.g. complex reasoning model) | Check prompt complexity; increase client-side timeout; enable streaming (stream: true) for reasoning models. |