Ollama endpoint API Documentation

Start building with the uncensored LLM API in seconds. This guide covers the base URL, authentication, and SDK integration for your OpenAI compatible API workflows.

Base URL and Authentication

Use the provided base URL and an API key for every request. The endpoint is https://api.ollamaendpoint.com/v1Authorization header as a Bearer token. You generate this key immediately after logging in with Google or email. The key is unique per account and replaces any previous active key.

First Request

Send a standard chat completion to generate text. The model ID is uncensored and accepts the same parameters as standard OpenAI clients. This works for NSFW LLM tasks or unrestricted content generation.

  • Method: POST
  • Endpoint: /v1/chat/completions
  • Model: uncensored
curl https://api.ollamaendpoint.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Get the local ip address of this machine"}]
  }'

A successful response returns the generated text in the choices array. Check the usage field to see token counts.

Python SDK Integration

Install the official OpenAI library and configure the base URL. This allows you to use the uncensored ollama model with familiar Python code. Set the base_url and api_key before initializing the client. The code remains compatible with existing OpenAI SDKs.

from openai import OpenAI

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

Call the chat.completions.create method just like you would for GPT. The response structure matches standard expectations. You can stream or get full responses.

Node SDK Integration

Use the Node.js OpenAI package to interact with the API. Configure the client with the custom base URL and your API key. This approach works for server-side applications or edge functions. The package handles serialization and retries automatically.

import OpenAI from "openai";

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

Invoke the completion endpoint with your prompt. The library returns a promise that resolves to the response object. Handle errors according to standard HTTP status codes.

Streaming Responses with SSE

Enable streaming by setting stream: true in your request. The server returns a Server-Sent Events (SSE) stream. Each chunk contains partial text and token usage data. The final chunk includes the complete usage statistics for billing. This reduces perceived latency for long outputs.

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)

Accumulate the content parts from each chunk to reconstruct the full response. Process errors as they arrive in the stream. The last chunk confirms the token count for your prepaid credit.

Rate Limits and Constraints

Each API key supports 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. The context window is 100,000 tokens for prompt and completion combined. Output limits are 16,000 tokens per request. Errors and refusals do not consume credit. A 401 error means your key is invalid. A 402 error indicates insufficient prepaid credit. A 429 error means you hit the rate limit. Adjust your concurrency to stay within limits.

FAQ

What is the base URL for the ollama endpoint?

The base URL is HTTPS://api.ollamaendpoint.com/v1. Use this for all API calls. It is compatible with standard OpenAI clients.

How do I handle streaming responses?

Set the stream parameter to true. The API returns Server-Sent Events. Process each chunk to build the final text. The last chunk includes usage data.

What happens if I hit a rate limit?

You receive a 429 status code. The limit is 300 requests per minute per key. Reduce your concurrency or wait before retrying. Concurrent requests are capped at 8.

Get your API key

Sign up, grab the key, point to the new base URL. Done.

Start now