AI Proxy Node AI Proxy Node Docs

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

FieldValue
Base URLhttps://aiproxynode.com
OpenAI-compatible prefix/v1/*
Claude native prefix/v1/messages or /claude/v1/messages
AuthenticationAuthorization: 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.

Python
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)

Python
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

Python
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.

Python
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)

⚠ Pick the right group when creating a Token

Each aiproxynode token is bound to exactly one group; cross-group calls are not auto-routed:

  • kiro group — runs Claude models (sonnet / opus / haiku)
  • gptpuls group — 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.

ScenarioRequired GroupWindows (.ps1)macOS (.sh)
VSCode + Claude CodekiroDownloadDownload
Claude Desktop + CLIkiroDownloadDownload
VSCode + Cline (using GPT)gptpulsDownloadDownload
Cursor + ClaudekiroDownloadDownload
Cursor mixed (choose at runtime)chosen at runtimeDownloadDownload

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:

Windows · PowerShell
# 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
macOS / Linux · bash/zsh
# 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:

CLI
ANTHROPIC_BASE_URL=https://aiproxynode.com \
ANTHROPIC_AUTH_TOKEN=sk-xxxxxx \
claude --model claude-sonnet-4-6
Choosing a default model

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)

  1. Open Cline settings (gear icon)
  2. Set API Provider to Anthropic
  3. Tick Use custom base URL, fill in https://aiproxynode.com
  4. Set API Key to your token sk-xxxxxx
  5. Pick a Model like claude-sonnet-4-6 or claude-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:

Read first: 3 common pitfalls (cause 80% of setup failures)
  • 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-6 or gpt-4o through 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.
  1. Disable the Anthropic API Key toggle. If you turned it on previously, turn it off and clear the Anthropic Key input.
  2. Expand the API Keys section → enable OpenAI API Key → paste your token sk-xxxxxx
  3. Enable Override OpenAI Base URL → set the URL to https://aiproxynode.com/v1
  4. Scroll up to the Models list, find the Add or search model input, and add the rows below (press Enter after each):
    Alias to enterReal model usedUse case
    aiproxy/sonnetclaude-sonnet-4-6Daily code work, balanced cost/quality (recommended)
    aiproxy/haikuclaude-haiku-4-5Lightweight tasks, cheapest
    aiproxy/opusclaude-opus-4-7Hard reasoning, complex tasks
    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.
  5. Flip the toggle ON for every newly added model. Adding alone doesn't expose them in the chat dropdown.
  6. 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.
How to confirm the request reaches this site
  1. Send a test message in Cursor
  2. Open aiproxynode.com Console → Logs, refresh, and check whether your request appears
  3. If it shows up → you're good; if not → most likely you missed step 5 or didn't pick the model in step 6
About Cursor's built-in models (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.

Tab completion and Apply still go through Cursor

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:

config.json
{
  "models": [
    {
      "title": "Claude Sonnet 4.6 via AiProxyNode",
      "provider": "anthropic",
      "model": "claude-sonnet-4-6",
      "apiKey": "sk-xxxxxx",
      "apiBase": "https://aiproxynode.com"
    }
  ]
}
Prefer the OpenAI-compatible protocol

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

Python
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
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

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

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

HTTPError typeDescription
400invalid_request_errorBad parameters — usually a missing field or wrong type
401authentication_errorAPI Key is wrong or has been disabled
402insufficient_quotaAccount balance or token quota exhausted
403forbiddenToken doesn't have access to this model
404not_foundModel name doesn't exist or has been retired
429rate_limit_exceededRate limit hit — retry or lower concurrency
500internal_errorUpstream or gateway error — please retry
502 / 503upstream_errorUpstream temporarily unavailable — retry or switch model
Recommended practice

For production traffic, always retry idempotent calls with exponential backoff and add automatic model fallback for 5xx failures.