What you are getting, and what you are not
Let us be precise first, because the name of the site can mislead. This is not the official API of xAI or of Grok. It is a hosted API in front of one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not a router across several vendors either. If you need xAI's own models, go to xAI and check their current terms and pricing.
What it is useful for is a plain developer workflow. The API speaks the OpenAI chat completions format, so the client libraries you already use keep working. You change two values, the base URL and the key, and you pass uncensored as the model ID. Two endpoints exist: POST /v1/chat/completions and GET /v1/models. Authentication is a standard Authorization: Bearer header.
The service is text only. There is no image, audio or video generation, no embeddings and no fine-tuning. The context window is 100,000 tokens, counted across prompt and completion together, and max_tokens is optional. There is one hard content limit: nothing that involves sexual content with minors, ever.
If that matches what you are building, the rest of this page covers the details developers ask about: the first request, streaming, structured output, tools, limits and cost.
Your first request
Create an account from the API key page, copy the key, and send a request. Sign-up works with Google or with email and password. New users can claim $0.50 of trial credit with one click on that page, one per person, valid for seven days. The trial key runs under lower limits than a full key: 2 concurrent requests and 60 requests per minute.
Start with curl, because it removes every other variable:
curl https://api.uncensoredgrok.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain idempotency keys in two sentences."}
]
}'
The same call with the official Python SDK:
from openai import OpenAI
client = OpenAI(
base_url="https://api.uncensoredgrok.com/v1",
api_key="YOUR_KEY",
)
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Explain idempotency keys in two sentences."}],
temperature=0.7,
)
print(resp.choices[0].message.content)
A call to GET /v1/models is a cheap way to check that your key and base URL are right before you debug anything else. Every response carries the headers X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. Log the request ID with your own logs, and watch the balance header if you run unattended jobs.
Sampling parameters such as temperature, top_p, stop, seed and the frequency and presence penalties are passed through to the model. The full parameter notes are on the documentation page.
Streaming
Set stream: true and the response arrives as server-sent events, one chunk per token group, with usage reported at the end of the stream. For a chat interface this is the difference between a screen that waits and a screen that types.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Write a haiku about retries."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if getattr(chunk, "usage", None):
print("\ntokens:", chunk.usage)
In Node the pattern is the same:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.uncensoredgrok.com/v1",
apiKey: process.env.API_KEY,
});
const stream = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Write a haiku about retries." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
One detail matters for capacity planning. A streamed request keeps its concurrency slot until the stream ends. If a client opens a stream and then stalls, that slot stays taken, so close streams you no longer read.
JSON mode and tool calling
For structured output, pass response_format with the type json_object. Also say in the prompt that you want JSON, and name the keys you expect. JSON mode helps the model produce parseable text, but you should still validate the result in your code and handle a failed parse.
resp = client.chat.completions.create(
model="uncensored",
response_format={"type": "json_object"},
messages=[
{"role": "system", "content": "Reply with JSON only: {\"title\": string, \"tags\": [string]}"},
{"role": "user", "content": "Summarize: a guide to rate limiting for API clients."},
],
)
import json
data = json.loads(resp.choices[0].message.content)
Tool calling
Tool calling follows the OpenAI shape. You send tools and optionally tool_choice. The model answers with tool_calls, you run the function, and you send the result back as a message with role: "tool". Tool calls can also stream.
import json
tools = [{
"type": "function",
"function": {
"name": "get_order_status",
"description": "Look up an order by id",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"],
},
},
}]
messages = [{"role": "user", "content": "Where is order A-1042?"}]
first = client.chat.completions.create(
model="uncensored", messages=messages, tools=tools, tool_choice="auto"
)
msg = first.choices[0].message
if msg.tool_calls:
messages.append(msg)
for call in msg.tool_calls:
args = json.loads(call.function.arguments)
result = {"order_id": args["order_id"], "status": "shipped"}
messages.append({
"role": "tool",
"tool_call_id": call.id,
"content": json.dumps(result),
})
final = client.chat.completions.create(
model="uncensored", messages=messages, tools=tools
)
print(final.choices[0].message.content)
Always parse the arguments string defensively. Models sometimes return arguments that are not valid JSON, and a try/except around json.loads with one retry is cheap insurance.
Rate limits, 429s and retries
A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. The maximum request body is 8 MB. When you exceed a limit you get HTTP 429, and the error code tells you which limit: rate_limited means too many requests per minute, concurrency means too many at once. On temporary overload the API also returns 429 with a Retry-After: 5 header.
That gives you a simple retry rule: on 429, wait for Retry-After if it is present, otherwise back off exponentially with jitter, and cap the attempts.
import time, random
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.uncensoredgrok.com/v1", api_key="YOUR_KEY", max_retries=0)
def ask(messages, attempts=5):
for i in range(attempts):
try:
return client.chat.completions.create(model="uncensored", messages=messages)
except RateLimitError as e:
wait = float(e.response.headers.get("Retry-After", 2 ** i))
time.sleep(wait + random.random())
raise RuntimeError("still rate limited")
If you run batch jobs, cap your worker pool at 8 on a full key. Eight workers each holding one request is the ceiling, and a ninth will only earn you 429s with the code concurrency. Failed or refused requests are not charged, so retrying does not cost you money.
Habits that save time in production
A few practices pay off quickly once the first request works. Store the key in an environment variable or a secrets manager, and give each environment its own key so you can rotate one without touching the others. Log the X-Request-Id value next to your own trace ID; if something looks wrong in a response, that ID is the thing to quote.
Set a timeout on the client. Long generations are normal when you allow a large completion, so choose a timeout that fits your longest expected answer, and use streaming for anything a person is waiting on. Cap max_tokens in user-facing paths even though the parameter is optional, because a cap puts a ceiling on both latency and spend.
Keep the conversation history you send under control. The window is 100,000 tokens, but input is billed on every call, so trimming old turns or summarizing them is the cheapest optimization you have. Finally, pin your sampling settings. Setting seed together with a fixed temperature gives you more repeatable runs when you compare prompt variants, though you should not treat it as a guarantee of identical output.
What it costs
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. There is no subscription and the credit never expires. A worked example makes it concrete. Take a request with 2,000 input tokens and 500 output tokens:
- Input: 2,000 / 1,000,000 x $0.15 = $0.0003
- Output: 500 / 1,000,000 x $0.50 = $0.00025
- Total: $0.00055 per request, so 1,000 such requests cost $0.55.
The $0.50 trial credit therefore covers roughly 900 requests of that size. Top-ups run from $20 to $500 in any whole amount, with a bonus of 5% from $50, 10% from $100 and 15% from $200. A $100 top-up, for example, credits $110. Payment is crypto only on this site: USDT on TRC20 or USDC on Base. The pricing page has the current table.
Prompts are not used for training. If you are weighing this against another endpoint, the existing article on pay per token and the 100k context window covers how the metering behaves in long conversations.
When another option fits better
Be honest about fit. If you need image generation, embeddings, speech or a fine-tuned model, this API does not offer them. If your contract or compliance team requires a first-party vendor, use that vendor. If you need guaranteed model identity from a specific lab, this is the wrong product, since it runs a single open-weight model from an independent provider.
Where it does fit is an application that already speaks the OpenAI protocol and needs a text model that answers lawful adult requests without refusing them: writing tools, roleplay and companion apps for adults, data labeling that touches difficult subjects, and test harnesses. Point your existing client at the new base URL and compare output on your own prompts before you commit credit.
