API Reference
This site is fully compatible with the native OpenAI and Anthropic protocols — point your existing SDK at our Base URL and you're done.
Basics
| Field | Value |
|---|---|
| Base URL | https://aiproxynode.com |
| OpenAI-compatible prefix | /v1/* |
| Claude native prefix | /v1/messages or /claude/v1/messages |
| Authentication | Authorization: Bearer sk-xxxxxx or x-api-key: sk-xxxxxx |
OpenAI-compatible protocol
Call using the official OpenAI ChatCompletions protocol. Use each provider's official model name — we route to the correct upstream automatically.
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://aiproxynode.com/v1",
)
# Call any model via the OpenAI protocol
for model in ["claude-sonnet-4-6", "claude-haiku-4-5", "deepseek-chat", "deepseek-reasoner"]:
resp = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Hi"}],
)
print(model, "->", resp.choices[0].message.content)Multimodal (image input)
resp = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What does the image say?"},
{"type": "image_url", "image_url": {"url": "https://example.com/x.png"}},
],
}],
)Function Calling / Tools
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}]
resp = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "How is the weather in Beijing?"}],
tools=tools,
)Claude native API
When using the official Anthropic SDK, just change base_url to https://aiproxynode.com.
import anthropic
client = anthropic.Anthropic(
api_key="sk-xxxxxx",
base_url="https://aiproxynode.com",
)
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hi"}],
)
print(resp.content[0].text)IDE client setup (Claude Code / Cline / Cursor / Continue)
Each aiproxynode token is bound to exactly one group; cross-group calls are not auto-routed:
kirogroup — runs Claude models (sonnet / opus / haiku)gptpulsgroup — runs GPT models (gpt-5.5 / 5.4 / 5.3-codex)
If your client returns no available channels under group X, the token's group does not match the requested model.
⚡ One-click Setup Scripts
Don't want to copy environment variables by hand? Download the matching script — it backs up your existing config and writes the new one for you.
| Scenario | Required Group | Windows (.ps1) | macOS (.sh) |
|---|---|---|---|
| VSCode + Claude Code | kiro | Download | Download |
| Claude Desktop + CLI | kiro | Download | Download |
| VSCode + Cline (using GPT) | gptpuls | Download | Download |
| Cursor + Claude | kiro | Download | Download |
| Cursor mixed (choose at runtime) | chosen at runtime | Download | Download |
Usage: right-click the link → Save link as → on Windows right-click the .ps1 and Run with PowerShell; on macOS run bash setup-xxx.sh in Terminal.
The script prompts for a token and writes the config; it does NOT perform an online connectivity check. After running, send a test message in your client to confirm.
Most in-IDE AI assistants support pointing at a custom Anthropic-compatible endpoint via environment variables or settings. Here's how to set up the common ones.
Claude Code (VSCode extension / CLI)
Anthropic's official Claude Code switches to this site via two environment variables — ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN:
# System-wide, persistent (recommended)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://aiproxynode.com", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-xxxxxx", "User")
# Restart VSCode to pick it up# Add to ~/.zshrc or ~/.bashrc export ANTHROPIC_BASE_URL="https://aiproxynode.com" export ANTHROPIC_AUTH_TOKEN="sk-xxxxxx" # Restart VSCode / Terminal to pick it up
For a one-off session-only switch:
ANTHROPIC_BASE_URL=https://aiproxynode.com \ ANTHROPIC_AUTH_TOKEN=sk-xxxxxx \ claude --model claude-sonnet-4-6
On startup, Claude Code queries our /v1/models for the available list — see Model List below for what's currently exposed. Use the /model command to switch within a session. We recommend claude-sonnet-4-6 for daily use, claude-opus-4-7 for hard reasoning, and claude-haiku-4-5 for cheap, high-volume calls.
Cline / Roo Code (VSCode extension)
- Open Cline settings (gear icon)
- Set API Provider to
Anthropic - Tick Use custom base URL, fill in
https://aiproxynode.com - Set API Key to your token
sk-xxxxxx - Pick a Model like
claude-sonnet-4-6orclaude-opus-4-7
Cursor
Cursor doesn't expose an Anthropic Base URL setting; all third-party integrations go through the OpenAI-compatible protocol. In Cursor Settings → Models:
- Don't enable the Anthropic API Key at the same time: known Cursor bug — if both Anthropic Key and Override OpenAI Base URL are on, every Claude call returns 422. The token from this site goes in OpenAI API Key only.
- Don't use the official model names directly: Cursor will preferentially route names like
claude-sonnet-4-6orgpt-4othrough its own channel, so the request never reaches us. Use the site-specific aliases (see step 3 below). - After adding, two more things: when you add a custom model, you must flip the toggle ON on the right, and manually pick it from the model dropdown in chat, otherwise Cursor falls back to its default Auto/built-in model.
- Disable the Anthropic API Key toggle. If you turned it on previously, turn it off and clear the Anthropic Key input.
- Expand the API Keys section → enable OpenAI API Key → paste your token
sk-xxxxxx - Enable Override OpenAI Base URL → set the URL to
https://aiproxynode.com/v1 - Scroll up to the Models list, find the Add or search model input, and add the rows below (press Enter after each):
Aliases are used instead of official names to bypass Cursor's "built-in first" routing. The site operator must first map these aliases to the real models in new-api's Channels → Model Redirect; regular users can copy the aliases above as-is, no setup needed.Alias to enter Real model used Use case aiproxy/sonnetclaude-sonnet-4-6 Daily code work, balanced cost/quality (recommended) aiproxy/haikuclaude-haiku-4-5 Lightweight tasks, cheapest aiproxy/opusclaude-opus-4-7 Hard reasoning, complex tasks - Flip the toggle ON for every newly added model. Adding alone doesn't expose them in the chat dropdown.
- Open any chat/Agent session, click the model picker at the bottom-left, and pick the
aiproxy/sonnet(or other) you just added. Without manually picking it, Cursor defaults to Auto = built-in models, and the request won't reach this site.
- Send a test message in Cursor
- Open aiproxynode.com Console → Logs, refresh, and check whether your request appears
- If it shows up → you're good; if not → most likely you missed step 5 or didn't pick the model in step 6
GPT-5.4 / Opus 4.6 etc.)The models pre-listed at the top use Cursor's own subscription channel and have nothing to do with this site. Even with OpenAI Base URL configured correctly, picking a built-in model in chat sends the request through Cursor, not through us.
Even with everything configured correctly, Cursor's Tab autocomplete and the Apply action on chat replies are powered by Cursor's own small models — those don't go through this site. Only the main Chat/Agent conversation uses your custom model.
Continue (VSCode / JetBrains extension)
Edit ~/.continue/config.json and add to the models array:
{
"models": [
{
"title": "Claude Sonnet 4.6 via AiProxyNode",
"provider": "anthropic",
"model": "claude-sonnet-4-6",
"apiKey": "sk-xxxxxx",
"apiBase": "https://aiproxynode.com"
}
]
}Unless your application strictly depends on Claude-native features (such as tool_use blocks or the content blocks structure), prefer the OpenAI-compatible protocol — the debugging tooling and ecosystem are far more complete.
Streaming
Every model supports streaming (Server-Sent Events):
stream = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Write a short poem"}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)curl https://aiproxynode.com/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Write a poem"}],
"stream": true
}'Model list
For common models, just use the official model name. The full list and pricing live at main site → Models.
OpenAI
OpenAI channels are not enabled at the moment. We recommend claude-sonnet-4-6 (comparable to GPT-4o) or deepseek-chat (high cost-performance) instead. This section will be updated when OpenAI channels go live.
Anthropic Claude
claude-haiku-4-5— cheapest, suited for high-volume lightweight callsclaude-sonnet-4-5·claude-sonnet-4-6— balanced cost and qualityclaude-opus-4-5·claude-opus-4-6·claude-opus-4-7— strongest reasoning
The aliases above are recommended. The dated forms for the active versions (claude-haiku-4-5-20251001 / claude-sonnet-4-5-20250929 / claude-opus-4-5-20251101) also work — the official Anthropic SDK and Claude Code map aliases to dated names internally, so you don't need to specify them yourself. Retired dated names (e.g. claude-sonnet-4-20250514) will return 503 model_not_found.
DeepSeek
deepseek-chat— general chat and code (latest V4 series)deepseek-reasoner— long-chain reasoning / math / hard tasksdeepseek-coder— code-focused alias
Moonshot / Doubao / Qwen / GLM / Gemini / OpenAI channels are not enabled at the moment — calling those model names returns 503 No available channel. The complete list of available models and pricing is on the main site Models page.
Error codes
| HTTP | Error type | Description |
|---|---|---|
| 400 | invalid_request_error | Bad parameters — usually a missing field or wrong type |
| 401 | authentication_error | API Key is wrong or has been disabled |
| 402 | insufficient_quota | Account balance or token quota exhausted |
| 403 | forbidden | Token doesn't have access to this model |
| 404 | not_found | Model name doesn't exist or has been retired |
| 429 | rate_limit_exceeded | Rate limit hit — retry or lower concurrency |
| 500 | internal_error | Upstream or gateway error — please retry |
| 502 / 503 | upstream_error | Upstream temporarily unavailable — retry or switch model |
For production traffic, always retry idempotent calls with exponential backoff and add automatic model fallback for 5xx failures.