Prerequisites: SDK Setup
Install the official client library for your preferred language before configuring the connection. The library handles JSON serialization, retries, and streaming protocols automatically.
For Python, install the package via pip. For Node.js, use npm or yarn to add the dependency to your project.
Ensure you are using a recent version of the SDK to support all features like function calling and JSON mode.
Configuration: Base URL & Key
Point your SDK client to our specific base URL and provide the API key you obtained during signup.
The base URL is HTTPS://api.claudellmapi.com/v1. This ensures all requests go to our uncensored model servers instead of the default provider.
Set the API key as an environment variable or pass it directly to the client constructor. No additional headers are required.
Sending Your First Request
Send a simple chat completion request to verify connectivity and response quality. Use the model id 'uncensored' to access the unrestricted model.
The request structure mirrors the standard OpenAI format, making it easy to swap out existing integrations.
Expect a text response containing the model's answer to your prompt.
Handling Streaming Responses
Enable streaming to receive tokens as they are generated, reducing perceived latency for long outputs.
Set the stream parameter to true in your request. The SDK will yield chunks of text as they become available.
This is ideal for chat interfaces where users expect immediate feedback while the model is still thinking.
Implementing Function Calling
Define tools in your request to let the model return structured data instead of plain text.
Specify the function schema and set tool_choice to 'auto' or a specific function name.
The model will respond with a function call object that you can execute in your code. This works seamlessly with our uncensored model.
Error Handling & Limits
Handle common HTTP errors gracefully to maintain a smooth user experience. A 401 status indicates an invalid or missing API key. A 402 status means your prepaid credit is exhausted. A 429 status signals that you have exceeded the rate limit of 300 requests per minute.
Your context window is 100,000 tokens for prompt and completion combined. Requests exceeding the 8 MB body limit will also fail.
cURL
curl https://api.claudellmapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "What are the current rate limits for large context windows"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.claudellmapi.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.claudellmapi.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)