SDK compatibility and base URL setup
Connect your existing client code by pointing it to our dedicated endpoint. This openai compatible API accepts standard headers and SDK configurations without code changes. You only need to update the base URL and provide your API key from the dashboard.
https://api.openrouterratelimits.com/v1 is the single entry point for all requests. Authentication uses the standard Bearer token scheme found in most modern LLM libraries. Pass your key in the Authorization header to verify your identity. This setup works with any client expecting an OpenAI-style interface, making migration instant for teams tired of vendor lock-in.
- Base URL:
https://api.openrouterratelimits.com/v1 - Auth Header:
Authorization: Bearer YOUR_API_KEY - Model ID:
uncensored
Streaming responses with SSE
Enable streaming by setting stream: true in your request payload. The API returns Server-Sent Events (SSE) for real-time token delivery. Each chunk contains the generated text until the final chunk includes usage statistics. This approach keeps your UI responsive even for long context windows.
Streaming is ideal for chat interfaces or roleplay scenarios where latency matters. You do not need to wait for the entire completion to render text. The final chunk always contains the token counts for accurate billing. Errors during streaming still return proper HTTP status codes for immediate handling.
Function calling and JSON mode
Use structured outputs for reliable data extraction or tool integration. Enable response_format with {"type": "json_object"} to force JSON compliance. This mode is essential for parsing complex nested structures without extra cleanup logic. Function calling works alongside standard text generation for dynamic agent workflows.
Define your tools in the tools array and specify tool_choice for strict enforcement. The model returns function calls in the standard OpenAI format. This feature supports both single and multiple tool calls within a single turn. Use this for building agents that interact with external APIs or databases reliably.
Managing tokens and parameters
Control generation behavior with standard parameters like temperature, top_p, and stop. The context window supports up to 100,000 tokens for prompt and completion combined. This allows for extensive historical context or large document processing in a single request.
Set max_tokens to limit output length, defaulting to 2,048 if omitted. The model handles presence_penalty and frequency_penalty for stylistic control. Token usage is charged based on actual input and output counts. Errors do not consume tokens, ensuring fair billing for failed requests.
Understanding rate limits per key
Each API key supports 300 requests per minute with a concurrency limit of 8 simultaneous requests. This limit applies per key, so creating multiple keys scales your throughput linearly. The maximum request body size is 8 MB, which fits within the context window for most use cases.
Rate limits reset continuously based on a sliding window. If you exceed the limit, the API returns a 429 error. Upgrade your prepaid credit to maintain priority access. Unlike shared tiers, our dedicated servers do not suffer from neighbor noise. Monitor your usage dashboard to stay within these boundaries for consistent performance.
Troubleshooting common errors
Handle errors by checking the HTTP status code and response body. A 401 error indicates an invalid or missing API key. Re-generate your key from the dashboard if authentication fails. A 402 error means your prepaid credit is exhausted; top up via crypto to resume service.
A 429 error signals that you have exceeded the rate limits. Reduce your request frequency or split workloads across multiple keys. The API does not charge tokens for these errors, so you do not lose credit for retries. Ensure your client library handles retries with exponential backoff for robustness.
cURL
curl https://api.openrouterratelimits.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Process one million logs"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.openrouterratelimits.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
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.openrouterratelimits.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
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)