AICraft API Documentation
OpenAI-compatible API for 40+ AI models. One endpoint, every frontier model.
Base URL https://api.aicraftapi.com/v1
Introduction
AICraft aggregates DeepSeek, Qwen, GLM, MiniMax, Doubao, OpenRouter and more into a single OpenAI-compatible API. Use any OpenAI SDK — just change the base URL.
Key Features
| Feature | Description |
|---|---|
| Auto Router | AI automatically selects the best model for each task — saves up to 93% vs GPT-4 |
| 40+ Models | From DeepSeek to GPT-4o, from Qwen to Claude — one API key |
| 7 Providers | Automatic failover — if one provider goes down, traffic routes to backup |
| OpenAI Compatible | Drop-in replacement. Works with any existing OpenAI SDK code |
Quick Start
Python
# Install pip install openai # Initialize from openai import OpenAI client = OpenAI( api_key="sk-your-key", base_url="https://api.aicraftapi.com/v1" ) # Chat — with Auto Router response = client.chat.completions.create( model="auto", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content)
Node.js
// Install: npm install openai import OpenAI from "openai"; const client = new OpenAI({ apiKey: "sk-your-key", baseURL: "https://api.aicraftapi.com/v1", }); const response = await client.chat.completions.create({ model: "auto", messages: [{ role: "user", content: "Hello!" }], });
cURL
curl https://api.aicraftapi.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-your-key" \ -d '{"model":"auto","messages":[{"role":"user","content":"Hello!"}]}'
Authentication
All API requests require an API key. Include it in the Authorization header:
Authorization: Bearer sk-your-key
Get your API key from the AICraft Dashboard.
Chat Completions
Create a chat completion. Compatible with OpenAI's chat completions API.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Model name or "auto" for intelligent routing |
messages | array | ✅ | Array of message objects with role and content |
max_tokens | integer | No | Maximum tokens to generate |
temperature | float | No | Sampling temperature (0-2) |
stream | boolean | No | Enable streaming responses |
aicraft_budget | string | No | "save" / "quality" / "auto" — Auto Router mode |
Response Headers
X-AICraft-Routed-To: deepseek-chat X-AICraft-Tier: primary X-AICraft-Fallback: false X-AICraft-Savings: 93% vs GPT-4
Auto Router
model="auto"Set model to "auto" and AICraft intelligently routes your request to the best model:
| Task | Routed Model | Savings vs GPT-4 |
|---|---|---|
| 💻 Coding | DeepSeek V3 | -93% |
| 🌐 Translation | DeepSeek V4-Flash | -99% |
| 🇨🇳 Chinese | Qwen-Max | -88% |
| 🧠 Reasoning | GLM-5 | -83% |
| ✍️ Creative | MiniMax M2.5 | -91% |
| 💬 Conversation | Doubao Pro | -91% |
Router tiers: aicraft_budget: "save" uses cheapest model, "quality" uses best model, "auto" balances based on message complexity.
List Models
Returns all available models.
curl https://api.aicraftapi.com/v1/models \
-H "Authorization: Bearer sk-your-key"
Available Models
| Provider | Models | Input Price/M |
|---|---|---|
| DeepSeek | V3, V4-Flash, R1 | $0.003 - $0.55 |
| Alibaba | Qwen-Max, Plus, Turbo | $0.03 - $0.35 |
| Zhipu | GLM-5, GLM-5-Flash | $0.10 - $0.70 |
| MiniMax | M2.5, M3 | $0.10 - $0.15 |
| ByteDance | Doubao Pro, Lite | $0.008 - $0.06 |
| OpenRouter | GPT-4o, Claude, Gemini, Mistral, Llama | $0.08 - $15.00 |
Pricing
| Plan | Price | Tokens/Month | Models |
|---|---|---|---|
| Free | $0/mo | 5M | Chinese |
| Starter | $12/mo | 50M | All Chinese |
| Pro | $39/mo | 200M | All Chinese + Priority |
| Global | $89/mo | 300M | Chinese + International |
| Enterprise | $299/mo | 2B | Custom SLA |
Rate Limits
| Plan | Rate Limit |
|---|---|
| Free | 5 requests/minute |
| Starter / Pro / Global | Unlimited (fair use) |
| Enterprise | Custom SLA |
Error Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 401 | Invalid API key |
| 429 | Rate limit exceeded |
| 500 | Server error — auto-retry recommended |
| 502 | Upstream model unavailable — Auto Router will use fallback |
AICraft · Shenzhen AICreatrix Technology Co., Ltd. · aicraftapi.com