Skip to content
OneAPIDocs
ModelsOpen console

Guides

Official SDKs

There is no OneAPI SDK to install. The official OpenAI and Anthropic SDKs work once they point at the gateway, and the only thing that differs between them is where the base URL stops.

SDKBase URLWhy
OpenAIhttps://api.oneapi.id/v1The SDK appends /chat/completions or /responses.
Anthropichttps://api.oneapi.idThe SDK appends /v1/messages itself.

OpenAI SDK

Python

pip install openai
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.oneapi.id/v1",
    api_key=os.environ["ONEAPI_API_KEY"],
)

Node.js

npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.oneapi.id/v1",
  apiKey: process.env.ONEAPI_API_KEY,
});

Both SDKs also read OPENAI_BASE_URL and OPENAI_API_KEY from the environment, which is the quickest way to point an existing app at the gateway without editing code.

environment
export OPENAI_BASE_URL="https://api.oneapi.id/v1"
export OPENAI_API_KEY="$ONEAPI_API_KEY"

Anthropic SDK

Python

pip install anthropic
import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.oneapi.id",
    api_key=os.environ["ONEAPI_API_KEY"],
)

Node.js

npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.oneapi.id",
  apiKey: process.env.ONEAPI_API_KEY,
});

The Anthropic SDKs read ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY the same way.

environment
export ANTHROPIC_BASE_URL="https://api.oneapi.id"
export ANTHROPIC_API_KEY="$ONEAPI_API_KEY"

Other tools

Any tool with a setting for an OpenAI-compatible or Anthropic base URL can use the gateway: enter the base URL from the table above, your sk-oneapi- key, and a model ID from Models. Tools that fill their model list from GET /v1/models will show every ID the gateway routes.