EN ▾
grokapikey.com

Uncensored AI API for Grok users

https://api.grokapikey.com/v1uncensored

Grok AI API Documentation: OpenAI-Compatible Setup

Looking for Grok AI API documentation? This page is a working reference for an OpenAI-compatible uncensored text API: the base URL, auth header, model ID, request examples in Python, Node and curl, and the limits you will hit in production.

Updated

Open reference book feeding a pipeline of blocks into a server tower, representing API documentation

Key points

  • Grok API uses standard OpenAI-compatible endpoints like /v1/chat/completions for text generation.
  • An uncensored alternative offers a single model tuned for lawful adult content without usage restrictions.
  • Our API requires only an email and password, with no subscription lock-in or monthly fees.
  • Pricing is transparent at $0.15 per 1M input tokens and $0.50 per 1M output tokens.

What this API is, and what it is not

This is a hosted text API with an OpenAI-compatible interface. If your code already talks to an OpenAI-style chat endpoint, you change two values, the base URL and the key, and keep everything else. It is not the xAI API, it does not serve Grok models, and it is not a router that forwards to several vendors. It runs one open-weight model, operated by an independent provider and tuned to answer without content refusals for lawful adult use.

The model is addressed by the ID uncensored. There is no model menu to choose from. The context window is 100,000 tokens, counting the prompt and the completion together. Everything is text: there is no image, audio or video generation, no embeddings and no fine-tuning. One rule is fixed and cannot be changed by any prompt: no sexual content involving minors.

If you need documentation for xAI's own API, use their official docs. What follows covers only this service.

Connection details

SettingValue
Base URLhttps://api.grokapikey.com/v1
Model IDuncensored
Auth headerAuthorization: Bearer YOUR_KEY
EndpointsPOST /v1/chat/completions, GET /v1/models
Max request body8 MB

You get a key after signing up with Google or with email and password. New users can claim $0.50 of trial credit with one click on the API key page, once per person, valid for 7 days, no payment details needed. The official docs page on this site mirrors these settings.

A quick connectivity check lists the available model:

curl https://api.grokapikey.com/v1/models \
  -H "Authorization: Bearer YOUR_KEY"

A first request in three languages

Python (openai SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://api.grokapikey.com/v1",
    api_key="YOUR_KEY",
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Explain what a context window is in two sentences."},
    ],
    temperature=0.7,
)
print(resp.choices[0].message.content)
print(resp.usage)

Node

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.grokapikey.com/v1",
  apiKey: process.env.API_KEY,
});

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Name three uses for a JSON schema." }],
});
console.log(resp.choices[0].message.content);

curl

curl https://api.grokapikey.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Hello"}]}'

Keep the key out of source control. Read it from an environment variable, as the Node example does, and rotate it if it ever lands in a repository.

Parameters that are passed through

The sampling controls behave the way you expect from OpenAI-style APIs. temperature, top_p, stop, seed and the frequency and presence penalties are passed through to the model. max_tokens is optional: leave it out and the completion may use whatever remains of the 100,000-token window. For anything user-facing, set it, because a runaway reply costs output tokens at $0.50 per 1M.

seed helps with reproducibility during testing, though you should not assume bit-identical output across all conditions. Pair a fixed seed with low temperature when you want stable regression checks on your prompts.

Each response includes headers worth logging: X-Request-Id for support questions, X-Balance-USD for your remaining credit, and X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency for your key's ceilings.

Streaming, tools and JSON mode

Set stream: true and the response arrives as server-sent events, with usage reported at the end of the stream. This is the right mode for chat interfaces, because the first words appear while the rest is still being written.

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write a four-line poem about autumn."}],
    stream=True,
    stream_options={"include_usage": True},
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Tool calling uses the standard fields: pass tools and optionally tool_choice, read tool_calls from the reply (they stream too), run your function, and send the result back as a message with role: "tool". A minimal definition:

{
  "model": "uncensored",
  "messages": [{"role": "user", "content": "What is the weather in Oslo?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "description": "Get current weather for a city",
      "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"]
      }
    }
  }]
}

For structured output, send response_format: {"type": "json_object"} and say in the prompt that you want JSON. Always parse the result in a try block anyway; a model can produce valid JSON that still lacks a field you expected, so validate the shape before you trust it.

Using it with LangChain and other clients

Any client that lets you override the OpenAI base URL will work. In LangChain's Python integration, that looks like this:

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="uncensored",
    base_url="https://api.grokapikey.com/v1",
    api_key="YOUR_KEY",
    temperature=0.7,
)
print(llm.invoke("Give me one tip for writing clear prompts.").content)

Chat front ends such as SillyTavern let you add an OpenAI-compatible endpoint, and the same three values apply: URL, key and model name. Automation tools with an OpenAI node and a custom base URL field follow the same pattern. If a tool hard-codes a list of model names, look for a custom or manual model option and type uncensored.

Managing the 100,000-token window

