EN ▾

Uncensored Ollama API hosted, OpenAI-compatible

Ollama API Quickstart Guide

This guide provides the essential configuration for connecting to the uncensored LLM API. Use the standard OpenAI SDK to send requests to our hosted endpoint with minimal setup.

Base URL and Authentication Setup

Configure your client to point at our hosted endpoint. Set the base_url to https://api.apiollama.com/v1 and provide your key in the Authorization header. Authentication uses the standard Bearer scheme. You can generate a key via Google or email on the dashboard. The system creates one active key per account.

curl https://api.apiollama.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "list installed models"}]
  }'

Keep your key secure. If you need a fresh key, generate a new one in the dashboard and the old one becomes inactive immediately. No phone number is required for setup. This setup works with any OpenAI-compatible client.

POST /v1/chat/completions: Sending Requests

Send your first chat completion request using the standard endpoint. Specify the model ID as uncensored in the request body. The API accepts standard message arrays containing system, user, and assistant roles. This works with any SDK that supports the OpenAI format. Ensure you include the model field in every request.

from openai import OpenAI

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

Requests are processed through our servers. The model responds with generated text based on your prompt. You can adjust parameters like temperature or top_p to control randomness. The system returns a complete response object containing the generated content.

GET /v1/models: Listing Available Models

Query the models endpoint to verify available options. Send a GET request to /v1/models to list hosted models. The response includes the id field set to uncensored. This endpoint confirms your API key has valid permissions. It returns metadata about the model configuration.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.apiollama.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);

Use this call to debug connection issues. If the endpoint returns an error, check your authentication header. The endpoint provides a simple list of available models. You can verify the service status without sending a full chat request.

Streaming Responses with Server-Sent Events

Enable streaming by setting the stream parameter to true. The API returns Server-Sent Events (SSE) for real-time token delivery. Each chunk contains partial content updates. The final chunk includes the complete token usage statistics. This reduces perceived latency for long responses.

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)

Handle the SSE stream in your client code. Process each event as it arrives. The last event contains the usage object with input and output token counts. Streaming works with all supported parameters. It provides immediate feedback for interactive applications.

Configuration Parameters: Temperature, Top-p, and More

Adjust generation behavior using standard parameters. Set temperature for randomness and top_p for nucleus sampling. Use stop sequences to halt generation early. The seed parameter ensures reproducible results. You can also set presence_penalty and frequency_penalty for style control.

JSON mode is available via response_format. Set this to json_object for structured outputs. The model adheres to the specified format. These parameters apply to all requests. Use them to fine-tune the response style.

Error Handling and Token Usage Reporting

Handle common HTTP errors in your application. A 401 status indicates an invalid API key. A 402 status means your prepaid credit is exhausted. A 429 status signals that you have exceeded the rate limit. Check the response body for detailed error messages. Refusals due to content policy are free.

The context window supports 100,000 tokens total. Output is limited to 16,000 tokens per request. Default output is 2,048 tokens if max_tokens is unset. Token usage is reported in the final stream chunk. Errors do not consume credit.

Common questions

What is the ollama API URL for the hosted service?

The base URL is HTTPS://api.apiollama.com/v1. This endpoint is compatible with standard OpenAI SDKs. You only need to update the base URL and API key in your configuration.

Does the uncensored LLM support streaming?

Yes, streaming is supported via Server-Sent Events. Set the stream parameter to true in your request. The final chunk includes token usage statistics for billing transparency.

What are the context window limits?

The model supports a 100,000 token context window. Maximum output is 16,000 tokens per request. If you do not set max_tokens, the default output is 2,048 tokens.

Get your key instantly

Register, copy the credential, update the endpoint. That is it.

Claim trial key