OpenAI SDK
The official OpenAI libraries work unchanged. Set the base URL to https://api.cloakray.com/v1 and use an Cloakray key; every text model, including Claude and Gemini, then answers on chat.completions and responses.
JavaScript and TypeScript
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.cloakray.com/v1",
apiKey: process.env.CLOAKRAY_API_KEY,
});
const completion = await client.chat.completions.create({
model: "claude-sonnet-4-6",
messages: [{ role: "user", content: "Hello" }],
});
Python
pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.cloakray.com/v1", api_key=os.environ["CLOAKRAY_API_KEY"])
completion = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Hello"}],
)
The async client, AsyncOpenAI, takes the same arguments.
Without changing code
The OpenAI SDKs read their base URL and key from the environment. An app that constructs new OpenAI() with no arguments can be pointed at Cloakray from outside:
export OPENAI_BASE_URL="https://api.cloakray.com/v1"
export OPENAI_API_KEY="ckr_..."
Then change the model names the app uses to Cloakray model IDs.
What works
| SDK method | Cloakray endpoint |
|---|---|
chat.completions.create, .parse, .stream | Chat Completions |
responses.create, .retrieve, .parse | Responses |
embeddings.create | Embeddings |
images.generate, images.edit | Image generation, editing |
audio.speech.create, audio.transcriptions.create | Speech, transcription |
videos.create, .retrieve, .downloadContent | Video generation |
moderations.create | Moderation |
models.list | Models |
Not offered: the legacy completions endpoint, models.retrieve for a single model, files, fine-tuning, batches, assistants, vector stores, and realtime. A method the SDK has but Cloakray doesn't answers 404 or 405.
Other languages
The official Go, Java, .NET and Ruby libraries, and community ones, take a base URL option too — option.WithBaseURL in Go, baseUrl in Java, Endpoint in .NET. Use https://api.cloakray.com/v1.