AnnexAPI Integration Guide
Seamlessly configure models, authorization headers, batch pipelines, and integration environments.
01API Compatibility & Auth
AnnexAPI supports standard OpenAI-compatible and provider-native payload structures. This allows you to easily switch model gateways simply by redirecting client configurations.
Format Specifications
| Format | Endpoint | Headers | Compatibility |
|---|---|---|---|
| OpenAI Compatible | /v1/chat/completions | Authorization: Bearer sk-xxx | Universal endpoint supporting all standard chat models listed in the directory. |
| OpenAI Responses | /v1/responses | Authorization: Bearer sk-xxx | Compatible with new OpenAI chat flow interfaces (supported models only). |
| Claude Native | /v1/messages | x-api-key: sk-xxx anthropic-version: 2023-06-01 | Native Anthropic messages format. Restricted to Claude family models. |
| Gemini Native | /v1/models/... | x-goog-api-key: sk-xxx | Native Google Gemini format. Parameters use camelCase (e.g. imageSize). |
02Language SDK Integration
Use standard OpenAI client libraries in Python or Node.js by redirecting the client parameters to AnnexAPI's server.
# Install the client: pip install openai
import openai
client = openai.OpenAI(
base_url="https://annexapi.com/v1/",
api_key="AE_KEY_YOUR_SECRET"
)
completion = client.chat.completions.create(
model="claude-sonnet-4-6-max",
messages=[
{"role": "user", "content": "Explain routing optimization."}
]
)
print(completion.choices[0].message.content)03Client & IDE Integrations
Connect AnnexAPI coordinates with command-line developer tools and terminal assistant clients.
Claude Code CLI Setup
Route Anthropic's official terminal assistant through AnnexAPI endpoints.
// File: ~/.claude.json
{
"hasCompletedOnboarding": true
}
// File: .claude/settings.json (inside your project directory)
{
"env": {
"ANTHROPIC_BASE_URL": "https://annexapi.com",
"ANTHROPIC_AUTH_TOKEN": "AE_KEY_YOUR_SECRET",
"ANTHROPIC_MODEL": "claude-sonnet-4-6-max",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": 1
}
}- Install Claude Code globally: npm install -g @anthropic-ai/claude-code.
- Create ~/.claude.json containing onboarding override settings.
- Add a .claude folder inside your project workspace and create settings.json with environment coordinates.
- Launch the assistant by executing the 'claude' command in your terminal.
04High-Concurrency Batching
For high-volume operations, use Python's asynchronous aiohttp library to send parallel request queues. Keep limits reasonable to prevent connection reset errors.
import asyncio
import aiohttp
API_KEY = "AE_KEY_YOUR_SECRET"
BASE_URL = "https://annexapi.com/v1/"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
async def fetch_completion(session):
try:
async with session.post(
url=f"{BASE_URL}chat/completions",
json={
"model": "gpt-5.5",
"max_tokens": 1000,
"temperature": 0.5,
"messages": [{"role": "user", "content": "Explain routing optimization."}],
},
headers=headers
) as response:
if response.status == 200:
result = await response.json()
print(result['choices'][0]['message']['content'])
else:
print(f"Request failed: {response.status}")
except Exception as e:
print(f"Exception occurred: {e}")
async def main():
concurrency_limit = 50
async with aiohttp.ClientSession() as session:
tasks = [fetch_completion(session) for _ in range(concurrency_limit)]
await asyncio.gather(*tasks)
if __name__ == "__main__":
asyncio.run(main())05Best Practices
Follow these principles to ensure high performance and account security.
06API Error Codes
Standard HTTP response status codes and platform-specific error messages you may encounter while integrating with AnnexAPI.
Standard HTTP Status Codes
| Status Code | Explanation & Recommendations |
|---|---|
| 400 Bad Request | The request is malformed or cannot be understood by the server. Typically indicates a client-side syntax error or missing mandatory parameters. |
| 401 Unauthorized | API key verification failed. Verify that your API key is correct, properly formatted in the header, and has not expired. |
| 402 Payment Required | Insufficient account balance. A minimum balance of 0.10 Aurea is required to process requests. |
| 403 Forbidden | Insufficient permissions to access the requested resource. This may be caused by locked accounts or key restrictions. |
| 404 Not Found | The requested resource was not found. Double-check that the endpoint URL is correct and exists on the platform. |
| 413 Payload Too Large | The request entity is too large. Reduce the batch size, trim the context window, or compress prompt sizes. |
| 429 Too Many Requests | Rate limit exceeded. Too many requests were sent in a short window. Implement exponential backoff or request a rate-limit increase. |
| 500 Internal Error | An unexpected error occurred on the server. This is often an upstream model provider outage and not a client error. |
| 503 Service Unavailable | The server is temporarily overloaded or undergoing maintenance. Please retry after a brief delay. |