Apps and SDKs
SDKs and frameworks
Use the official OpenAI and Anthropic SDKs, LangChain, the Vercel AI SDK and LiteLLM with the gateway. The base URL and key settings for each, with working code.
On this page
Any library that lets you set a base URL for the OpenAI or Anthropic API works with the gateway. You change two settings: the base URL and the API key. Everything else (request shapes, streaming, tools, errors) stays as the library documents it.
OpenAI SDKs https://api.oneaiapikey.com/v1
Anthropic SDKs https://api.oneaiapikey.com
OpenAI SDK
Works with every model, in the chat completions format. The SDK also reads OPENAI_BASE_URL and OPENAI_API_KEY from the environment if you prefer not to pass them in code.
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.oneaiapikey.com/v1", api_key=os.environ["RELAYKIT_API_KEY"])
reply = client.chat.completions.create(
model="claude-haiku-4-5",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(reply.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.oneaiapikey.com/v1", apiKey: process.env.RELAYKIT_API_KEY });
const reply = await client.chat.completions.create({
model: "claude-haiku-4-5",
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(reply.choices[0].message.content);Anthropic SDK
For Claude models in Anthropic’s own format, with prompt caching, extended thinking and every Messages feature. It also reads ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY.
# pip install anthropic
import os
import anthropic
client = anthropic.Anthropic(base_url="https://api.oneaiapikey.com", api_key=os.environ["RELAYKIT_API_KEY"])
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=512,
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(message.content[0].text)// npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ baseURL: "https://api.oneaiapikey.com", apiKey: process.env.RELAYKIT_API_KEY });
const message = await client.messages.create({
model: "claude-sonnet-5-5",
max_tokens: 512,
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(message.content[0].text);LangChain
ChatOpenAI works with every model; ChatAnthropic with Claude models. Leave use_responses_api off on ChatOpenAI unless the model is a GPT model, because the Responses API is fully supported only there.
# pip install langchain-openai langchain-anthropic
import os
from langchain_openai import ChatOpenAI
from langchain_anthropic import ChatAnthropic
llm = ChatOpenAI(
model="gpt-5.6-terra",
base_url="https://api.oneaiapikey.com/v1",
api_key=os.environ["RELAYKIT_API_KEY"],
)
print(llm.invoke("Say hello in five words.").content)
claude = ChatAnthropic(
model="claude-sonnet-5-5",
base_url="https://api.oneaiapikey.com", # no /v1
api_key=os.environ["RELAYKIT_API_KEY"],
)// npm install @langchain/openai
import { ChatOpenAI } from "@langchain/openai";
const llm = new ChatOpenAI({
model: "gpt-5.6-terra",
apiKey: process.env.RELAYKIT_API_KEY,
configuration: { baseURL: "https://api.oneaiapikey.com/v1" },
});
const reply = await llm.invoke("Say hello in five words.");
console.log(reply.content);Vercel AI SDK
Use the OpenAI-compatible provider for any model. The plain @ai-sdk/openai provider also works, but openai("id") calls the Responses API; use openai.chat("id") to send chat completions instead.
// npm install ai @ai-sdk/openai-compatible @ai-sdk/anthropic
import { generateText, streamText } from "ai";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { createAnthropic } from "@ai-sdk/anthropic";
// Any model, OpenAI format (chat completions)
const gateway = createOpenAICompatible({
name: "gateway",
baseURL: "https://api.oneaiapikey.com/v1",
apiKey: process.env.RELAYKIT_API_KEY,
includeUsage: true, // token counts on streamed responses
});
const { text } = await generateText({
model: gateway("claude-haiku-4-5"),
prompt: "Say hello in five words.",
});
// Claude models, Anthropic format. This provider expects /v1 in the base URL.
const anthropic = createAnthropic({
baseURL: "https://api.oneaiapikey.com/v1",
apiKey: process.env.RELAYKIT_API_KEY,
});
const result = streamText({ model: anthropic("claude-sonnet-5-5"), prompt: "Write a haiku about latency." });
for await (const chunk of result.textStream) process.stdout.write(chunk);LiteLLM
Prefix the model id with openai/ and set api_base to the OpenAI base URL.
# pip install litellm
import os
from litellm import completion
reply = completion(
model="openai/claude-haiku-4-5", # "openai/" tells LiteLLM to use the OpenAI format
api_base="https://api.oneaiapikey.com/v1",
api_key=os.environ["RELAYKIT_API_KEY"],
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(reply.choices[0].message.content)The same settings work in the LiteLLM proxy:
# config.yaml for the LiteLLM proxy
model_list:
- model_name: claude-haiku-4-5
litellm_params:
model: openai/claude-haiku-4-5
api_base: https://api.oneaiapikey.com/v1
api_key: os.environ/RELAYKIT_API_KEYOther languages
Libraries for Go, Java, .NET, Ruby, Rust and PHP that target the OpenAI API usually have a base URL or endpoint option. Set it to the OpenAI base URL above and pass your key as the API key. With plain HTTP, send Authorization: Bearer <key> to POST https://api.oneaiapikey.com/v1/chat/completions; the API reference lists every endpoint.
Chat apps and coding tools
- Chat apps: Open WebUI, LibreChat, LobeChat, SillyTavern, Chatbox.
- Coding agents and editors: see the coding tools overview.