Quick Start
OpenAI compatible. Drop in with 3 lines of code.
1. Get API Key
Log in to AICraft Console, go to API Keys, create a key. Format: sk- + 40 hex.
2. Base URL
Base URL
API Gateway
https://aicraftapi.net/v13. First Call
curl https://aicraftapi.net/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY" -d '{"model":"auto","messages":[{"role":"user","content":"Hello!"}]}'# pip install openai
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://aicraftapi.net/v1")
response = client.chat.completions.create(model="auto", messages=[{"role":"user","content":"Hello!"}])
print(response.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://aicraftapi.net/v1" });
const r = await client.chat.completions.create({ model: "auto", messages: [{ role: "user", content: "Hello!" }] });
console.log(r.choices[0].message.content);// go get github.com/openai/openai-go
package main
import ("context"; "fmt"; openai "github.com/openai/openai-go"; "github.com/openai/openai-go/option")
func main() {
c := openai.NewClient(option.WithAPIKey("YOUR_API_KEY"), option.WithBaseURL("https://aicraftapi.net/v1"))
r, _ := c.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: openai.String("auto"),
Messages: openai.F([]openai.ChatCompletionMessageParamUnion{openai.UserMessage("Hello!")}),
})
fmt.Println(r.Choices[0].Message.Content)
}model: "auto" to enable Auto Router — automatically picks the best model.Download Tools (Step-by-Step)
Tools to get the most out of AICraft. Install in order: ① Node.js → ② VS Code → ③ Claude Code. Every step includes a verification check. If you get stuck, see the troubleshooting table in Step ③.
① Node.js (Prerequisite)
Node.js + AICraft
Claude Code is a terminal tool that runs on Node.js. Install Node.js 18+ first — we recommend the 22 LTS stable release.
Download Node.js 22 LTSInstallation Steps
- Download: Click "Download Node.js 22 LTS" above to open the official page.
- Version: Click the big green Download Node.js 22 LTS button (auto-detects your OS).
- Install: Double-click the installer → Next → Finish. Windows users: make sure "Add to PATH" is checked (it is by default).
- Verify: Open a terminal (Windows: Win+R → type
cmd→ Enter; Mac: "Terminal" app), run:node -v
You should seev22.x.x✅. Then runnpm -v— if it prints a version too, everything is ready.
② VS Code
VS Code + AICraft
VS Code is the editor (free, no login needed). Two ways to use it: A. Run Claude Code in the terminal (recommended, most powerful); B. Install the Cline extension for in-editor AI. You can use both.
Download VS CodeInstallation Steps
- Download: Click "Download VS Code" above and pick your OS (Windows / Mac).
- Install: Double-click → Next. On Windows, tick "Add to PATH" and the "Open with Code" context-menu option.
- Verify: Open VS Code — if the welcome page appears, you're done ✅.
Play B: Cline Extension (In-Editor AI Chat)
- In VS Code, click the Extensions icon (4 squares) on the left, search
Cline, click Install. - Click the Cline icon on the right sidebar to open its panel.
- Set API Provider to OpenAI Compatible.
- Fill in the fields below (use the API Key you create in ③ Step 2):
| Setting | Value |
|---|---|
| Base URL | https://aicraftapi.net/v1 (⚠️ must include /v1 — the opposite of Claude Code) |
| API Key | sk-YOUR_KEY (replace with your real Key) |
| Model | auto |
③ Claude Code Setup (Step-by-Step)
Claude Code is Anthropic's terminal AI coding agent — the core of this guide. Follow these 6 steps.
Step 1: Install Claude Code
Prerequisite: Node.js 18+ (go back to ① Node.js if you haven't installed it).
Option A (recommended) — official one-click script:
- Download: Download Install Script
- Open a terminal in the script's folder (Mac / Linux) and run
bash install-claude-code.sh - When prompted
>, paste the API Key you created, press Enter - The script installs Claude Code AND writes the config for you. When you see
Done!, you're all set ✅
Option B — manual install: pick your OS:
# Option 1: Official native installer (recommended, auto-updates) curl -fsSL https://claude.ai/install.sh | bash # Option 2: npm install (fallback, requires Node.js) npm install -g @anthropic-ai/claude-code # Verify claude --version
:: Windows — pick one: :: Option A (recommended): install WSL first (Microsoft Store, search "WSL"), :: then run this in the Ubuntu terminal: curl -fsSL https://claude.ai/install.sh | bash :: Option B (quick): use npm with Node.js npm install -g @anthropic-ai/claude-code
Verify: run claude --version — a version number means success ✅
Step 2: Get Your API Key
- Log in to the AICraft Console
- Find the "API Key" card → click "Create"
- Copy the generated key — it starts with
sk-followed by 40 hex characters
sk-a1b2c3..., not sk-YOUR_KEY.Step 3: Configure settings.json
Used the one-click script? It wrote the config for you — skip this step, go to Step 4.
Manual install? Find (or create) the config file:
| OS | Path |
|---|---|
| macOS / Linux | ~/.claude/settings.json |
| Windows | %USERPROFILE%\.claude\settings.json (i.e. C:\Users\YOURNAME\.claude\settings.json) |
If the .claude folder doesn't exist, create it first:
mkdir -p ~/.claude && touch ~/.claude/settings.json
New-Item -ItemType Directory -Force -Path "$HOME\.claude" | Out-Null New-Item -ItemType File -Force -Path "$HOME\.claude\settings.json" | Out-Null
Paste this, replacing YOUR_API_KEY with your real key:
{
"env": {
"ANTHROPIC_BASE_URL": "https://aicraftapi.net",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_MODEL": "auto",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "auto",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "auto",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "auto",
"CLAUDE_CODE_SUBAGENT_MODEL": "auto"
}
}| Variable | Req | Description |
|---|---|---|
| ANTHROPIC_BASE_URL | Yes | API Gateway aicraftapi.net (no /v1 — Claude Code appends it) |
| ANTHROPIC_AUTH_TOKEN | Yes | API Key, format sk-xxx |
| ANTHROPIC_MODEL | Yes | Default model. "auto" enables Auto Router |
| ANTHROPIC_DEFAULT_OPUS_MODEL | No | Opus tier mapping |
| ANTHROPIC_DEFAULT_SONNET_MODEL | No | Sonnet tier mapping |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | No | Haiku tier mapping |
| CLAUDE_CODE_SUBAGENT_MODEL | No | Sub-agent model, keep consistent with main |
ANTHROPIC_BASE_URL must NOT include /v1 — Claude Code appends /v1/messages automatically. Adding it causes a 404."auto" — Router picks the best model per task: DeepSeek for coding, Qwen for Chinese, Claude for complex reasoning.Step 4: Verify the Connection
- Open a new terminal and cd to your project:
cd your-project claude
- After startup, type
/statusand check:
| Check | Should be |
|---|---|
| API Endpoint | aicraftapi.net |
| Model | auto |
- Ask: "Hi, introduce yourself." → a reply means everything works ✅
Step 5: Use It With VS Code (Vibe Coding)
- In VS Code: File → Open Folder → select your project
- Press Ctrl+` to open the built-in terminal
- Type
claudeand press Enter - Let Claude edit code — changes appear live in the editor
Step 6: Enable Deep Reasoning (Optional)
Type /config in Claude Code → set Thinking mode to true → quit and re-enter.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Claude keeps asking to log in to Anthropic | settings.json is wrong | Recheck path & content in Step 3 |
| 404 / "model problem" | base URL has /v1 | Remove /v1 — keep only aicraftapi.net |
| Rate-limited / no quota | No top-up | Top up in Console, min $1 |
| 401 Invalid key | Key typo / unverified email | Recheck key; click email verification link |
| npm install fails | No Node.js / network | Install Node.js (Step ①) or use WSL |
| Cline can't connect | Base URL missing /v1 | Cline uses aicraftapi.net/v1 (with /v1) |
Does Web Search work?
Yes. AICraft doesn't block native search. For MCP search: Tencent Cloud MCP Marketplace.
Which model does "auto" pick?
Router picks per task: DeepSeek for coding, Qwen for Chinese, MiniMax for creative. Check the X-AICraft-Routed-To header. See Auto Router.
④ Skills Pack (Optional)
140 AI development skills covering coding, testing, deployment, security, and docs. Import into Claude Code for direct use.
140 Skills · 5.3MB · 454 Files
| Category | Coverage | Examples |
|---|---|---|
| Coding | Python / TS / Go / API / DB / Frontend | python-patterns fastapi database-design |
| Testing | Unit / Integration / E2E / Perf / TDD | test-driven-development e2e-testing |
| Review | Code Review / Security / Performance | code-review-and-quality security |
| DevOps | CI/CD / Docker / Monitoring | ci-cd deployment-strategies |
| Docs | Technical / Articles / Investor | technical-documentation article-writing |
| AI/LLM | Prompt / Agent / RAG / Audit | optimize-prompt langgraph claude-api |
Install
Extract to Claude Code's skills directory:
| Tool | InstallPath |
|---|---|
| Claude Code | ~/.claude/skills/ |
# 1. Download and extract unzip aicraft-skills.zip -d ~/.claude/skills/ # 2. Verify ls ~/.claude/skills/ # You should see 140 skill directories (python / fastapi / code-review ...)
:: 1. Download aicraft-skills.zip :: 2. Extract to %USERPROFILE%\.claude\skills (right-click zip → Extract to .claude\skills) :: 3. Verify with PowerShell dir $env:USERPROFILE\.claude\skills\
Usage
Type /skill-name in Claude Code to invoke a skill. Examples:
/python-patterns # Python design pattern guidance /code-review # Review current code /test-driven-development # TDD workflow /deployment-strategies # Deployment advice /security # Security review /api-design # API design best practices
INDEX.md → invoke the matching skill → execute.API Reference
Chat Completions
OpenAI-compatible chat completions endpoint.
Parameters
| Parameter | Type | Req | Default | Description |
|---|---|---|---|---|
| model | string | Yes | — | "auto" or specify a Model name |
| messages | array | Yes | — | Messages array. role: system/user/assistant |
| stream | boolean | No | false | SSE streaming output |
| temperature | number | No | 1 | Temperature 0-2. Higher = more random |
| max_tokens | integer | No | — | Max output tokens |
| top_p | number | No | 1 | Nucleus sampling |
| frequency_penalty | number | No | 0 | -2.0 to 2.0. Positive value reduces repetition |
| presence_penalty | number | No | 0 | -2.0 to 2.0. Positive value encourages novelty |
| stop | string/array | No | — | Stop sequence(s) |
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1720000000,
"model": "deepseek/deepseek-v4-pro",
"choices": [{
"message": { "role": "assistant", "content": "Hello! How can I help?" },
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 10, "completion_tokens": 8, "total_tokens": 18 }
}model: "auto", the response model field shows the Router-selected model.Streaming (SSE)
Set "stream": true:
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" world"}}]}
data: {"choices":[{"finish_reason":"stop"}]}
data: [DONE]Each chunk is data: {json}. Ends with data: [DONE]. OpenAI SDK handles this.
Model List
List available models. Full catalog: Model Catalog.
curl https://aicraftapi.net/v1/models -H "Authorization: Bearer YOUR_API_KEY"
Auto Router v6
model: "auto" activates the core routing engine.
6 Routing Categories
| Task | Primary Model | Fallback |
|---|---|---|
| Coding | deepseek/deepseek-v4-pro | deepseek/deepseek-v4-flash |
| Chinese | qwen/qwen3.7-max | z-ai/glm-5 |
| Translation | qwen/qwen3.6-plus | deepseek/deepseek-v4-flash |
| Reasoning | z-ai/glm-5 | deepseek/deepseek-v4-pro-202606 |
| Math | deepseek/deepseek-v4-pro-202606 | z-ai/glm-5 |
| Creative | minimax/minimax-m3 | deepseek/deepseek-v4-flash |
| Complex | claude-4.5-sonnet | openai/gpt-5.4 |
| Fast | deepseek/deepseek-v4-flash | qwen/qwen3.6-plus |
Response Headers
| Response Headers | Description |
|---|---|
X-AICraft-Mode | Routing mode (auto / manual) |
X-AICraft-Category | Detected TaskCategory |
X-AICraft-Routed-To | actually used model |
X-AICraft-Savings | Cost saved vs GPT-4 |
v6 Smart Features
- Lock Decay — 7 days idle → auto-unlock model preference
- Drift Detection — Task type shift > 40% → auto-unlock
- Fault Self-Healing — failed models bypassed within 1h
- Community Cold Start — new users learn from community
- Feedback API —
POST /v1/feedbackteaches Router preferences
Guides
Response Cache beta
Two-layer caching saves money automatically. Rolling out gradually.
| Layer | Technology | Speed | Cost |
|---|---|---|---|
| A · Provider Cache | cache_control passthrough | ~200ms | 90% discount |
| B · Semantic Cache | BGE-small, similarity >0.95 | <5ms | FREE |
- Hit rate: 35-55% · Capacity: 50k · TTL: 1h · user_id isolated
- Auto-enabled. Skip:
X-AICraft-No-Cache: true - Stats:
GET /cache-stats
Rate Limits
| Plan | Top-up | Concurrency | Description |
|---|---|---|---|
| Basic | Any amount (new users get free trial credit) | 10 | Pay-per-use · All models |
| Advanced | $15 | 30 | Faster calls · Daily use |
| Pro | $70 | 80 | High-speed calls · Frequent development |
| Enterprise | $280 | 200 | Sub-keys · Team management · Invoice |
Returns 429 when exceeded. See Pricing.
Error Codes
| Code | Meaning | Action |
|---|---|---|
| 400 | Bad request | Check JSON and required fields |
| 401 | Invalid API Key | Verify Authorization header |
| 429 | Rate limited | Slow down or upgrade Plan |
| 500 | Model unavailable | Router retries other models |
| 503 | Service overloaded | Retry shortly, OSauto-scaling |