Authentication and Base URL
Use https://api.ollamaendpointurl.com/v1 as your base URL and include your API key in the Authorization header.
- Base URL:
https://api.ollamaendpointurl.com/v1 - Header:
Authorization: Bearer YOUR_API_KEY
Generate your key instantly via Google or email on the dashboard. No phone number is required. This URL works with any standard OpenAI SDK by overriding the base URL.
First Request
Send a POST request to /v1/chat/completions with the model ID uncensored and your messages.
curl https://api.ollamaendpointurl.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "What is the default port for Ollama?"}]
}'This returns a JSON response containing the generated text. If you receive a 401 error, your API key is invalid. A 402 error indicates insufficient prepaid credit.
Python SDK Integration
Initialize the client with your key and the custom base URL to send requests programmatically.
from openai import OpenAI
client = OpenAI(base_url="https://api.ollamaendpointurl.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)Set max_tokens to control output length. Without it, the default is 2,048 tokens. The model accepts standard parameters like temperature and top_p for tuning generation behavior.
Node SDK Integration
Configure the Node.js client to point to our endpoint for seamless integration into your scripts.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.ollamaendpointurl.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);The SDK handles serialization automatically. Ensure you are using a recent version of the OpenAI SDK that supports custom base URLs. Errors are thrown as standard API exceptions.
Streaming Responses
Enable streaming by setting stream: true to receive tokens via Server-Sent Events (SSE).
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)Token usage details appear in the final chunk of the stream. This reduces perceived latency for long outputs. The endpoint supports standard SSE formatting compatible with most client libraries.
Rate Limits and Context Window
Each API key is limited to 300 requests per minute and 8 concurrent requests. The context window is 100,000 tokens total. The maximum output per request is 16,000 tokens. Requests exceeding 8 MB in body size are rejected. A 429 error indicates you have hit the rate limit. Wait briefly before retrying. Errors and refusals do not consume credit. Credit never expires. Use crypto to top up. Start with $0.50 trial credit. Get your key now.