Skip to content
TokenCenter Get API key

Docs › Quickstart

Quickstart

Key, credit, first call: about five minutes from start to finish.

  1. Get an API key

    Open Get API key and create a key. No email or card needed. Your key starts with ck_ and is shown only once, so save it in a password manager straight away. We only keep a fingerprint of it and can’t show it again.

    Store it in an environment variable so it stays out of your code:

    Shell
    export TOKENCENTER_API_KEY="ck_your_key_here"
  2. Add credit

    New keys start with a $0 balance, and model calls need credit. On Pricing, pick a pack while you’re signed in with your key: Mini ($5), Maker ($19) or Studio ($59). Checkout runs on Stripe’s hosted page, and the credit is added to your balance once Stripe confirms the payment.

  3. Make your first call

    Use any OpenAI-compatible client. The example uses Ministral 3B, one of the cheapest models in the catalog at $0.10 per million input and output tokens, so this call costs a tiny fraction of a cent.

    curl
    curl https://api.tokenctr.com/v1/chat/completions \
      -H "Authorization: Bearer $TOKENCENTER_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "mistralai/ministral-3b-2512",
        "messages": [{"role": "user", "content": "Say hello in five words."}],
        "max_tokens": 100
      }'
    Python
    # pip install openai
    import os
    from openai import OpenAI
    
    client = OpenAI(
        base_url="https://api.tokenctr.com/v1",
        api_key=os.environ["TOKENCENTER_API_KEY"],
    )
    
    resp = client.chat.completions.create(
        model="mistralai/ministral-3b-2512",
        messages=[{"role": "user", "content": "Say hello in five words."}],
        max_tokens=100,
    )
    print(resp.choices[0].message.content)
    print(resp.usage)
    JavaScript
    // npm install openai   (Node 18+, ES modules)
    import OpenAI from "openai";
    
    const client = new OpenAI({
      baseURL: "https://api.tokenctr.com/v1",
      apiKey: process.env.TOKENCENTER_API_KEY,
    });
    
    const resp = await client.chat.completions.create({
      model: "mistralai/ministral-3b-2512",
      messages: [{ role: "user", content: "Say hello in five words." }],
      max_tokens: 100,
    });
    console.log(resp.choices[0].message.content);
    console.log(resp.usage);
    Streaming isn’t available yet

    Send requests without stream, or with "stream": false. With "stream": true the API answers with an error event instead of a reply. If your tool streams by default, switch streaming off in its settings.

  4. Check your balance

    Every successful call returns your remaining balance in the x-cosmos-credit-balance response header. You can also ask for it directly:

    curl
    curl https://api.tokenctr.com/v1/usage/today \
      -H "Authorization: Bearer $TOKENCENTER_API_KEY"

    credits_face_usd is your balance in US dollars, and rollup lists today’s calls, tokens and cost by model. The Account page shows the same numbers.

Next steps

  • Browse the model catalog and copy any model ID, such as anthropic/claude-haiku-4.5 or mistralai/ministral-3b-2512.
  • Read the API reference for request fields, response headers and account endpoints.
  • Set max_tokens on every request. It keeps the temporary hold on your balance small; see how holds work.
  • Coming from OpenRouter? See Migrate from OpenRouter.