If your team is already using openai-python, you don't need to install anything new. Change the base URL, keep your code, save 50-65% on every call.
TL;DR โ NovAI's Claude gateway is fully OpenAI-compatible. Python, Node.js, Go, LangChain, LlamaIndex, Dify, Cursor, Continue.dev โ they all work. You change one line (the base URL) and one line (the API key). Model names map 1:1 to Anthropic's naming: claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5.
If you are running production workloads on Anthropic's direct API, you are paying:
And that's before you factor in the fact that most Chinese developers can't access Anthropic directly without a proxy โ NovAI handles the upstream routing for you, with a China-mainland-friendly endpoint.
from anthropic import Anthropic
client = Anthropic(api_key="sk-ant-...")
resp = client.messages.create(
model="claude-opus-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.content[0].text)
from openai import OpenAI
client = OpenAI(
+ api_key="sk-novai-...", # your NovAI key
+ base_url="https://aiapi-pro.com/v1", # that's it
)
resp = client.chat.completions.create(
+ model="claude-opus-4-7", # use the 4.7 naming
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
That's it. Three lines changed. No new SDK, no schema rewrite, no tool-calling translation. If you were already using OpenAI's SDK for GPT models, you literally just swap the base_url per request.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NOVAI_API_KEY,
baseURL: "https://aiapi-pro.com/v1",
});
const resp = await client.chat.completions.create({
model: "claude-sonnet-4-6",
messages: [{ role: "user", content: "Summarize this PR..." }],
max_tokens: 2048,
});
console.log(resp.choices[0].message.content);
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="claude-opus-4-7",
api_key="sk-novai-...",
base_url="https://aiapi-pro.com/v1",
temperature=0.3,
)
result = llm.invoke("Write a SQL query that...")
print(result.content)
All three tools accept a custom "OpenAI-compatible" provider. Fill in:
| Field | Value |
|---|---|
| Provider type | OpenAI-compatible |
| API Base URL | https://aiapi-pro.com/v1 |
| API Key | Your NovAI key (sk-novai-...) |
| Model name | claude-opus-4-7 / claude-sonnet-4-6 / claude-haiku-4-5 |
| Feature | Status | Notes |
|---|---|---|
| Chat completions | โ Full | 1:1 with OpenAI schema |
| Streaming (SSE) | โ Full | stream=True works |
| Tool calling | โ Full | OpenAI tools format, auto-translated upstream |
| Vision (image input) | โ Full | PNG / JPEG URL or base64 |
| JSON mode | โ Full | response_format respected |
| 1M context window | โ Opus 4.7 only | Sonnet/Haiku: 200K |
| System prompt | โ Full | Put it as role: system like OpenAI |
# .env
NOVAI_API_KEY=sk-novai-xxxxxxxxxxxxxxxxxx
NOVAI_BASE_URL=https://aiapi-pro.com/v1
# Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("NOVAI_API_KEY"),
base_url=os.getenv("NOVAI_BASE_URL"),
)
Because the only real change is the base URL and the API key, rolling back is trivial. Wrap the client factory:
def make_client():
if os.getenv("USE_NOVAI") == "1":
return OpenAI(api_key=os.getenv("NOVAI_API_KEY"),
base_url="https://aiapi-pro.com/v1")
return OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
# Flip one env var to switch providers per deployment.
Sign up in 30 seconds. Get $1 free credit. Test Opus 4.7, Sonnet 4.6, and Haiku 4.5 with your real workload before you commit.
Get free NovAI credits โ