API Overview
OfoxAI offers three protocol-compatible API access methods, fully compatible with each provider’s official SDK.
Base URL
| Protocol | Base URL | Description |
|---|---|---|
| OpenAI Compatible | https://api.ofox.ai/v1 | Compatible with OpenAI SDK, supports all models |
| Anthropic Native | https://api.ofox.ai/anthropic | Compatible with Anthropic SDK, native Claude experience |
| Gemini Native | https://api.ofox.ai/gemini | Compatible with Google GenAI SDK |
Authentication
All protocols use a unified OfoxAI API Key, but the header format varies by protocol:
| Protocol | Header | Format |
|---|---|---|
| OpenAI | Authorization | Bearer sk-xxx |
| Anthropic | x-api-key | sk-xxx |
| Gemini | x-goog-api-key | sk-xxx |
See the Authentication guide for details.
Available Endpoints
OpenAI Compatible Protocol
| Endpoint | Method | Description |
|---|---|---|
/v1/chat/completions | POST | Create chat completion |
/v1/embeddings | POST | Create text embeddings |
/v1/models | GET | List available models |
/v1/models/{model_id} | GET | Get model details |
/v1/images/generations | POST | Generate images |
Anthropic Native Protocol
| Endpoint | Method | Description |
|---|---|---|
/anthropic/v1/messages | POST | Create Messages |
Gemini Native Protocol
| Endpoint | Method | Description |
|---|---|---|
/gemini/v1beta/models/{model}:generateContent | POST | Generate content |
/gemini/v1beta/models/{model}:streamGenerateContent | POST | Stream generate content |
Rate Limits
OfoxAI uses pay-as-you-go pricing with a unified rate policy for all users:
| Limit | Quota |
|---|---|
| RPM (requests/minute) | 200 |
| TPM (tokens/minute) | Unlimited |
If you need a higher rate quota, contact OfoxAI Support to request an adjustment.
When rate-limited, the API returns 429 Too Many Requests with the following response headers:
x-ratelimit-limit-requests: 200
x-ratelimit-remaining-requests: 0
x-ratelimit-reset-requests: 1sError Codes
All protocols return unified HTTP status codes:
| Status Code | Description | Common Causes |
|---|---|---|
200 | Success | — |
400 | Bad Request | Invalid parameters, missing required fields |
401 | Unauthorized | Invalid or expired API Key |
403 | Forbidden | Account lacks access to the model |
404 | Not Found | Incorrect model ID |
429 | Rate Limited | Exceeded rate limit |
500 | Server Error | Internal error, please retry |
502 | Upstream Error | Model provider service issue |
503 | Service Unavailable | Under maintenance |
Error Response Format
{
"error": {
"code": "invalid_api_key",
"message": "The provided API Key is invalid. Please check and try again.",
"type": "authentication_error"
}
}OfoxAI Extension Parameters
OfoxAI provides extension parameters on top of standard protocols for advanced routing and fallback control:
{
"model": "openai/gpt-4o",
"messages": [...],
"provider": {
"routing": "cost",
"fallback": ["anthropic/claude-sonnet-4.5", "google/gemini-3-flash-preview"]
}
}See Provider Routing and Fallback for details.
Last updated on