Drop-in API

Stevai speaks the standard chat‑completions format used by common AI client libraries. If your app already talks to another provider, switch it to Stevai by changing two things — the base URL and the key. No rewrite.

This is a format compatibility only. Nothing is forwarded to any other provider, and you are never billed by anyone but Stevai — every answer is produced by the Stevai network. The response always reports the Stevai model that actually ran.

Easiest of all: use our own SDK@stevai-ai/sdk (JavaScript) or pip install stevai (Python). See the SDKs page. The raw HTTP below is for any other language or a custom client.

Base URL

Point your client's base URL here and send your Stevai key as the API key:

base url
https://stevai.com/api/v1

Already using a standard AI client library? Set its base URL to the address above and its API key to your sk_live_…key — that's the whole change.

Chat completions

The primary endpoint. Same request and response shape you already use.

endpoint
POST https://stevai.com/api/v1/chat/completions

Request

messagesarrayrequired

A list of { role, content } objects. Roles: system, user, assistant. content may be a string or an array of text parts.

modelstringoptional

Optional. Unknown or foreign names map to stevai-default, so migrating code runs unedited. The response reports the model that truly ran.

streambooleanoptional

Optional. When true, the reply streams as server‑sent chat.completion.chunk events, ending with data: [DONE].

stream_optionsobjectoptional

Optional. { "include_usage": true } appends a final usage chunk to the stream.

regionstringoptional

Stevai extension. Pins the region (e.g. eu-west). Also settable via the x-stevai-region header. Defaults to global.

Standard sampling fields (temperature, max_tokens, top_p, and others) are accepted so existing payloads never error, even where the engine doesn't use them yet.

curl

curl
curl -X POST https://stevai.com/api/v1/chat/completions \
  -H "Authorization: Bearer sk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "stevai-default",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user", "content": "Say hello in five words."}
    ]
  }'

Response

json
{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "created": 1721520000,
  "model": "stevai-default",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Hello, good to meet you." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 18, "completion_tokens": 6, "total_tokens": 24 }
}

Streaming

Set stream: true and read server‑sent events until [DONE].

node.js
const res = await fetch("https://stevai.com/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.STEVAI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    messages: [{ role: "user", content: "Write a haiku about the sea." }],
    stream: true,
  }),
});

const reader = res.body.getReader();
const decoder = new TextDecoder();
for (;;) {
  const { value, done } = await reader.read();
  if (done) break;
  for (const line of decoder.decode(value).split("\n")) {
    if (!line.startsWith("data: ")) continue;
    const payload = line.slice(6);
    if (payload === "[DONE]") continue;
    const chunk = JSON.parse(payload);
    process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
  }
}

Models

List the models Stevai serves — only real Stevai models are ever returned.

endpoint
GET https://stevai.com/api/v1/models
json
{
  "object": "list",
  "data": [
    { "id": "stevai-default", "object": "model", "created": 1700000000, "owned_by": "stevai" }
  ]
}

Not yet available

  • POST /api/v1/embeddings is reserved. Until the network serves a real embeddings model it returns a typed 501 — Stevai never returns fabricated vectors.

Choosing an endpoint

  • Drop‑in (/api/v1/chat/completions) — use this to move an existing app or reuse a standard client library.
  • Simple (/api/v1/chat) — a smaller one‑prompt/one‑answer shape with the full Stevai cost breakdown attached. See the Chat API page.