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.
| SDK | Base URL | Why |
|---|---|---|
| OpenAI | https://api.oneapi.id/v1 | The SDK appends /chat/completions or /responses. |
| Anthropic | https://api.oneapi.id | The SDK appends /v1/messages itself. |
OpenAI SDK
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.oneapi.id/v1",
api_key=os.environ["ONEAPI_API_KEY"],
)Node.js
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.
export OPENAI_BASE_URL="https://api.oneapi.id/v1"
export OPENAI_API_KEY="$ONEAPI_API_KEY"Anthropic SDK
Python
import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.oneapi.id",
api_key=os.environ["ONEAPI_API_KEY"],
)Node.js
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.
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.