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.

Keep your API Key secret. Never expose it in client code or repos.

2. Base URL

Base URL

API Gateway

https://aicraftapi.net/v1

3. 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)
}
Set 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 LTS

Installation Steps

  1. Download: Click "Download Node.js 22 LTS" above to open the official page.
  2. Version: Click the big green Download Node.js 22 LTS button (auto-detects your OS).
  3. Install: Double-click the installer → Next → Finish. Windows users: make sure "Add to PATH" is checked (it is by default).
  4. Verify: Open a terminal (Windows: Win+R → type cmd → Enter; Mac: "Terminal" app), run:
    node -v
    You should see v22.x.x ✅. Then run npm -v — if it prints a version too, everything is ready.
If you see "'node' is not recognized", the install failed or "Add to PATH" wasn't checked — just reinstall it.

② 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 Code

Installation Steps

  1. Download: Click "Download VS Code" above and pick your OS (Windows / Mac).
  2. Install: Double-click → Next. On Windows, tick "Add to PATH" and the "Open with Code" context-menu option.
  3. Verify: Open VS Code — if the welcome page appears, you're done ✅.

Play B: Cline Extension (In-Editor AI Chat)

  1. In VS Code, click the Extensions icon (4 squares) on the left, search Cline, click Install.
  2. Click the Cline icon on the right sidebar to open its panel.
  3. Set API Provider to OpenAI Compatible.
  4. Fill in the fields below (use the API Key you create in ③ Step 2):
SettingValue
Base URLhttps://aicraftapi.net/v1 (⚠️ must include /v1 — the opposite of Claude Code)
API Keysk-YOUR_KEY (replace with your real Key)
Modelauto
Ask anything after filling it in — a reply means Cline is configured successfully.

③ 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:

  1. Download: Download Install Script
  2. Open a terminal in the script's folder (Mac / Linux) and run bash install-claude-code.sh
  3. When prompted > , paste the API Key you created, press Enter
  4. 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
Official native installer is recommended. npm still works but is being deprecated by Anthropic.

Verify: run claude --version — a version number means success ✅

Step 2: Get Your API Key

  1. Log in to the AICraft Console
  2. Find the "API Key" card → click "Create"
  3. Copy the generated key — it starts with sk- followed by 40 hex characters
⚠️ Your key is shown in full only once — copy and save it immediately. Lost it? Create a new one. Note: it looks like 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:

OSPath
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"
  }
}
VariableReqDescription
ANTHROPIC_BASE_URLYesAPI Gateway aicraftapi.net (no /v1 — Claude Code appends it)
ANTHROPIC_AUTH_TOKENYesAPI Key, format sk-xxx
ANTHROPIC_MODELYesDefault model. "auto" enables Auto Router
ANTHROPIC_DEFAULT_OPUS_MODELNoOpus tier mapping
ANTHROPIC_DEFAULT_SONNET_MODELNoSonnet tier mapping
ANTHROPIC_DEFAULT_HAIKU_MODELNoHaiku tier mapping
CLAUDE_CODE_SUBAGENT_MODELNoSub-agent model, keep consistent with main
⚠️ ANTHROPIC_BASE_URL must NOT include /v1 — Claude Code appends /v1/messages automatically. Adding it causes a 404.
Map every tier to "auto" — Router picks the best model per task: DeepSeek for coding, Qwen for Chinese, Claude for complex reasoning.

Step 4: Verify the Connection

  1. Open a new terminal and cd to your project:
    cd your-project
    claude
  2. After startup, type /status and check:
CheckShould be
API Endpointaicraftapi.net
Modelauto
  1. Ask: "Hi, introduce yourself." → a reply means everything works ✅
If it keeps asking you to log in to Anthropic, settings.json isn't taking effect — check the path and content in Step 3.

