Quickstart for Unhinged Grok users
Connect your existing OpenAI SDK to our uncensored LLM API in five minutes by updating the base URL and API key. This guide shows how to send your first request using standard client code.
Authentication and Base URL
Our API is OpenAI compatible, meaning you do not need a new library. You only need to update two values in your existing configuration: the base_url and the api_key. Your API key is generated immediately upon signup via Google or email. Keep this key secure; it is the only credential required for authentication.
Replace the standard OpenAI base URL with our endpoint. This change directs all subsequent requests to our uncensored model servers. No other code changes are required for basic text generation.
Configuration Example
- Base URL:
https://api.unhingedgrok.com/v1 - API Key: Your unique key from the dashboard
Verify your connection by listing available models. This confirms your authentication is working correctly before sending generation requests.
First Request
Start by sending a simple text completion request. This example uses curl to demonstrate the raw HTTP structure. The request targets the /v1/chat/completions endpoint with the model ID uncensored. The response returns generated text in the choices array.
This direct approach works for any language or tool that supports standard OpenAI HTTP formats. You can test this immediately after generating your key.
Direct HTTP Request
curl https://api.unhingedgrok.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'
Python SDK Integration
Use the official OpenAI Python library to integrate our API. Install the package via pip. Initialize the client with your key and the custom base URL. The rest of the SDK methods, such as chat.completions.create, work exactly as documented for OpenAI.
This method is ideal for backend services, data processing scripts, or automated workflows. The SDK handles JSON serialization and response parsing automatically.
Python Code Example
from openai import OpenAI
client = OpenAI(base_url="https://api.unhingedgrok.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 SDK Integration
For JavaScript or TypeScript environments, use the official openai npm package. Configure the client with the same base URL and key. The Node SDK supports both callback and promise-based patterns.
This setup allows you to embed uncensored text generation directly into web applications, serverless functions, or Node-based automation tools. Error handling remains consistent with standard OpenAI SDK behavior.
Node.js Code Example
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unhingedgrok.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 Responses
Enable real-time token generation by setting stream: true. The API returns a Server-Sent Events (SSE) stream. Each chunk contains a partial response. The final chunk includes token usage statistics.
Streaming reduces perceived latency for end-users. It is essential for chat interfaces and interactive applications. Handle each chunk incrementally to update the UI immediately.
Streaming Code Example
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)
Limits, Errors, and Context
Understand the operational constraints to avoid service interruptions. The context window supports 100,000 tokens total, and if max_tokens is unset, the response can run to the end of the window.
Rate limits allow 300 requests per minute per key. Concurrent requests are capped at 8. Request bodies must not exceed 8 MB. Handle standard HTTP error codes: 401 indicates an invalid key, 402 signals insufficient credit, and 429 denotes rate limiting. Errors do not consume credit.
What the API supports
Everything the endpoint can and cannot do, in one place — check it before you top up.
| Parameter | Details |
|---|---|
| Protocol | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Endpoints | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.unhingedgrok.com/v1 |
| API key | Bearer token in the Authorization header |
| Model ID | uncensored |
| Structured output | response_format: {"type": "json_object"} |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| SSE streaming | Supported (stream: true), usage included at the end |
| Max output | prompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap |
| Context window | 100,000 tokens, input and output combined |
| Function calling | Yes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool |
| Requests per minute | 300 requests per minute per key |
| Max body | 8 MB request body |
| Parallel requests | up to 8 in parallel per key |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Bonus credit | +5% from $50, +10% from $100, +15% from $200 |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Subscription | paid credit never expires, no subscription |
| Token prices | $0.15 per 1M input tokens · $0.50 per 1M output tokens |
| Free trial | $0.50 of credit valid 7 days, no card needed · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Billing | prepaid credit, charged by real token usage; errors and refusals are free |
| Key management | one active key per account; a new key replaces the old one |
| Sign-in | Google or e-mail and password |
| Content policy | adult content allowed; sexual content involving minors is refused |
Errors and what to do
Errors come back as JSON with a stable type; failed and refused requests are not billed.
| Status | Type | Reason |
|---|---|---|
400 | bad_request | invalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend |
401 | missing_key · invalid_key · key_revoked | check the Authorization header or use your current key |
402 | no_credit | out of credit; add credit and retry |
403 | content_blocked | refused by the content policy |
404 | not_found | unknown endpoint |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | over 300/min or 8 parallel — back off and retry |
503 | upstream_busy | temporary overload, retry shortly |
Questions and answers
Is this the official Grok API?
No. We are an independent service hosting our own uncensored model. We are not affiliated with X Corp or the official Grok API. Our API is compatible with the OpenAI client format but runs a different model.
How do I pay for usage?
Credit is topped up using cryptocurrency (USDT on TRC20 or USDC on Base). Prepaid credit is charged based on real token usage. Errors and refusals are free. Credit never expires.
What is the context window size?
The model supports a 100,000 token context window for both prompt and completion combined. There is no separate output cap. If max_tokens is not specified, the response can run to the end of the window.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.