Quickstart

works like the OpenAI API. If your code or tool already uses OpenAI, change the base URL and API key, then pick any model from the model list.

1. Get an API key

Create an account, add credits under Billing, then create a key under API keys in your dashboard. Keys start with sk- and are shown only once.

2. Make a request

curl

curl /chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2-chat-latest",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="", api_key="sk-...")

stream = client.chat.completions.create(
    model="claude-haiku-4-5-20251001",
    messages=[{"role": "user", "content": "Write a haiku about APIs"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")

Node.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "", apiKey: process.env.API_KEY });

const res = await client.chat.completions.create({
  model: "gemini-3-pro-preview",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(res.choices[0].message.content);

Anthropic SDK (Claude models)

Claude models also work through the native Anthropic Messages API. Use the base URL without /v1.

import anthropic

client = anthropic.Anthropic(base_url="", api_key="sk-...")
msg = client.messages.create(
    model="claude-haiku-4-5-20251001",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(msg.content[0].text)

Images

curl /images/generations \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{"model": "gpt-image-2", "prompt": "a lighthouse at dusk, watercolor", "n": 1}'

Video

Video generation runs as a background job. Create it, check its status until it's done, then download the result. You're charged when the job is created, per second of video.

# Create a job
curl /videos -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{"model": "veo-3.1-fast", "prompt": "a drone shot over a misty forest", "seconds": 8, "size": "1280x720"}'

# Check status
curl /videos/VIDEO_ID -H "Authorization: Bearer $API_KEY"

# Download when it's done
curl /videos/VIDEO_ID/content -H "Authorization: Bearer $API_KEY" -o video.mp4

Use with opencode

Opencode only sends screenshots and images to a model if its config says the model accepts them. Our ready-made config sets this correctly for every model, so image input and tool calls just work.

1

Download the config

Save it as ~/.config/opencode/opencode.json. If you already have one, copy the provider block into it.

opencode.json
2

Set your API key

Add this to your shell profile (~/.zshrc or ~/.bashrc), then open a new terminal:

export API_KEY="sk-..."
3

Pick a model

Run opencode, type /models, and choose any model under . Paste or drag screenshots into the chat as usual.

Preview the config
Loading…

Other tools work the same way. In Cursor, Cline, Continue or Roo Code, add an OpenAI-compatible provider with the base URL above and your key, and turn on image or vision support for models that accept images.

Supported endpoints

EndpointUse
GET /v1/modelsList available models
POST /v1/chat/completionsChat with any text model (streaming supported)
POST /v1/responsesOpenAI Responses API
POST /v1/messagesAnthropic Messages API
POST /v1/embeddingsEmbeddings
POST /v1/images/generationsImage generation
POST /v1/videosVideo generation jobs

Errors

StatusMeaning
401Missing or invalid API key
402Out of credits, or the key hit its spending limit
404Unknown model; check /v1/models
429Model is busy; retry with backoff
502The model provider failed; retry

Billing

You prepay credits in USD. Each request is charged by the tokens it uses, or per image or per second of video, at the prices on the models page. Failed requests are free. Your dashboard shows the cost of every request.