fastokens

Quickstart

Make your first request to the Fastokens API in under five minutes.

Fastokens serves open-weight LLMs behind one OpenAI-compatible API. Code written for the OpenAI SDK works after you change the base URL and the API key.

This quickstart uses Kimi K3.1 Pro, the model on our public, pay-per-token endpoint. Other models run on dedicated capacity and answer on the same API once your capacity is provisioned.

1. Get an API key

During the pilot, workspaces are provisioned by our team. Contact us for access. Once you have a console session, create a key under API Keys.

Keys look like si_… and are shown exactly once at creation. Store the value immediately; afterwards only the prefix and last four characters are visible.

Two kinds of tokens

Session tokens (sis_…) operate the console: keys, reports, billing. API keys (si_…) call models. They are not interchangeable.

2. Call a model

Every model answers on the same endpoint:

curl https://api.fastokens.ai/v1/chat/completions \
  -H "Authorization: Bearer $FASTOKENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k3.1-pro",
    "messages": [
      {"role": "user", "content": "Return only ok."}
    ],
    "max_completion_tokens": 8
  }'

Or keep your existing SDK and change the base URL:

from openai import OpenAI

client = OpenAI(
    api_key="…",  # your si_ key
    base_url="https://api.fastokens.ai/v1",
)

completion = client.chat.completions.create(
    model="moonshotai/kimi-k3.1-pro",
    messages=[{"role": "user", "content": "Say hello from Fastokens."}],
    max_completion_tokens=256,
)
print(completion.choices[0].message.content)
import OpenAI from "openai"

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

Two things to know today:

  • Streaming is supported. Send "stream": true and tokens arrive as server-sent events in the OpenAI chat-completions chunk format.
  • Cap output with max_completion_tokens, not max_tokens.

3. List your models

GET /v1/models returns the models configured for your workspace. Treat it as the source of truth instead of hardcoding availability:

curl https://api.fastokens.ai/v1/models \
  -H "Authorization: Bearer $FASTOKENS_API_KEY"

4. Read the response

Responses are OpenAI-shaped, exactly as the model returned them, plus one addition: an X-Request-Id response header. Log it. It lets us (and you, in the console) trace any request and its exact charge.

Next steps

  • Authentication: token types and key lifecycle
  • Models: ids, context windows, pricing
  • Errors: the error envelope and every status you can receive
  • Limits & billing: spend caps, rate limits, and how metering works

On this page