fa ▾
Create key

Uncensored API. Real Tokens. Zero Refusals.

Claude token cost: API documentation

Stop overpaying for token-heavy coding sessions. This guide shows how to swap into our uncensored API with zero client code changes.

Prerequisites: SDK installation

Install your preferred language SDK to start making requests immediately. The base URL for this API is https://api.claudetokencost.com/v1. You need an API key from the dashboard to authenticate. No other setup is required for basic text generation.

Authentication with your API key

Pass your key in the Authorization header of every request. Use the format Bearer YOUR_API_KEY to verify your identity. The system rejects requests without valid credentials. Your key identifies your prepaid credit account.

Sending requests to /v1/chat/completions

Send a JSON payload to the chat completions endpoint. Specify the model ID as uncensored for uncensored completions. The API accepts standard parameters like messages and max_tokens. Input text is processed and returned as text output.

Configuring model parameters

Adjust parameters like temperature and top_p to control randomness. Use response_format set to {"type": "json_object"} for structured data. The context window supports up to 100,000 tokens total. Output is limited to 16,000 tokens per request.

Handling streaming responses (SSE)

Enable streaming by setting the stream flag to true. The server sends Server-Sent Events (SSE) for real-time token delivery. Parse the final chunk to retrieve total token usage for billing. This approach reduces perceived latency for large responses.

Understanding token usage in responses

Check the usage field in the response JSON for exact counts. Input and output tokens are billed separately at $0.15 and $0.50 per million tokens. Errors do not consume credit if they occur before processing. Refusals for valid content are free.

cURL

curl https://api.claudetokencost.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "fix the python syntax error in the provided snippet"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.claudetokencost.com/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.claudetokencost.com/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Streaming

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Common questions

What happens if I exceed my rate limits?

You receive a 429 Too Many Requests error. The limit is 300 requests per minute per key. Wait briefly before retrying to avoid wasting tokens on failed requests.

Why do I get a 401 error?

Your API key is invalid or missing. Ensure you copy the key exactly from your dashboard. Regenerate the key if it was compromised or lost.

How is billing calculated?

You pay only for real token usage from your prepaid credit. Input tokens cost <code>$0.15</code> per million. Output tokens cost <code>$0.50</code> per million. Credit never expires.

Your API key is one step away

Sign up, grab your key, and update your base URL. That’s it.

Create key