Entry points
Use the base URL for your SDK or client. Do not add paths from another API format.
| Use case | Base URL | Common endpoint |
|---|
| OpenAI SDK / OpenAI-compatible tools | https://api.aiohub.org/v1 | POST /chat/completions |
| Codex CLI | https://api.aiohub.org/v1 | POST /responses |
| Anthropic SDK / Claude Code | https://api.aiohub.org | POST /v1/messages |
| Gemini CLI | https://api.aiohub.org | POST /v1beta/models/{model}:generateContent |
| Gemini REST / Google SDK | https://api.aiohub.org/v1beta | POST /models/{model}:generateContent |
| Console dashboard | https://api.aiohub.org/console | Account overview |
| API key management | https://api.aiohub.org/console/token | Create and manage API keys |
| Wallet management | https://api.aiohub.org/console/topup | Balance, add funds, and payment history |
| Usage logs | https://api.aiohub.org/console/log | Usage records and costs |
| Format | Endpoint | Use case |
|---|
| OpenAI compatible | POST /v1/chat/completions | Default for most SDKs and tools |
| OpenAI Responses | POST /v1/responses | Codex CLI and clients using the Responses API |
| Claude Messages | POST /v1/messages | Claude Code and Anthropic SDK |
| Gemini API | POST /v1beta/models/{model}:generateContent | Gemini CLI and Google SDK |
If you are unsure which format to use, start with OpenAI Chat Completions for a basic chat request. Codex CLI uses Responses, not Chat Completions.
Authentication
AIOHub API keys start with sk-. Different clients use different headers with the same API key value:
| Method | Header | Client |
|---|
| Bearer auth | Authorization: Bearer sk-xxx | OpenAI SDK, Codex CLI, most tools |
| Anthropic API Key | x-api-key: sk-xxx | Anthropic SDK |
| Anthropic bearer auth | Authorization: Bearer sk-xxx | Claude Code (ANTHROPIC_AUTH_TOKEN) |
| Google API Key | x-goog-api-key: sk-xxx or key=sk-xxx | Gemini CLI, Google SDK |
See Authentication for examples.
Request example
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": "Hello!"}]
}'
Response shape
Successful responses follow the selected compatible API format. For example, an OpenAI Chat Completions response looks like:
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 12,
"total_tokens": 22
}
}
Streaming responses
Chat Completions supports SSE streaming. Set "stream": true:
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": "Hello!"}],
"stream": true
}'
Error responses
Error responses include an HTTP status code and a JSON error body:
{
"error": {
"message": "Incorrect API key provided",
"type": "authentication_error",
"code": "invalid_api_key"
}
}
See HTTP status codes for common status codes and retry guidance.
Public endpoint scope
The API reference navigation lists the main user-facing endpoints. Available models, groups assigned to your API key, and endpoints depend on /v1/models, the console pricing page, and the current service state. Unlisted compatibility routes are not officially supported.