Summary
- The hosted endpoint is OpenAI-compatible: base URL https://api.ollamaabliterated.com/v1, model uncensored.
- Python, Node and curl examples below are copy-paste ready.
- Streaming, tool calling and JSON mode are supported; context is 100,000 tokens.
- Ollama's native /api/chat fields map onto chat completions with a few renames.
What you are replacing
A local Ollama server listens on port 11434 and exposes two kinds of routes: its native /api/* routes and an OpenAI-compatible /v1/* layer. An ollama abliterated api setup adds a model with its refusal behavior edited out, so the local server answers prompts a stock chat model would decline.
The hosted equivalent is one URL: https://api.ollamaabliterated.com/v1. It speaks the OpenAI schema, so you call POST /v1/chat/completions (or POST /v1/responses) with a Bearer key. The model is a single open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. We do not describe it as a specific abliteration recipe, and it is not an official API of any model vendor. You skip downloading weights, quantization choices and driver updates.
Get a key
Sign up with Google or with email and password, open the API key page and claim $0.50 of trial credit with one click. There is no card step, the credit is valid for 7 days, and it is one per person. If you later top up (any whole amount from $20 to $500, paid in crypto), the account moves to the full limits of 8 concurrent requests and 300 requests per minute.
Store the key in an environment variable named OLLAMA_ABL_KEY; the examples below read it from there.
Sign-up takes a minute and the trial is enough to run the examples below many times over: at about $0.0003 per small request, $0.50 covers well over a thousand of them. If you plan to build on the endpoint, a topped-up account can hold up to 5 keys that you can label and revoke one by one, which is handy when a bot, a test script and a web app all need their own credentials.
Python and Node.js examples
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.ollamaabliterated.com/v1",
api_key=os.environ["OLLAMA_ABL_KEY"],
)
messages = [
{"role": "system", "content": "You are a blunt editor who answers directly."},
{"role": "user", "content": "Rewrite: 'The thing was kind of big and scary.'"},
]
resp = client.chat.completions.create(
model="uncensored",
messages=messages,
temperature=0.7,
max_tokens=200,
)
print(resp.choices[0].message.content)
print(resp.usage)
max_tokens is optional. Leave it out and the completion can use the rest of the 100,000-token window, which is shared by prompt and reply. Set it when you want to bound cost or length.
The API is stateless, so a conversation is a list you grow yourself: append the assistant's reply and the next user message to messages and send the whole list again. That keeps working until the list nears the window, and it also means input tokens grow each turn. The same call in Node looks like this, this time streamed.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.ollamaabliterated.com/v1",
apiKey: process.env.OLLAMA_ABL_KEY,
});
const stream = await client.chat.completions.create({
model: "uncensored",
stream: true,
messages: [{ role: "user", content: "Tell a two-paragraph ghost story." }],
});
for await (const part of stream) {
process.stdout.write(part.choices[0]?.delta?.content ?? "");
}
Streaming uses server-sent events. A streamed request keeps its concurrency slot until the stream ends, so close the stream if your user navigates away.
For a multi-turn loop, keep the list and append to it:
# reuses the client created above (base_url https://api.ollamaabliterated.com/v1)
history = [{"role": "system", "content": "You are a dungeon master. Keep replies under 120 words."}]
def turn(user_text):
history.append({"role": "user", "content": user_text})
r = client.chat.completions.create(model="uncensored", messages=history)
reply = r.choices[0].message.content
history.append({"role": "assistant", "content": reply})
return reply
print(turn("I push open the cellar door."))
print(turn("I light a torch and step inside."))curl, for quick checks
export OLLAMA_ABL_KEY="paste-your-key-here"
curl https://api.ollamaabliterated.com/v1/chat/completions -H "Authorization: Bearer $OLLAMA_ABL_KEY" -H "Content-Type: application/json" -d '{"model":"uncensored","messages":[{"role":"user","content":"Name three villains for a fantasy novel."}]}'
# returns the model ID: uncensored
curl https://api.ollamaabliterated.com/v1/models -H "Authorization: Bearer $OLLAMA_ABL_KEY"
The second call lists models, the equivalent of Ollama's /api/tags. You will see the single ID uncensored. To check your credit, call GET /v1/balance or read the X-Balance-USD header on any response.
Tool calling and JSON mode
Both work through the standard fields. For tools, pass tools and optionally tool_choice; the model's calls arrive as tool_calls (also streamed), and you answer with a message whose role is tool. For JSON, set response_format to {"type":"json_object"} and mention JSON in the prompt.
import json, os
from openai import OpenAI
client = OpenAI(base_url="https://api.ollamaabliterated.com/v1",
api_key=os.environ["OLLAMA_ABL_KEY"])
tools = [{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll dice for a tabletop scene",
"parameters": {"type": "object",
"properties": {"sides": {"type": "integer"}},
"required": ["sides"]},
},
}]
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Roll a d20 for the lockpicking attempt."}],
tools=tools,
)
call = r.choices[0].message.tool_calls
if call:
print(call[0].function.name, json.loads(call[0].function.arguments))Mapping Ollama native fields
If you have code written against Ollama's /api/chat, these renames cover most of it.
| Ollama native | OpenAI-style here |
|---|---|
options.temperature, options.top_p, options.seed | temperature, top_p, seed at the top level |
options.num_predict | max_tokens |
options.stop | stop |
format: "json" | response_format: {"type":"json_object"} |
options.num_ctx | Not needed, the window is fixed at 100,000 tokens |
Response message.content | choices[0].message.content |
Response eval_count | usage.completion_tokens |
Embeddings, image inputs, and model management routes such as pull and create do not exist on the hosted side. For how the local routes behave, see our local Ollama API walkthrough.
Cost and limits to plan for
Price is $0.15 per 1M input tokens and $0.50 per 1M output tokens. A 1,000-token prompt with a 300-token reply costs $0.00015 plus $0.00015, so $0.0003. Failed or refused requests are not charged, and credit never expires; details live on the pricing page.
When you exceed a limit you receive HTTP 429, with code rate_limited or concurrency. Back off and retry, using the Retry-After header when it is present. The service is for lawful adult use, and sexual content involving minors is never allowed. See the docs for the complete field list.
Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| 404 on the first call | Base URL missing /v1, or the path doubled | Use https://api.ollamaabliterated.com/v1 as the base and let the SDK add /chat/completions |
| 401 response | Missing or wrong key, or a key you regenerated since | Copy the current key from the key page and send it as a Bearer token |
| Model not found | You sent a local Ollama tag | Use uncensored |
429 with concurrency | Too many requests at once, often open streams | Limit parallel calls to 8 (2 on a trial key) and close abandoned streams |
429 with rate_limited | More than 300 requests per minute (60 on trial) | Queue and pace requests |
| Reply ends mid-sentence | Your max_tokens was too low | Raise it, or remove it |
Failed requests are not charged, so debugging these does not drain credit. Before you move real traffic, run a short pre-flight: send one request with a tiny prompt and check the X-Balance-USD header, send one streamed request and confirm that the last chunk carries usage, then trigger a deliberate 401 with a wrong key to see how your code reports it. Finally, run your concurrency setting at 8 parallel calls (2 on a trial key) and watch that none of them returns a 429. Ten minutes on this list catches most integration mistakes before users see them. Chat front ends that let you add an OpenAI-compatible endpoint, such as SillyTavern, use the same three values: the base URL, the key and the model name. The request ID in the X-Request-Id header helps when you contact support.
For a feel of monthly spend, suppose a hobby bot handles 5,000 conversations, each a single call of 1,000 input and 300 output tokens. Input is 5M tokens, so $0.75. Output is 1.5M tokens, so $0.75. The month costs $1.50. A basic retry wrapper keeps limit errors from reaching the user:
import time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.ollamaabliterated.com/v1", api_key="YOUR_KEY", max_retries=0)
def ask(messages):
for attempt in range(5):
try:
return client.chat.completions.create(model="uncensored", messages=messages)
except RateLimitError as e:
time.sleep(float(e.response.headers.get("Retry-After", 2 ** attempt)))
raise RuntimeError("still rate limited")