Understanding token counting in uncensored models
The first sentence of every section answers the question in its heading. Token counting is the fundamental unit of billing for any LLM proxy. You pay for every token sent in the prompt and every token generated in the response. This includes system instructions, conversation history, and formatting characters.
Many developers assume that only the visible text counts. This is incorrect. Every space, newline, and JSON bracket consumes tokens. When you use an uncensored model, the context window fills faster because these models often require more verbose reasoning to maintain coherence without safety filters.
Our API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens. This rate applies to real token usage. Errors do not charge you. Refusals are free. This structure ensures you only pay for actual computation.
curl https://api.claudeapiproxy.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "get the current server time in ISO format"}]
}'- Count every character in your system prompt.
- Include conversation history in your input count.
- Account for JSON formatting overhead.
- Verify token counts before sending large payloads.
The context window trap: 100k input vs 16k output
Our API provides a 100,000 token context window, but you can only generate 16,000 tokens per request. This asymmetry creates a billing trap for users who assume infinite output.
If your prompt consumes 90,000 tokens, you have only 10,000 tokens remaining for output. If you request a maximum of 16,000 tokens, the model will stop early. You still pay for the tokens actually generated. This is not a bug. It is a feature of large context windows.
Many users waste credit by setting max_tokens too high. If the model runs out of context, it stops naturally. You pay for what it produces. You do not pay for what it could not produce.
from openai import OpenAI
client = OpenAI(base_url="https://api.claudeapiproxy.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)Always monitor your remaining context. Use the /v1/models endpoint to verify current limits. Adjust your prompt length to leave room for output. This prevents unexpected charges from truncated responses.
Streaming responses and final chunk billing
Streaming does not change the total cost. You pay for the same tokens whether you receive them instantly or all at once. The difference is in how you track usage.
When you stream, you receive multiple chunks. Each chunk contains a portion of the response. The final chunk contains the token usage summary. This is where you verify the exact token count.
Some proxies charge per chunk. Ours does not. We charge for the total tokens generated. The streaming mode is for user experience, not billing efficiency.
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)- Stream for real-time UI updates.
- Ignore intermediate chunks for billing.
- Read the final chunk for token counts.
- Verify usage matches your expectations.
Function calling overhead in tool use
Function calling adds significant overhead because tool definitions are repeated in every request. Each time you call a function, the model must re-read the tool schema.
If you have five tools, each with 1,000 tokens of definitions, you add 5,000 tokens to every request. This increases your input cost significantly. For long conversations, this overhead compounds.
Our API supports function calling with tools and tool_choice. You can optimize by reducing tool complexity. Combine related tools into single schemas. This reduces the token count per request.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.claudeapiproxy.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);Monitor your token usage carefully. High function call volumes can double your input costs. Use caching for tool definitions if possible. This helps keep your prepaid credit lasting longer.
Why refusals are free but retries are not
Refusals are free because no tokens were generated. If the model refuses a request due to content or format, you pay nothing. This is a key benefit of prepaid billing.
Retries are not free. If you send a request and get an error, you may need to retry. Each retry consumes tokens. Errors are free, but retries are not.
Our API charges only for real token usage. If a request fails before token generation, you pay nothing. If it fails after, you pay for what was generated. This transparency prevents hidden fees.
curl https://api.claudeapiproxy.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "get the current server time in ISO format"}]
}'- Refusals cost zero credits.
- Retries consume your budget.
- Errors are free if no tokens generated.
- Monitor retries to optimize efficiency.
JSON mode formatting costs
JSON mode formatting costs are identical to standard text mode. You pay for the tokens in the JSON output. The format does not add extra charges.
However, JSON output often requires more tokens than plain text. Models may add extra whitespace or keys to ensure valid JSON. This increases your output cost.
Our API supports JSON mode via response_format. You can enforce strict JSON output. This ensures compatibility with your client code. The cost is per token, not per format.
from openai import OpenAI
client = OpenAI(base_url="https://api.claudeapiproxy.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)Optimize your JSON schema to reduce token count. Remove unnecessary keys. Use shorter variable names. This helps minimize costs while maintaining data integrity.
Comparing proxy costs to direct vendor pricing
Proxy costs are often lower than direct vendor pricing because you pay only for tokens. Direct vendors may charge for uptime, support, or model versioning. Our API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens.
Direct vendors like Anthropic or OpenAI have complex pricing tiers. They may charge different rates for different models. Our API offers a single uncensored model. This simplifies billing.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.claudeapiproxy.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);- Proxy billing is transparent and prepaid.
- Direct vendors may have hidden fees.
- Our model is uncensored and open-weight.
- Compare token counts, not just prices.
Calculating your effective cost per conversation
Effective cost per conversation depends on token usage. Calculate the total tokens sent and received. Multiply by the rate per million tokens. This gives you the exact cost.
For example, if a conversation uses 10,000 input tokens and 5,000 output tokens, the cost is $0.0015 + $0.0025 = $0.004. This is negligible for most uses.
curl https://api.claudeapiproxy.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "get the current server time in ISO format"}]
}'Track your average conversation length. Optimize prompts to reduce input tokens. This helps you predict costs accurately. Prepaid credit never expires, so you can plan long-term.
Avoiding double-charge mistakes with prepaid credit
Double charges are rare but possible. If you top up via crypto, ensure you send the correct amount. Our API charges only for real token usage. Mistakes are fixed via the Support page.
from openai import OpenAI
client = OpenAI(base_url="https://api.claudeapiproxy.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)- Verify transaction hashes before topping up.
- Check your balance after each request.
- Report errors immediately for refunds.
- Keep records of your transactions.