Getting started

Quickstart

From a new account to a streaming response, using the SDK you already have installed.

1. Create an API key

Sign up, open the dashboard and issue a key. It is shown once, at creation, and only its hash is stored, so copy it before closing the dialog. Name keys per environment so a leaked staging key can be revoked without touching production.

.env
OPENBASE_API_KEY=sk-ob-your-key-here

2. Point your client at Openbase

The official OpenAI clients accept a custom base URL. Nothing else about your code needs to change.

main.py
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.openbase.ai/v1",
    api_key=os.environ["OPENBASE_API_KEY"],
)

response = client.chat.completions.create(
    model="openai/gpt-5.6-luna",
    messages=[
        {"role": "system", "content": "You are concise."},
        {"role": "user", "content": "Why is the sky blue?"},
    ],
)

print(response.choices[0].message.content)

3. Stream the response

Pass stream: true and read chunks as they arrive. The final chunk carries the usage totals for the request.

stream.mjs
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.openbase.ai/v1",
  apiKey: process.env.OPENBASE_API_KEY,
});

const stream = await client.chat.completions.create({
  model: "google/gemini-3.7-flash",
  messages: [{ role: "user", content: "Write a haiku about routing." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

4. Check what it cost

Every response includes a usage object, and the same figures land in your dashboard with the provider that served the request, its latency and the exact charge against your balance.

{
  "usage": {
    "prompt_tokens": 18,
    "completion_tokens": 42,
    "total_tokens": 60,
    "completion_tokens_details": { "reasoning_tokens": 24 }
  },
  "provider": "google"
}

Free credit

New accounts start with a signup credit, so you can complete every step above without adding a card.

Common next steps

  1. Browse the catalog to find the model slug you want.
  2. Set a monthly limit on the key so a runaway loop cannot drain your balance.
  3. Handle rate limits and provider errors using the error reference.