Base URL and Authentication
Our API follows the OpenAI Chat Completions standard. To interact with the service, you must direct your client to https://api.grokapikey.com/v1 and include your unique API key in the Authorization header. You can generate this key immediately after signing up with just an email and password. The key is displayed once upon creation, so save it securely. If you lose it, you can regenerate a new key from your dashboard, which instantly revokes the previous one. There is no need to link a credit card for the trial account.
Your First Request
Start by sending a simple text prompt to verify connectivity. Use the standard chat/completions endpoint with the model identifier uncensored. The following example demonstrates a basic curl command to test the connection. This confirms that your authentication is correct and the service is responding. You can then adapt this structure for your specific application logic.
Replace YOUR_API_KEY with your actual key before running this command.
curl https://api.grokapikey.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
If you are building a Python application, use the official openai library. Configure the client to use our base URL and your API key. This allows you to leverage familiar Python idioms while accessing the uncensored model. The client handles serialization and streaming automatically. Ensure your environment has the latest version of the library installed for best compatibility with our endpoints.
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": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)
Node.js SDK Integration
For JavaScript or TypeScript projects, the Node.js OpenAI SDK works out of the box. Set the apiKey and baseURL properties in your configuration object. This ensures that all subsequent requests route through our infrastructure. You can use standard async/await patterns to handle responses. This approach is ideal for server-side applications or edge functions that require direct API access without proxying through OpenAI.
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: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);
Streaming Responses
For applications that benefit from real-time token generation, enable streaming by setting stream: true in your request body. The API returns a Server-Sent Events (SSE) stream of partial responses. This reduces perceived latency for users and allows for immediate display of generated text. Each chunk contains a delta of the response. Handle these events in your client code to update the UI progressively. Streaming consumes tokens normally and does not affect pricing.
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
Each API key is limited to 300 requests per minute and a maximum request body size of 8 MB. If you exceed the rate limit, the API returns a 429 status code; wait a few seconds and retry. A 401 error indicates an invalid or revoked key, while a 402 error means your prepaid credit is exhausted. The model supports a 100,000-token context window for both input and output combined. Ensure your prompts fit within this limit to avoid truncation. Content filters remain minimal, except for a hard block on sexual content involving minors.