Quickstart: Integrate the llm api router
Change your base_url and API key to start generating text with zero configuration. This guide covers the essential endpoints, parameters, and limits for immediate integration.
- $0.15per 1M input tokens
- $0.50Output tokens / 1M
- 100,000token context
- $0.50trial credit
- 300requests per minute
Configuration: Base URL and API Key
Set your client to use the official base URL and your unique key. Point your OpenAI-compatible SDKs to HTTPS://api.llmapirouter.com/v1 and assign the key retrieved from your dashboard. This single change directs all requests to our uncensored model without modifying your application logic.
Basic Text Completion
Send a standard chat completion request to generate text responses. The endpoint accepts a list of messages and returns the model's output in JSON format.
Use this structure to start your first generation:
curl https://api.llmapirouter.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "list all npm packages"}]
}'
Streaming Responses (SSE)
Enable streaming by setting the stream parameter to true. This returns Server-Sent Events, allowing you to display tokens as they generate rather than waiting for the full response.
Implement the stream flag in your SDK client:
from openai import OpenAI
client = OpenAI(base_url="https://api.llmapirouter.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)
Function Calling (Tools)
Define tools in your request to enable the model to call external functions. Pass a list of tool definitions and specify tool_choice to control when the model uses them.
Configure tools using the Node SDK:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.llmapirouter.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);
JSON Mode Response Format
Force the model to output valid JSON by setting response_format to {type: "json_object"}. This ensures structured data output for reliable parsing in your application.
Enable JSON mode in your streaming client:
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)
Rate Limits and Constraints
Each API key supports 300 requests per minute and 8 concurrent requests. The request body must stay under 8 MB, and you can specify up to 100,000 tokens for the combined prompt and completion. Errors return standard HTTP codes: 401 for invalid keys, 402 if credit is exhausted, and 429 when you exceed the rate limit.
Frequently asked questions
How do I integrate this LLM API router into my existing code?
Update your base_url to HTTPS://api.llmapirouter.com/v1 and set your new API key. All standard OpenAI-compatible SDKs work immediately without code changes.
What happens if I exceed the rate limit?
The API returns a 429 Too Many Requests error. You can retry after a short delay or upgrade your usage pattern to stay within the 300 requests per minute limit.
Does the model support image or audio generation?
No. This is a text-only API. It supports text input and output, streaming, function calling, and JSON mode, but does not handle images, audio, or video.
Unlock your API key
Register, copy the token, and update your base URL. Setup takes seconds.