The window counts everything: system prompt, every earlier message, tool definitions, tool results and the reply being generated. A request that sends 95,000 tokens leaves room for only about 5,000 tokens of answer, and a prompt larger than the window cannot work at all. You hold the conversation on your side and resend it with each call.

Three habits keep long sessions healthy. First, keep a running token estimate on your side, using the usage numbers from earlier responses as ground truth. Second, when history grows past a limit you pick, summarise the oldest part into a short message and drop the originals. Third, put fixed instructions at the start in the system message and keep them short, since you pay for them on every call at $0.15 per 1M input tokens.

Long context is useful when you genuinely need it, such as analysing a long document or keeping a story consistent. It is wasteful as a default. A 50,000-token prompt costs $0.0075 in input per call, which is small once but adds up over thousands of calls.

Troubleshooting checklist

When a request fails, work through these in order.

  1. An auth error. Confirm the header is exactly Authorization: Bearer YOUR_KEY with no stray quotes or line breaks, and that the key was copied in full.
  2. Connection or 404 errors. Check that the base URL ends in /v1 and that your client appends /chat/completions itself. Doubling the path is a common mistake when you paste a full endpoint into a base URL field.
  3. Model not found. The only model ID is uncensored. A client defaulting to another name will fail until you change it.
  4. Request too large. The body limit is 8 MB, and the token limit is 100,000 including the reply. Shrink the prompt or split the task.
  5. 429 responses. Read the error code to see whether you hit the per-minute limit or the concurrency limit, then apply the retry pattern above.
  6. Empty or truncated output. Check finish_reason in the response. A value of length means your max_tokens cap cut the reply short.

When you contact the team through the support page, include the X-Request-Id header from the failing response. It lets them find the exact request.

Prompting notes for this model

The API is plain chat completions, so the usual practices apply. Put role and tone in the system message. Give examples in the user message when you need a specific format. Use low temperature, around 0.2, for extraction and classification, and higher values for creative writing. Because the model is tuned not to refuse lawful adult requests, you remain responsible for what your application asks of it and for the rules you set for your own users. That includes the fixed rule against sexual content involving minors.

If you build a product on top of the API, write your own content policy and enforce it in your system prompt and in your application code. The model will not do that for you.

Rate limits and error handling

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 concurrent and 60 per minute. When you pass a limit the API answers HTTP 429 with an error code that tells you which one: rate_limited for requests per minute, concurrency for too many in flight. On temporary overload it also returns 429, with a Retry-After: 5 header.

One detail catches people: a streamed request holds its concurrency slot until the stream finishes. Ten users reading long streamed replies can exhaust eight slots even when the per-minute count is low. Queue requests on your side, or cap your worker pool at 8.

import time
from openai import OpenAI, RateLimitError

client = OpenAI(base_url="https://api.grokapikey.com/v1", api_key="YOUR_KEY")

def ask(prompt, tries=4):
    for attempt in range(tries):
        try:
            r = client.chat.completions.create(
                model="uncensored",
                messages=[{"role": "user", "content": prompt}],
            )
            return r.choices[0].message.content
        except RateLimitError:
            time.sleep(5 * (attempt + 1))
    raise RuntimeError("still rate limited")

Failed or refused requests are not charged, so retries are safe for your balance. Prompts are not used for training. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens; the pricing page has top-up tiers, and the payment options are USDT on TRC20 or USDC on Base.

Frequently Asked Questions

Is the uncensored model truly without content filters?

Yes, the model is tuned to answer without content refusals for lawful adult use. The only hard limit is that sexual content involving minors is always blocked. This makes it suitable for creative and adult content generation without unexpected restrictions.

Can I use the official OpenAI SDKs with this API?

Absolutely. Our API is fully OpenAI-compatible. You can use the same SDKs and client libraries, simply by updating the base URL and API key in your configuration. This ensures a smooth transition for developers already familiar with OpenAI’s ecosystem.

How does the prepaid credit system work?

You purchase credit starting from $20, which never expires. You pay only for the tokens you use, with no monthly fees or subscription lock-in. Bonuses are applied for larger purchases, enhancing the value of your investment.

Is my data used for training?

No, prompts are not used for training. Your data remains private, and an account requires only an email and password. This ensures that your content and usage patterns are not leveraged for model improvement without your consent.

Questions and answers

What is the base URL?

https://api.grokapikey.com/v1. Append /chat/completions for chat requests or /models to list models.

Which model ID do I use?

Use uncensored. It is the only model, so there is nothing else to select.

Does it work with the official OpenAI SDKs?

Yes. Set the base URL and your key in the client, keep the rest of your code, and use the model ID uncensored.

Is this the xAI Grok API?

No. It is a separate service running one open-weight model. For xAI's own API, see their official documentation.

What does a 429 error mean?

You passed a limit. The code rate_limited means too many requests per minute, concurrency means too many at once, and a Retry-After: 5 header marks temporary overload.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.