Claude API Proxy

Use Claude models with Claude Code, the Anthropic SDK, or any OpenAI-compatible tool.

Short answer

APIVAI is a Claude API proxy: point Claude Code or the Anthropic SDK at https://api.apivai.com (no /v1), or any OpenAI-compatible tool at https://api.apivai.com/v1, and use the same Claude models with an APIVAI key. As of 2026-10-10, Claude Sonnet 4.6 (model ID claude-sonnet-4-6) costs $1.15 / $5.74 per million input / output tokens, against $3.00 / $15.00 at Anthropic's list price. Billing is pay-as-you-go from a prepaid balance.

BASE URLhttps://api.apivai.com

APIVAI exposes Claude models in two formats. Pick the one your tool expects — mixing them up is the most common cause of 404 errors.

FormatBase URLEndpointAuth headerUsed by
Anthropic-nativehttps://api.apivai.com/v1/messagesx-api-keyClaude Code, Anthropic SDK
OpenAI-compatiblehttps://api.apivai.com/v1/chat/completionsAuthorization: BearerCursor, Cline, Aider, OpenAI SDK

What matters is the final address: requests must reach https://api.apivai.com/v1/messages (Anthropic format) or https://api.apivai.com/v1/chat/completions (OpenAI format). Tools differ in what they add to the base URL. The Anthropic SDK and Claude Code add /v1/messages, so they take https://api.apivai.com; most OpenAI-style tools add /chat/completions, so they take https://api.apivai.com/v1. A few tools differ — Continue's anthropic provider and Chatbox's Claude mode add only /messages and need https://api.apivai.com/v1 — so follow the guide for your tool.

Claude Code

macOS / Linux

export ANTHROPIC_BASE_URL="https://api.apivai.com" export ANTHROPIC_AUTH_TOKEN="YOUR_APIVAI_API_KEY" claude

Windows PowerShell

$env:ANTHROPIC_BASE_URL="https://api.apivai.com" $env:ANTHROPIC_AUTH_TOKEN="YOUR_APIVAI_API_KEY" claude

If ANTHROPIC_API_KEY is already set, remove it first, or it is used instead of your APIVAI key: unset ANTHROPIC_API_KEY (PowerShell: Remove-Item Env:ANTHROPIC_API_KEY).

Start with a short prompt to confirm routing before running a long agent session.

With these two variables Claude Code bills per token from your APIVAI balance, so no Claude Pro or Max plan is needed. What that costs per month, and when a plan is cheaper: Claude Code without a subscription.

Anthropic SDK

Python

import anthropic client = anthropic.Anthropic( api_key="YOUR_APIVAI_API_KEY", base_url="https://api.apivai.com", ) message = client.messages.create( model="claude-sonnet-4-6", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}], ) print(message.content[0].text)

Node.js

import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ apiKey: process.env.APIVAI_API_KEY, baseURL: "https://api.apivai.com", }); const message = await client.messages.create({ model: "claude-sonnet-4-6", max_tokens: 1024, messages: [{ role: "user", content: "Hello!" }], }); // message.content is an array of content blocks console.log(message.content.map((b) => (b.type === "text" ? b.text : "")).join(""));

cURL (Messages API)

curl https://api.apivai.com/v1/messages \ -H "x-api-key: YOUR_APIVAI_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-6", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello!"}] }'

Add "stream": true to the body to receive the response as server-sent events.

Claude through the OpenAI format

Tools that only accept an OpenAI-style provider can still use Claude models — point them at the /v1 base URL and pass a Claude model ID.

curl https://api.apivai.com/v1/chat/completions \ -H "Authorization: Bearer YOUR_APIVAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-6", "messages": [{"role": "user", "content": "Hello!"}] }'

Common errors

ErrorUsual cause
401The key is missing, malformed, or not visible to the process that launched the tool.
404The base URL has /v1 where it should not, is missing it, or has it twice.
model_not_foundThe configured model is not in your current GET /v1/models response.

Every error code with its causes and fixes: Claude API error codes.

FAQ

Which base URL does Claude Code need?

https://api.apivai.com, with no trailing slash and no /v1. Claude Code adds /v1/messages itself.

Why do I get a 404?

The final address is wrong, usually a missing, extra or doubled /v1. It must be https://api.apivai.com/v1/messages or https://api.apivai.com/v1/chat/completions. Claude Code and the Anthropic SDK take https://api.apivai.com; most OpenAI-style tools take https://api.apivai.com/v1; check your tool's guide for exceptions.

Why do I get a 401 with a correct key?

ANTHROPIC_API_KEY is probably also set in your shell and takes priority. Unset it, or check that the key still has budget on the Dashboard.

Can the same key call GPT models?

Yes. Use a GPT model ID such as gpt-5.5 through the OpenAI-format base URL https://api.apivai.com/v1.

How many requests can I send?

Each key allows 60 requests per minute by default; contact support for a higher limit.