Two things called a token
Here is api tokens explained in two sentences. An API token, which most dashboards also call an API key, is a secret string that proves a request comes from your account. A text token, the thing LLMs count, is a small chunk of text that the model reads or writes, and it is what you are billed for.
The confusion is natural because both words appear in the same documentation. A short table keeps them apart.
| API token (key) | Text token | |
|---|---|---|
| What it is | A secret credential | A piece of text, often a short word or part of one |
| Where it goes | In the Authorization: Bearer header | Counted inside prompts and completions |
| Who sees it | Only you and your server | Reported to you in the response usage field |
| Cost | Free to hold, costly if leaked | $0.15 per 1M input, $0.50 per 1M output |
The rest of this page covers both: how to get and protect the key, and how to read what the text tokens cost you.
Getting a key
You can have a working key in a couple of minutes. The steps:
- Sign up with Google, or with an email address and password.
- Open the API key page. Your key is shown there.
- Claim the trial credit with one click. It is $0.50, valid for 7 days, one per person, and needs no payment details.
- Send a test request, as shown below.
- When you are ready, top up with any whole amount from $20 to $500 in crypto (USDT on TRC20 or USDC on Base).
The key page is at the API key page. Larger top-ups add a bonus: +5% from $50, +10% from $100 and +15% from $200, and credit never expires. Current tiers are on the pricing page.
Using the key in a request
Every call carries the key in an Authorization header. The API follows the OpenAI conventions, so any OpenAI SDK handles the header for you once you set the base URL and key. With curl you write it out:
export API_KEY="paste-your-key-here"
curl https://api.ltxnsfw.cc/v1/chat/completions -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a two-line poem about rain."}]
}'
The same call from Python, reading the key from the environment instead of typing it into the file:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.ltxnsfw.cc/v1",
api_key=os.environ["API_KEY"],
)
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Write a two-line poem about rain."}],
)
print(resp.choices[0].message.content)
You can list what the endpoint serves with GET /v1/models. If your key is wrong or missing, the API returns an authentication error instead of a completion. Check that the header reads Bearer, followed by a space, followed by the key with no quotes or line breaks.
Keeping the key safe
The key is a bearer credential: anyone who has the string can make requests that spend your prepaid balance. Treat it like a password.
- Use environment variables. Load the key from the process environment or a secrets manager. Do not paste it into source files.
- Keep it out of git. Add your
.envfile to.gitignorebefore the first commit. A key pushed to a public repository should be considered exposed, even if you delete it later. - Call from a server. A key embedded in a web page or mobile app can be read by anyone who opens developer tools. Put your own backend in the middle and let it hold the key.
- Do not paste it into chat, tickets or screenshots. If you need help, send the
X-Request-Idvalue from a response instead. The support page shows how to reach us.
If you believe a key has leaked, assume it is compromised, watch your balance, and contact support right away. Your balance is visible in the X-Balance-USD header on every response, which makes it easy to spot spending you did not make.
Reading text tokens from a response
Each successful response includes a usage object with the number of prompt tokens and completion tokens. With streaming (stream: true) the usage arrives at the end. Multiply those counts by the rates and you have the cost of the call.
A quick example: a response reports 800 prompt tokens and 200 completion tokens. Input is 800 divided by 1,000,000, times $0.15, which is $0.00012. Output is 200 divided by 1,000,000, times $0.50, which is $0.0001. The call cost $0.00022. A $20 top-up would pay for about 90,000 calls like that one.
Two things trip people up. First, the prompt includes everything you send: the system message, the earlier turns of the conversation and the new message. A long chat grows the input count on each turn. Second, the context window is 100,000 tokens for prompt plus completion, so very long histories need trimming or summarizing at some point. The max_tokens setting is optional; leave it out and the completion may use whatever room remains.
Limits that apply to a key
Limits belong to the key, and they differ between the trial and a full key.
| Key | Concurrent requests | Requests per minute |
|---|---|---|
| Trial | 2 | 60 |
| Full | 8 | 300 |
The request body can be up to 8 MB. Responses include X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency so your code can read the ceiling it is working under.
When you go over, the API answers with HTTP 429. The error code rate_limited means too many requests per minute. The code concurrency means too many requests at once. A streamed request holds its concurrency slot until the stream ends, so a stalled stream that you never close will block a slot. On temporary overload you also get a 429, with a Retry-After: 5 header. The sensible reaction is to wait for the stated time, then retry. Failed or refused requests are not charged.
Habits that save trouble later
A few small practices keep key handling boring, which is what you want.
Log the request ID, never the key. Each response has an X-Request-Id header. Store it with your own record of the call, so a support question can point at one exact request. Check your balance from time to time with a tiny request, then read the header:
curl -s -D - -o /dev/null https://api.ltxnsfw.cc/v1/chat/completions -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{"model":"uncensored","max_tokens":1,"messages":[{"role":"user","content":"hi"}]}' | grep -i "x-balance-usd"
The most common setup mistakes are small ones:
- A trailing newline or space copied along with the key.
- Quotation marks inside an environment variable on one platform but not another.
- A base URL without the
/v1suffix, or with an extra slash path. - Using the trial key for a batch job. It allows 2 concurrent requests, and the trial credit is valid for 7 days.
- Putting the key into a front end that runs in the visitor's browser.
Last, keep a note of what each integration does with the key, so you know where to look if the balance ever moves unexpectedly. It takes a few minutes and spares you an hour of searching later.
Where to go next
A sensible first week looks like this. On day one, claim the trial credit and send a handful of requests to see the responses and the usage numbers. Over the next few days, wire the key into your server through an environment variable and run your real prompts, reading the balance header as you go. Before the 7 days of the trial run out, decide whether the cost per job suits you. If it does, top up with the smallest amount that gets you through the month, remembering that credit never expires and larger amounts add a bonus. Nothing here asks for a subscription, so you are never charged for a month you did not use.
If you are building something, the documentation lists the request parameters, tool calling and JSON mode. If you only want to see it work, claim the trial credit and run the curl command above. Prompts sent through the API are not used for training. The service is text only, and it carries one hard rule: no sexual content involving minors.
