API Quickstart: Uncensored Text Generation
Integrate our uncensored LLM API in minutes using standard OpenAI SDKs. This guide covers authentication, request formats, streaming, and token limits for the grok unhinged endpoint.
- per 1M input tokens
- $0.15
- Output tokens / 1M
- $0.50
- token context
- 100,000
- trial credit
- $0.50
- requests per minute
- 300
Base URL and Authentication Setup
The base URL for all requests is https://api.grokunhinged.com/v1. You authenticate by passing your API key in the Authorization header. Every request must include this header to validate your account and deduct credits.
Get your key from the dashboard. It is shown immediately after signup. Keep it secure. We do not store your payment method since top-ups are crypto-only.
Chat Completions Endpoint: POST /v1/chat/completions
Send text requests to the chat completions endpoint. The model id is uncensored. It processes your input and returns a response.
curl https://api.grokunhinged.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Generate a summary of the latest Python 3.12 release notes"}]
}'Ensure your payload includes the messages array. Each message has a role and content. The API processes these sequentially. Errors return standard HTTP codes. Check your balance if you get a 402 error.
Model Listing: GET /v1/models
Retrieve available models by sending a GET request to /v1/models. This endpoint returns a list of model objects. Use it to verify connectivity. It confirms the API is reachable. The response includes the uncensored model id. Check the documentation for full field details.
Streaming Responses with SSE
Enable streaming by setting stream: true. The API sends Server-Sent Events. Each chunk contains partial text. This reduces perceived latency. You get tokens as they generate.
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)Handle each chunk in your client code. Accumulate the text. The final chunk often contains usage statistics. Stop streaming when you receive the done event. This is efficient for long outputs.
Function Calling and JSON Mode
Use function calling to integrate with external tools. Define tools in your request. The model returns structured tool calls. You execute them and feed results back. JSON mode forces the output to be valid JSON. Set response_format to {"type": "json_object"}. This is useful for data extraction.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.grokunhinged.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);Parse the JSON response carefully. Handle potential syntax errors. The model is tuned for accuracy. Use this for API integrations.
Parameters: Temperature, Top-P, and Stop Sequences
Control generation with parameters. Set temperature for randomness. Higher values increase creativity. Set top_p for nucleus sampling. Use stop sequences to halt generation. This prevents unwanted text. Adjust these for your use case.
from openai import OpenAI
client = OpenAI(base_url="https://api.grokunhinged.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)Combine parameters for precise control. Temperature affects word choice. Top-p affects diversity. Stop sequences define boundaries. Test different values. Document your settings for reproducibility.
Common questions
What is the context window size?
The context window is 100,000 tokens for input and output combined. There is no separate output cap: a response can use all the room left in the window. If you do not set max_tokens, the response can run to the end of the window. Plan your prompts accordingly to avoid truncation.
How do I handle errors?
Common errors include 401 for invalid keys and 402 for insufficient credit. A 429 error indicates you have exceeded the rate limit of 300 requests per minute. Check your API key first. Then verify your account balance. Retry with exponential backoff for 429s.
Is the grok unhinged API compatible with OpenAI SDKs?
Yes, it is an openai compatible API. Use the standard OpenAI SDKs. Change the base URL to our endpoint. Pass your API key. The request format matches the OpenAI chat completions standard. You can switch clients easily.
Get your API key
Register, retrieve your key, and update the base URL. That is all it takes.