API documentation: uncensored chat completions
Swap your existing OpenAI SDK integration to our uncensored API with a single base URL change. Send standard chat completions requests and receive unconstrained responses in milliseconds.
- Base URL
https://api.tokencostclaude.com/v1- Model
uncensored
Base URL and authentication setup
Start by pointing your client to our endpoint. Use the https://api.tokencostclaude.com/v1 base URL for all requests. Authenticate via the Authorization header with your Bearer token.
curl https://api.tokencostclaude.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the 2024 monthly costs for ten million tokens"}]
}'Keep your key secure. Each account holds one active key. Replace an old key by generating a new one on the dashboard.
POST /v1/chat/completions endpoint guide
Send messages to generate text. Post a JSON body to the /v1/chat/completions path. The model ID is uncensored.
from openai import OpenAI
client = OpenAI(base_url="https://api.tokencostclaude.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)Input tokens cost $0.15 per million. Output tokens cost $0.50 per million. Errors and refusals incur no charge. Your prepaid credit decreases only on successful content generation.
Streaming responses and token usage in SSE
Enable streaming by setting stream: true. The server returns Server-Sent Events. Each chunk contains partial text and metadata.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.tokencostclaude.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);Token usage data appears in the final chunk. This allows precise cost tracking per request. Parse the usage field to monitor your spending in real time.
Function calling (tools) and JSON mode support
Define tools in the tools array. The model responds with structured tool calls. You can enforce strict JSON output using response_format set to {"type": "json_object"}.
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)This works with standard OpenAI-compatible clients. Configure tool choices to control when the model decides to call a function versus generating plain text.
Parameters: temperature, top_p, stop, seed, and penalties
Adjust model behavior with standard parameters. Set temperature for randomness. Use top_p for nucleus sampling. Define stop sequences to halt generation early.
Set seed for reproducible outputs. Apply presence_penalty and frequency_penalty to control repetition. These fields mirror the OpenAI API specification exactly.
GET /v1/models endpoint and model ID usage
Query available models via the GET /v1/models endpoint. Verify the uncensored model is listed. The response confirms your connection is valid.
Always use uncensored as the model ID in your requests. This ensures you hit our uncensored large language model. Check this endpoint to debug connectivity issues before sending heavy payloads.
Common questions
What happens if my API key is invalid?
The server returns a 401 Unauthorized error. Check your authentication header. Ensure you are using the correct base URL and that your account is active.
How do I handle rate limits?
You are limited to 300 requests per minute per key. If you exceed this, you receive a 429 Too Many Requests error. Implement exponential backoff in your client. You can also run 8 concurrent requests simultaneously.
What is the context window size?
The model supports a 100,000 token context window. This includes both input and output tokens. Requests exceeding this limit will fail. Ensure your prompt fits within this boundary to avoid errors.
Get your API key
Register, copy the key, update the base URL. That is all it takes.