Quickstart: Use the groq key api
Generate unrestricted text with the groq key API using standard OpenAI SDKs. Configure your base URL, authenticate, and send requests immediately.
Base URL and authentication setup
The groq key API replaces the standard OpenAI endpoint with a direct path to our uncensored model. Set your base_url to HTTPS://api.groqkeyapi.com/v1 and inject your key into the Authorization header. This configuration works with any OpenAI-compatible client, including the official Python and Node SDKs. You do not need to modify the model name in your code; we handle the routing internally.
curl https://api.groqkeyapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Check if endpoint supports 32k context window"}]
}'
Authentication is strict. A 401 error means your key is invalid or missing. Ensure you copy the key immediately after signup, as it is only shown once.
First chat completion request
Send a POST request to /v1/chat/completions with the model ID set to "uncensored". This model answers without refusals for lawful adult, fictional, or controversial topics. It processes text input and returns text output. You can adjust parameters like temperature and top_p to control creativity. The context window supports 100,000 tokens for the combined prompt and completion.
from openai import OpenAI
client = OpenAI(base_url="https://api.groqkeyapi.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)
Errors during processing do not consume credit. If the model returns a refusal for minor content, you pay nothing. This prepaid model ensures you only spend on actual output tokens.
Enable streaming for real-time output
Streaming via Server-Sent Events (SSE) delivers tokens as they are generated. Set stream=true in your request. The final chunk contains the full token usage statistics for billing. This approach reduces perceived latency for long responses. It is ideal for chat interfaces where users see text appearing in real time. The SDKs handle the parsing automatically.
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)
Streaming does not change the pricing structure. You still pay per 1M output tokens. The 16,000 token hard limit per request still applies regardless of streaming status.
Use JSON mode for structured data
Set response_format to {"type": "json_object"} to enforce strict JSON output. This is useful for programmatic integrations where you need predictable data structures. The model will attempt to format the response as valid JSON. It may fail if the prompt is too complex or the output exceeds limits. Always validate the JSON on the client side.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.groqkeyapi.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);
Function calling is also supported. You can define tools and let the model choose which to invoke. This expands the API capabilities beyond simple text generation.
Request limits and error handling
The API enforces a limit of 300 requests per minute per key. You can run 8 concurrent requests simultaneously. The maximum request body size is 8 MB. A 429 error indicates you have exceeded these limits. Wait a few seconds and retry. A 402 error means your prepaid credit is exhausted. Top up via crypto to resume service. Errors like 400 or 500 do not charge credits.
The model id is always "uncensored". Do not try to switch models. We host a single large language model optimized for unrestricted content. This keeps the stack simple and fast.
Context window and token limits
Your total context window is 100,000 tokens. This includes both the input prompt and the generated completion. The maximum output per request is 16,000 tokens. If you do not specify max_tokens, the default is 2,048 tokens. Exceeding the output limit will truncate the response. Plan your prompts to leave enough room for the full answer. This allows for deep context retention without manual chunking.
Streaming and JSON mode do not affect these limits. They remain consistent across all request types. Use the usage field in the response to track your consumption accurately.
Frequently asked questions
Is the groq key API openai compatible?
Yes. It uses the same endpoint structure and SDKs as OpenAI. You only need to change the base URL and model name to "uncensored". All standard parameters like temperature and top_p work as expected.
What happens if I get a 402 error?
A 402 error means your prepaid credit is depleted. You can top up using USDT or USDC via crypto. The credit never expires, so you can add funds whenever you are ready to continue.
Can I use this API for commercial projects?
Yes. The API is designed for developers who need unrestricted content for any lawful purpose. There are no monthly fees or subscription locks. You pay only for the tokens you use.
Generate your key now
Sign up, copy the token, and update your endpoint URL. That is all.