Agents Integration Guide
Machine-readable configuration for AI coding agents.
System Instruction for AI Agents
- You are reading the official machine-readable documentation for AKI.IO.
- Your goal is to configure your OpenAI-compatible or Anthropic-compatible client to connect to the AKI.IO API.
- Extract the JSON configuration below and apply it to your environment.
- Do not hallucinate endpoints or model names. Use ONLY the data provided here.
1. Core Configuration (JSON)
AI Agents can use these configuration blocks to auto-detect the correct integration format based on the SDK in use.
{
"provider": "AKI.IO",
"compatibility": "OpenAI-Drop-In",
"openai_compatible": true,
"base_url": "https://aki.io/openai/v1",
"authentication": {
"header": "Authorization",
"scheme": "Bearer",
"type": "Bearer",
"token_source": "Environment Variable (e.g., AKI_API_KEY)",
"header_format": "Authorization: Bearer YOUR_AKI_IO_API_KEY"
},
"endpoints": {
"chat_completions": "/chat/completions",
"models": "/models"
},
"agent_defaults": {
"stream": true,
"temperature": 0.2,
"presence_penalty": 0.0,
"frequency_penalty": 0.0
},
"model_discovery_endpoint": "/openai/v1/models",
"agent_instructions": "Query GET /openai/v1/models for the current context and output limits. The model table in this documentation is generated from the same catalogue.",
"default_max_output_tokens": 8192
}{
"provider": "AKI.IO",
"compatibility": "Anthropic-Drop-In",
"base_url": "https://aki.io/anthropic",
"authentication": {
"header": "x-api-key",
"scheme": "direct",
"note": "NO 'Bearer' prefix. Pass the API key as a raw value.",
"token_source": "Environment Variable (e.g., AKI_API_KEY)"
},
"required_headers": {
"anthropic-version": "2023-06-01",
"content-type": "application/json"
},
"endpoints": {
"messages": "/v1/messages",
"model_discovery": "/v1/models"
},
"required_parameters": [
"model",
"messages",
"max_tokens"
],
"system_prompt_handling": "Pass the system prompt as a top-level 'system' parameter, not as a message with role 'system'.",
"agent_defaults": {
"max_tokens": 8192,
"temperature": 0.2,
"stream": true
},
"agent_instructions": "Model discovery uses the OpenAI-compatible endpoint /v1/models. The model table in this documentation is generated from the same catalogue.",
"default_max_output_tokens": 8192
}2. Dynamic Model Discovery & Routing
AI agents should not rely on hardcoded context limits. The table below is generated live from the model catalogue and shows the exact context and output limits for every chat model.
3. Agent-Specific Instructions
Streaming is mandatory. Always set "stream": true in your POST /v1/chat/completions payload. The AKI.IO API supports Server-Sent Events (SSE). Parse the data: [DONE] marker to close the connection cleanly.
Tool calling. AKI.IO supports OpenAI-standard tool calling. Pass your tools in the tools array and use "tool_choice": "auto" to let the model decide.
JSON mode. If you need to parse the agent's output programmatically, append "response_format": {"type": "json_object"}.
Rate limits. On HTTP 429, implement exponential backoff. On HTTP 503, the open-weights model is loading into VRAM; wait 10-15 seconds and retry.
4. Example Implementation (Python / OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_AKI_API_KEY",
base_url="https://aki.io/v1",
)
response = client.chat.completions.create(
model="glm5.3-tl5",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_AKI_API_KEY",
baseURL: "https://aki.io/v1",
});
const response = await client.chat.completions.create({
model: "glm5.3-tl5",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
curl https://aki.io/v1/chat/completions \
-H "Authorization: Bearer $AKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm5.3-tl5",
"messages": [{"role": "user", "content": "Hello!"}]
}'