EN ▾
Get API key

Quickstart for Ollama NSFW users

Get your first response in minutes by pointing any OpenAI-compatible SDK to our hosted endpoint. This quickstart covers authentication, basic chat, streaming, and function calling with our uncensored model.

Prerequisites and Authentication

You need an API key and the base URL to start. Sign up on the Get API key page using Google or email. Your key appears immediately; no card is required for the trial. The base URL is https://api.ollamansfw.com/v1. Set this in your environment or SDK config. The model identifier is uncensored. It is an open-weight model running on our servers, distinct from GPT or other vendor models.

Your First Request

Send a standard chat completion request. The API expects a messages array with a role and content. Use curl to test connectivity. Replace YOUR_API_KEY with your actual key. The response returns the generated text in choices[0].message.content. If you get a 401, check your key. A 402 means you need credit.

Python SDK Integration

Use the official openai Python package. Install it via pip. Configure the client with the custom base URL and API key. This ensures compatibility with our endpoint. The code below demonstrates a simple text generation. It handles the request and prints the result. Error handling should catch HTTP exceptions. This approach works for any OpenAI-compatible client.

Node.js SDK Integration

Install the openai Node.js package. Set the base URL and API key in the client initialization. The structure mirrors the Python example. Pass the model ID uncensored. The response contains the completion data. Use async/await for clean code. This method is ideal for server-side applications or CLI tools that need direct API access.

Streaming Responses

Enable streaming by setting stream: true. The API returns a server-sent events (SSE) stream. Each chunk contains partial text. The final chunk includes token usage statistics. This reduces perceived latency for long responses. Handle stream errors gracefully. The SDKs provide built-in stream iterators. Process each chunk to update the UI in real time.

Limits, Errors, and Context

The context window is 100,000 tokens total. Output can run to the end of the window. Rate limits are 300 requests per minute. Concurrent requests are limited to 8 per key. Request bodies must be under 8 MB. Common errors: 401 (invalid key), 402 (insufficient credit), 429 (rate limit). Errors do not consume credit. Refusals for unlawful content are free. Credit never expires.

cURL

curl https://api.ollamansfw.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.ollamansfw.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.ollamansfw.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)

Capabilities and limits

One table with every limit, feature and price that applies to your key.

FeatureSupport
API formatOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
EndpointsPOST /v1/chat/completions · GET /v1/models
API keyAuthorization: Bearer YOUR_KEY
Modeluncensored
Base URLhttps://api.ollamansfw.com/v1
Completion lengthprompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap
Context window100,000 tokens, input and output combined
Sampling parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
JSON moderesponse_format: {"type": "json_object"}
Tools / tool callsSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
SSE streamingSupported (stream: true), usage included at the end
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Rate limit300 requests per minute per key
Max bodyup to 8 MB per request
Parallel requests8 requests at the same time per key
Paymentcrypto: USDT on TRON or USDC on Base, $20–$500, any whole sum
How you paypay as you go from prepaid credit; nothing is charged for failed or refused requests
Volume bonus+5% from $50, +10% from $100, +15% from $200
Credit expirypaid credit never expires, no subscription
Trial credit$0.50 of credit valid 7 days, no card needed · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up
Token pricesinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Sign-inGoogle or e-mail and password
Contentadult content allowed; sexual content involving minors is refused
Key managementone active key per account; a new key replaces the old one

Error codes

Errors come back as JSON with a stable type; failed and refused requests are not billed.

StatusTypeReason
400bad_requestmalformed request or too long for the context window
401missing_key · invalid_key · key_revokedno key, wrong key, or a key replaced by a newer one
402no_creditout of credit; add credit and retry
403content_blockedrefused by the content policy
404not_foundunknown endpoint
413request_too_largebody over 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busymodel busy — retry in a few seconds

Questions and answers

Is this the official Ollama API?

No, this is an independent hosted API. We serve our own uncensored model via an OpenAI-compatible endpoint. It is not affiliated with Ollama, though it uses similar conventions.

How do I top up credit?

Top up using USDT (TRC20) or USDC (Base). Minimum amount is $20. Bonuses apply for larger deposits. Credit is charged by real token usage. Errors and refusals are free.

What is the context window size?

The total context window is 100,000 tokens for prompt and completion combined. If max_tokens is unset, the response can run to the end of the window.