OneProvider
Clients and SDKs

Node / TypeScript SDK

Use @anthropic-ai/sdk or the openai npm package with OneProvider by overriding baseURL. TypeScript, async-iterator streaming and edge runtimes.

@anthropic-ai/sdk is the recommended client. OpenAI's official package also works with a baseURL override.

All models, capabilities, and prices Documentation index for AI agents: https://oneprovider.dev/docs/llms.txt Operating system Before you start: a key from your cabinet Open your cabinet: the Telegram bot @oneprovider_robot (Account) or app.oneprovider.dev . Press “Issue a key”, give it a name (for example, this client) and a spend limit, and copy the key. You top up the balance in the same place. More about the cabinet and keys .

Install

bash
npm i @anthropic-ai/sdk
# or
npm i openai
# pnpm / yarn / bun all work too:
# pnpm add @anthropic-ai/sdk
# bun add @anthropic-ai/sdk

TypeScript

ts
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.ONEPROVIDER_KEY!,
baseURL: "https://api.oneprovider.dev",
});
const msg = await client.messages.create({
model: "claude-sonnet-5-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Say hi." }],
});
// New models may put a thinking block first: print the text blocks.
for (const block of msg.content) {
if (block.type === "text") console.log(block.text);
}

OpenAI-compatible

ts
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ONEPROVIDER_KEY!,
baseURL: "https://api.oneprovider.dev/v1",
});
const resp = await client.chat.completions.create({
model: "claude-sonnet-5-5",
messages: [{ role: "user", content: "Say hi." }],
});
console.log(resp.choices[0].message.content);

Streaming via async iterator

ts
const stream = client.messages.stream({
model: "claude-sonnet-5-5",
max_tokens: 1024,
messages: [{ role: "user", content: "stream me a poem" }],
});
for await (const event of stream) {
if (event.type === "content_block_delta" && event.delta.type === "text_delta") {
process.stdout.write(event.delta.text);
}
}

Edge runtimes

Works in Vercel Edge and Cloudflare Workers out of the box. The SDK uses the native fetch available in both runtimes.

ts
// Cloudflare Worker
import Anthropic from "@anthropic-ai/sdk";
export default {
async fetch(req: Request, env: Env) {
const client = new Anthropic({ apiKey: env.ONEPROVIDER_KEY, baseURL: "https://api.oneprovider.dev" });
const msg = await client.messages.create({
model: "claude-haiku-5-5",
max_tokens: 256,
messages: [{ role: "user", content: "ping" }],
});
return Response.json(msg);
},
};
Never ship the key to the browser Even in a Worker, route requests through your own backend if user data is involved — the OneProvider key authorizes spend, not just access.

Which model to choose

Pass the id in model. claude-sonnet-5-5 is the default for most code, claude-haiku-5-5 for fast, high-volume calls and claude-opus-5-5 for hard reasoning. With the openai package you can also use GPT ids such as gpt-6.1-terra. The Anthropic SDK takes baseURL: "https://api.oneprovider.dev", the OpenAI SDK takes baseURL: "https://api.oneprovider.dev/v1". Ids are on the models page .

Common errors and fixes

404 NotFoundError

Anthropic SDK: baseURL: "https://api.oneprovider.dev" with no /v1. OpenAI SDK: baseURL: "https://api.oneprovider.dev/v1" with /v1.

401 AuthenticationError

process.env.ONEPROVIDER_KEY is undefined in this process, for example a missing .env load. Log its length, never its value.

429 RateLimitError

“Insufficient balance” means top up the cabinet (do not retry). Any other 429 is a rate limit: back off and respect Retry-After.

Fetch failed or timeout

Disable VPN or proxy settings; use stream for long answers because a non-streaming request must start within 6 minutes.

400 about max_tokens

The Anthropic SDK requires max_tokens in every request.

FAQ

Does it run on edge runtimes?

Yes, Vercel Edge and Cloudflare Workers work because the SDK uses fetch.

Is it safe to call from the browser?

No. The key authorizes spend; call from your backend.

Can I keep the official SDKs?

Yes, only the key and baseURL change, see migrate from Anthropic .

Quick answers

Which base URL do I use?

Claude Code and Anthropic SDKs use https://api.oneprovider.dev. OpenAI SDKs and OpenAI-compatible clients use https://api.oneprovider.dev/v1. One key works behind both; the model list is on the models page ; rates are on the pricing page .

How do I authenticate?

Send the raw sk-… key in x-api-key or Authorization: Bearer: one of them, never both. Keep the key in an environment variable, not in a file that gets committed. More on authentication .

Where do I get a key?

Open your cabinet in the Telegram bot @oneprovider_robot or at app.oneprovider.dev, top up the balance and press “Issue a key”. Each key can carry its own spend limit. Cabinet & API keys .

What do 401, 404 and 429 mean?

401: the key is missing, mistyped or sent in the wrong header; paste the whole key without quotes or spaces. 404: usually a wrong base URL, for example a missing or doubled /v1. 429 with “Insufficient balance”: the cabinet balance or the key’s spend limit is used up, so top up instead of retrying; any other 429 is a rate limit, so wait for Retry-After. Details: error codes and troubleshooting .

Why do streams cut off or reset?

VPN and VLESS proxies often buffer SSE or break HTTP/2 negotiation. OneProvider has no regional restrictions and does not buffer streams, so turn the proxy off and retry.

Where do I ask if this is not enough?

Message @Oneproviderhelpbot on Telegram or open “Support” in the web cabinet, with the HTTP status code and the exact error message. How support works .

Last updated: 2026-11-28 Found a bug? @Oneproviderhelpbot