API CostQuickstart: Integrate with the OpenAI-compatible endpoint
Quickstart: Integrate with the OpenAI-compatible endpoint
Get your uncensored LLM API key and start sending text in seconds. This guide covers the base URL, authentication, and the exact requests needed to integrate with our OpenAI-compatible endpoint.
Prerequisites: Base URL and authentication
Start by generating a key on the Get API key page. Sign in with Google or your email and password to receive your credential instantly. No phone number is required.
Set your base URL to HTTPS://api.apicost.cc/v1. Use the generated key as your Bearer token in the Authorization header. This works with any standard OpenAI SDK client.
You only need one active key per account. A new key replaces the old one. Your prompts are not used for training.
Sending your first request: simple chat completion
Make a POST request to /v1/chat/completions with the model set to uncensored. Send your user message in the messages array. The API returns a text response.
Each request counts toward your token usage. Input tokens cost $0.15 per million. Output tokens cost $0.50 per million. Errors and refusals are free.
Ensure your request body stays under 8 MB. The maximum output is 16,000 tokens per request.
curl https://api.apicost.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "What is the current price per million tokens?"}]
}'
Streaming responses for real-time UI updates
Enable streaming by setting the stream parameter to true. The API returns Server-Sent Events (SSE) instead of a single JSON object.
Parse each chunk to update your UI in real time. The final chunk contains the total token usage for the request. This helps you track costs accurately.
Streaming works with all standard parameters. You can cancel the request early if needed. The server stops processing immediately.
from openai import OpenAI
client = OpenAI(base_url="https://api.apicost.cc/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)
Controlling creativity: temperature, top_p, and seed
Adjust temperature to control randomness. Lower values make responses more deterministic. Higher values increase creativity.
Set top_p to limit the nucleus sampling range. Use seed to reproduce specific outputs for debugging. These parameters work exactly like the OpenAI API.
Combine these settings to tune the model for your use case. Coding tasks often benefit from lower temperature. Creative writing may need higher values.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.apicost.cc/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);
Structured outputs with JSON mode and function calling
Use response_format set to json_object for strict JSON outputs. The model will return valid JSON without markdown formatting. This is useful for parsing data in your application.
Function calling allows you to define tools in your request. The model can call these tools based on the user input. Use tool_choice to control when the model calls a tool.
Both features follow the standard OpenAI schema. You can define multiple tools in one request. The model handles the routing 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)
Understanding context windows and token limits
The context window is 100,000 tokens. This includes both input and output tokens combined. You can send long documents without losing context.
Rate limits are 300 requests per minute per key. You can have 8 concurrent requests at the same time. Exceeding these limits returns a 429 error.
Handle errors gracefully in your code. A 401 error means your key is invalid. A 402 error means you have no credit. Top up with crypto to continue.
Common questions
How much does the uncensored LLM API cost per million tokens?
Input tokens cost $0.15 per million. Output tokens cost $0.50 per million. You pay only for what you use with no monthly fees.
Can I use the standard OpenAI SDK to connect?
Yes. Set the base URL to HTTPS://api.apicost.cc/v1. Use the model id uncensored. All standard parameters like temperature and stream work identically.
What happens if I hit the rate limit?
You receive a 429 error. The limit is 300 requests per minute. You can have 8 concurrent requests. Wait a few seconds and retry.
Get your key in seconds
Sign up, copy the key, and update your base URL. That’s it.