Getting started
Quickstart
Make your first request in under a minute. The API is OpenAI-compatible, so if your code already talks to OpenAI you change two lines.
curl https://api.dawnstackai.com/v1/chat/completions \
-H "Authorization: Bearer $DAWNSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "llama-3.1-8b",
"messages": [{"role": "user", "content": "What is the capital of Kenya? One sentence."}]
}'from openai import OpenAI
client = OpenAI(
api_key=os.environ["DAWNSTACK_API_KEY"],
base_url="https://api.dawnstackai.com/v1",
)
response = client.chat.completions.create(
model="llama-3.1-8b",
messages=[{"role": "user", "content": "What is the capital of Kenya? One sentence."}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.DAWNSTACK_API_KEY,
baseURL: "https://api.dawnstackai.com/v1",
});
const response = await client.chat.completions.create({
model: "llama-3.1-8b",
messages: [{ role: "user", content: "What is the capital of Kenya? One sentence." }],
});
console.log(response.choices[0].message.content);And the response:
{
"id": "chatcmpl-8f2a1c",
"object": "chat.completion",
"created": 1785097284,
"model": "llama-3.1-8b",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "The capital of Kenya is Nairobi." },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 21, "completion_tokens": 8, "total_tokens": 29 },
"dawnstack": { "cost_micros": 6, "cost_usd": 0.000006, "request_id": "req_8f2a1c" }
}
What you need
Three things, in order.
- An account. Sign in with Google or a magic link. No card.
- A balance. A new account starts at zero, so requests are declined until you top up or redeem a code. Top up from $1.00 in your own currency on the balance page.
- An API key. Create one in the dashboard. It is shown once and stored only as a hash, so if you lose it, revoke it and make another.
Migrating from OpenAI
Two lines: the base URL and the key. Everything else in your code stays as it is, including the
openai SDK itself, the request shape, the response shape, streaming, and tool calling.
client = OpenAI(
- api_key=os.environ["OPENAI_API_KEY"],
+ api_key=os.environ["DAWNSTACK_API_KEY"],
+ base_url="https://api.dawnstackai.com/v1",
)
The one thing you do have to change is the model id. See Models for the catalogue, or read the migration guide for the full list of differences.
What it costs
Nothing until you make a request, and then only what the model actually generated. The response above cost $0.000006.
Prices are per million tokens and published in full on the pricing page and at
GET /v1/models, which needs no API key. A price list you have to authenticate to read is not a
price list.