Step 5: Use It With VS Code (Vibe Coding)

  1. In VS Code: File → Open Folder → select your project
  2. Press Ctrl+` to open the built-in terminal
  3. Type claude and press Enter
  4. 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

SymptomCauseFix
Claude keeps asking to log in to Anthropicsettings.json is wrongRecheck path & content in Step 3
404 / "model problem"base URL has /v1Remove /v1 — keep only aicraftapi.net
Rate-limited / no quotaNo top-upTop up in Console, min $1
401 Invalid keyKey typo / unverified emailRecheck key; click email verification link
npm install failsNo Node.js / networkInstall Node.js (Step ①) or use WSL
Cline can't connectBase URL missing /v1Cline 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

CategoryCoverageExamples
CodingPython / TS / Go / API / DB / Frontendpython-patterns fastapi database-design
TestingUnit / Integration / E2E / Perf / TDDtest-driven-development e2e-testing
ReviewCode Review / Security / Performancecode-review-and-quality security
DevOpsCI/CD / Docker / Monitoringci-cd deployment-strategies
DocsTechnical / Articles / Investortechnical-documentation article-writing
AI/LLMPrompt / Agent / RAG / Auditoptimize-prompt langgraph claude-api
Download Skills Pack (5.3MB)

Install

Extract to Claude Code's skills directory:

ToolInstallPath
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
140 skills cover the full dev lifecycle. Got a task → check INDEX.md → invoke the matching skill → execute.

API Reference

Chat Completions

POST/v1/chat/completions

OpenAI-compatible chat completions endpoint.

Parameters

ParameterTypeReqDefaultDescription
modelstringYes"auto" or specify a Model name
messagesarrayYesMessages array. role: system/user/assistant
streambooleanNofalseSSE streaming output
temperaturenumberNo1Temperature 0-2. Higher = more random
max_tokensintegerNoMax output tokens
top_pnumberNo1Nucleus sampling
frequency_penaltynumberNo0 -2.0 to 2.0. Positive value reduces repetition
presence_penaltynumberNo0 -2.0 to 2.0. Positive value encourages novelty
stopstring/arrayNoStop 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 }
}
With 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

GET/v1/models

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

TaskPrimary ModelFallback
Codingdeepseek/deepseek-v4-prodeepseek/deepseek-v4-flash
Chineseqwen/qwen3.7-maxz-ai/glm-5
Translationqwen/qwen3.6-plusdeepseek/deepseek-v4-flash
Reasoningz-ai/glm-5deepseek/deepseek-v4-pro-202606
Mathdeepseek/deepseek-v4-pro-202606z-ai/glm-5
Creativeminimax/minimax-m3deepseek/deepseek-v4-flash
Complexclaude-4.5-sonnetopenai/gpt-5.4
Fastdeepseek/deepseek-v4-flashqwen/qwen3.6-plus

Response Headers

Response HeadersDescription
X-AICraft-ModeRouting mode (auto / manual)
X-AICraft-CategoryDetected TaskCategory
X-AICraft-Routed-Toactually used model
X-AICraft-SavingsCost saved vs GPT-4

v6 Smart Features

Guides

Response Cache beta

Two-layer caching saves money automatically. Rolling out gradually.

LayerTechnologySpeedCost
A · Provider Cachecache_control passthrough~200ms90% discount
B · Semantic CacheBGE-small, similarity >0.95<5msFREE
Every 2-3 Requests hit cache. High-frequency use cases (Service, Translation) see better rates.

Rate Limits

PlanTop-upConcurrencyDescription
BasicAny amount (new users get free trial credit)10Pay-per-use · All models
Advanced$1530Faster calls · Daily use
Pro$7080High-speed calls · Frequent development
Enterprise$280200Sub-keys · Team management · Invoice

Returns 429 when exceeded. See Pricing.

Error Codes

CodeMeaningAction
400Bad requestCheck JSON and required fields
401Invalid API KeyVerify Authorization header
429Rate limitedSlow down or upgrade Plan
500Model unavailableRouter retries other models
503Service overloadedRetry shortly, OSauto-scaling

OnlineDebug

0.7
AICraft Assistant
Powered by AICraft Auto Router