Quickstart for Ornith users
Integrate with Ornith's uncensored LLM API in under five minutes using standard OpenAI SDKs. This quickstart covers authentication, basic completions, streaming, and function calling with our single-purpose model.
Prerequisites and Base URL
To begin, you need an API key and the official OpenAI SDK for your preferred language. Visit the Get API key page to create an account using Google or email. Your key is displayed immediately and works with the standard OpenAI-compatible endpoint. The base URL for all requests is https://api.ornith.cc/v1. Ensure your environment variables or SDK configuration point to this URL rather than the default OpenAI endpoint. This ensures your requests are routed to Ornith's uncensored model infrastructure without requiring code changes beyond the base URL and key.
Authentication
Authentication is handled via the standard Authorization header. Include your API key in the format Bearer YOUR_API_KEY. If the key is invalid or missing, the API returns a 401 Unauthorized error. You can generate a new key at any time from your dashboard; the previous key is invalidated immediately upon creation of a new one. Each account is limited to one active key at a time, simplifying credential management for individual developers and small teams.
Basic Completion Request
The core functionality is served by the POST /v1/chat/completions endpoint. This endpoint accepts standard chat completion parameters including model, messages, and max_tokens. The model ID to use is uncensored. Requests are processed sequentially unless you manage concurrency externally. Below is a basic example using cURL to send a prompt and receive a text response.
Python SDK Integration
Using the Python OpenAI SDK is the most straightforward path for most developers. Initialize the client with your API key and the Ornith base URL. The SDK handles serialization and response parsing automatically. You can set parameters like temperature and top_p to control randomness. This approach allows you to leverage existing OpenAI codebases with minimal modification, swapping only the base URL and model identifier.
Node SDK Integration
For JavaScript and TypeScript developers, the openai npm package works identically. Configure the apiKey and baseURL properties in the client instance. The Node SDK supports both synchronous and asynchronous calls. Ensure you handle asynchronous responses correctly using await or promises. This integration path is ideal for serverless functions or Node-based backends where you need to integrate LLM outputs into existing data pipelines.
Streaming Responses
Enable streaming by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream. Each chunk contains a partial delta of the response. The final chunk includes the complete token usage statistics for the request. Streaming is essential for real-time user experiences, allowing you to display tokens as they are generated rather than waiting for the full completion. This reduces perceived latency significantly for long responses.
Function Calling and JSON Mode
The API supports function_calling (tools) and json_mode for structured outputs. For function calling, define your tools in the tools parameter and set tool_choice as needed. The model will return tool calls in the response format. For strict JSON output, set response_format to {"type": "json_object"}. This ensures the model returns valid JSON, which is critical for programmatic consumption. Note that function calling and JSON mode are features of the underlying uncensored model, not the SDK.
Limits, Errors, and Context Window
The context window supports up to 100,000 tokens (prompt + completion). If max_tokens is not specified, the response can run to the end of the window. Rate limits are set to 300 requests per minute and 8 concurrent requests per key. If you exceed these limits, you will receive a 429 Too Many Requests error. Other common errors include 402 Payment Required if your prepaid credit is exhausted, and 400 Bad Request for invalid parameters. Errors do not consume credit, ensuring you only pay for successful completions.
cURL
curl https://api.ornith.cc/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.ornith.cc/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.ornith.cc/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)Questions and answers
How does billing work for errors?
Errors such as rate limits (429), authentication failures (401), or insufficient funds (402) do not consume your prepaid credit. You are only charged for tokens successfully generated in completed requests.
Can I use multiple API keys simultaneously?
No, each account is limited to one active API key at a time. Generating a new key automatically invalidates the previous one. This simplifies security management and ensures clear attribution for token usage.
What is the maximum output length?
There is no separate output cap. If you do not specify max_tokens, the response can run to the end of the window. The total context window, including the input prompt, is 100,000 tokens.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Under the hood: specs
Before you integrate, here is exactly what you get with a key.
| Parameter | Details |
|---|---|
| API format | OpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key |
| Endpoints | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.ornith.cc/v1 |
| Model ID | uncensored |
| Authentication | Bearer token in the Authorization header |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Context window | 100,000 tokens, input and output combined |
| Function calling | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| Completion length | up to the rest of the 100,000-token window; max_tokens optional (no separate cap) |
| Streaming | Supported (stream: true), usage included at the end |
| Structured output | response_format: {"type": "json_object"} |
| Parallel requests | up to 8 in parallel per key |
| Requests per minute | 300/min per key |
| Max body | 8 MB request body |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Top-up | USDT (TRC20) or USDC (Base), any whole amount from $20 to $500 |
| Bonus credit | +5% on $50+, +10% on $100+, +15% on $200+ |
| Token prices | input $0.15 / 1M tokens, output $0.50 / 1M tokens |
| 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 |
| How you pay | prepaid credit, charged by real token usage; errors and refusals are free |
| Subscription | paid credit never expires, no subscription |
| Keys | one active key per account; a new key replaces the old one |
| Content policy | uncensored for adults; the only hard rule: no sexual content involving minors |
| Account | Google or e-mail and password |
Errors and what to do
The type field is stable, the message is for humans. Errors cost nothing.
| HTTP | Type | What to do |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | no key, wrong key, or a key replaced by a newer one |
402 | no_credit | out of credit; add credit and retry |
403 | content_blocked | refused by the content policy |
404 | not_found | only /v1/chat/completions and /v1/models exist |
413 | request_too_large | request body larger than 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | model busy — retry in a few seconds |