Uncensored ollama API Reference
Get started with the uncensored ollama API by sending a single request to our OpenAI-compatible endpoint. This guide covers authentication, streaming, and error handling for immediate integration.
Base URL and Authentication
The base URL for all requests is HTTPS://api.uncensoredollama.com/v1. You authenticate by passing your API key in the Authorization header. The header format must be exactly 'Bearer YOUR_API_KEY'. This key is generated immediately after you sign up via Google or email. There is no phone number verification required. Your key works with any standard OpenAI SDK client.
First Request
Send your first prompt to the /v1/chat/completions endpoint. The model ID is 'uncensored'. This model answers without content refusals for lawful adult use. It is not GPT or Claude. Use the following curl command to verify connectivity.
curl https://api.uncensoredollama.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "list 3 common rust compile errors"}]
}'
Expect a JSON response with the generated text. If you receive an error, check your key validity. The model handles complex instructions well. You can adjust parameters like temperature for more creative outputs.
Python SDK Integration
Use the official OpenAI Python library for easy integration. Set the base_url and api_key attributes on the client instance. This allows you to reuse existing code structures. The following example demonstrates a simple chat completion call.
from openai import OpenAI
client = OpenAI(base_url="https://api.uncensoredollama.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)
The response object contains the generated text in the choices array. You can extract the content directly. This method is reliable for batch processing. It handles retries automatically.
Node SDK Usage
Initialize the OpenAI client with your credentials. The base_url must point to our endpoint. This ensures compatibility with standard Node.js applications. Use the following snippet to create a client instance.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.uncensoredollama.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);
Call the chat.completions.create method with your model ID. The 'uncensored' model responds to system prompts effectively. You can stream results or wait for the full response. Error handling should catch network issues.
Streaming and Usage Data
Enable streaming by setting stream to true. This returns chunks as they are generated. The final chunk contains usage statistics. This includes input and output token counts. This data is crucial for billing accuracy.
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)
Process each chunk to build the complete response. The streaming feature reduces perceived latency. It works well for real-time applications. The token usage is only in the last chunk.
Limits and Errors
You are limited to 300 requests per minute per key. The context window is 100,000 tokens. Errors include 401 for invalid keys and 402 for insufficient credit. The 429 error indicates rate limiting. Handle these codes gracefully in your application. Refusals do not consume credit. Errors are free. Your prepaid credit never expires.
Common questions
Does the uncensored ollama API support function calling?
Yes, the API supports function calling via the tools parameter. You can define custom tools in your request. The model will return structured JSON for tool execution. This works with standard OpenAI SDK clients.
How does the pricing work for the uncensored AI API?
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. You pay only for real token usage. Errors and refusals are free. Prepaid credit is charged by usage and never expires.
Is the uncensored model trained on my data?
No, prompts are not used for training. Your data remains private. The model is an open-weight model run on our servers. It is not GPT, Claude, or any other vendor's model.
Generate your API key
Register, copy your key, and point your SDK to the new base URL. Setup takes seconds.