Tokenify

Quickstart

Two minutes from here to your first completion. If you already call OpenAI or Anthropic, one line changes.

1. Get a key

Create an account and one is issued during setup. Keys are shown once, so put it straight into your environment:

export TOKENIFY_API_KEY="tk-live-..."
Never commit a key. A key is a bearer credential: anyone holding it can spend your balance. Keep it in the environment, and give each service its own key so one can be revoked without touching the others.

2. Add some credit

Requests are billed per token against prepaid credit, and a request with no credit behind it is refused with a 402. New accounts get a small amount to try the API with; after that, top up by card or stablecoin. Credit does not expire.

3. Make a request

The base URL is https://api.tokenify.dev/v1 and the key goes in an Authorization: Bearer header. Nothing else about your code changes.

import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TOKENIFY_API_KEY"],
    base_url="https://api.tokenify.dev/v1",   # the only line that changes
)

response = client.chat.completions.create(
    model="deepseek/deepseek-v4-flash",
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=256,
    extra_body={"reasoning": {"enabled": False}},
)
print(response.choices[0].message.content)
Every sample sets max_tokens. Credit is reserved before the request against the worst case it could cost, and without max_tokens that worst case is the model’s entire output ceiling — hundreds of thousands of tokens, which is more than a new account’s trial credit and so a 402 for a request that would have cost a fraction of a cent. The reservation is a floor on your balance, not a charge: the unused part is refunded the moment the request finishes.

4. Read the response

It is the shape your SDK already expects, with two additions worth knowing about. Cached prompt tokens are reported separately, because they are billed at a fraction of fresh ones, and two headers come back: the canonical model id we resolved your request to, and a request id.

{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "deepseek/deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hello! How can I help?" },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 8,
"total_tokens": 17,
"prompt_tokens_details": { "cached_tokens": 0 },
"completion_tokens_details": { "reasoning_tokens": 0 }
}
}
x-tokenify-model: deepseek/deepseek-v4-flash
x-tokenify-request-id: req_aba350ea35840912b70756be

Quote x-tokenify-request-id in a support conversation and we can find the exact request, including what it cost and how it was served. The same id is on the response body as id, prefixed chatcmpl-, so one string covers your logs and ours.

What to read next

  • Streaming — tokens as they are generated, and where the usage figures arrive.
  • Prompt caching — how a long system prompt gets much cheaper on the second turn.
  • Models and pricing — what each one costs and what it can do.

Last updated 2026-09-28.