Ltx API: Prompts and scripts over one endpoint
Get your first text generation running in minutes with the ltx api. This quickstart covers authentication, basic requests, and streaming so you can integrate uncensored completions into your pipeline immediately.
Base URL & Authentication
Start by creating an account via the Get API key page. You can sign in with Google or use an email and password. No phone number is required. Once registered, your API key appears immediately. You may only have one active key per account; generating a new one replaces the old.
Use the base URL https://api.ltxapi.top/v1 with any OpenAI-compatible client. Pass your key in the Authorization header. The API serves one uncensored large language model with the id uncensored. It is an open-weight model tuned for lawful adult use, not GPT or Claude.
Your First Request
Send a standard chat completion request to generate text. The API accepts text input and returns text output. It does not generate images, audio, or video. Use the POST /v1/chat/completions endpoint with the model set to uncensored. You can control behavior with temperature, top_p, and stop sequences.
The request body includes a messages array with your prompt. The response contains the generated text in choices[0].message.content. Billing is prepaid by token usage. Errors and refusals do not consume credit.
Python SDK Integration
Use the official OpenAI Python SDK to interact with the endpoint. Configure the base URL and API key in your client initialization. This allows you to leverage existing code patterns for text generation.
Call chat.completions.create() with your messages and parameters. The SDK handles serialization and response parsing. You can request JSON mode by setting response_format to json_object. This is useful for structured data extraction or script generation.
Node SDK Integration
The Node.js SDK follows the same OpenAI-compatible structure. Initialize the client with your base URL and key. Use the chat.completions.create() method to send requests.
Handle the response asynchronously. The API supports function calling tools, allowing you to define custom functions for the model to invoke. This enables complex workflows where the model decides which action to take based on the input text.
Streaming Responses
Enable streaming by setting stream to true. The API returns chunks of text as they are generated. This reduces perceived latency for long outputs.
Each chunk contains partial content. The final chunk includes token usage statistics. This allows you to track input and output tokens in real time. Streaming is ideal for chat interfaces or real-time text processing pipelines.
Limits, Errors & Context
The context window is 100,000 tokens total. There is no separate output cap, and if max_tokens is unset, the response can run to the end of the window. You can send 300 requests per minute and 8 concurrent requests per key. The request body limit is 8 MB.
Common errors include 401 for invalid keys, 402 for insufficient credit, and 429 for rate limits. Credit is prepaid and never expires. Mistakes like double charges are fixed via the Support page. The API refuses sexual content involving minors.
cURL
curl https://api.ltxapi.top/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.ltxapi.top/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.ltxapi.top/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)Specs at a glance
One table with every limit, feature and price that applies to your key.
| Spec | Value |
|---|---|
| Protocol | OpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Model | uncensored |
| Authentication | Bearer token in the Authorization header |
| Base URL | https://api.ltxapi.top/v1 |
| 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 |
| JSON mode | JSON object mode via response_format json_object |
| Max output | 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 |
| Other parameters | temperature, top_p, stop, seed and the two penalties are passed through |
| Max body | 8 MB request body |
| Concurrency | up to 8 in parallel per key |
| Requests per minute | 300/min per key |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Price | input $0.15 / 1M tokens, output $0.50 / 1M tokens |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Credit expiry | no monthly fee; paid credit does not expire |
| Trial credit | $0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Volume bonus | +5% from $50, +10% from $100, +15% from $200 |
| Billing | prepaid credit, charged by real token usage; errors and refusals are free |
| Keys | one active key per account; a new key replaces the old one |
| Account | Google or e-mail and password |
| Content policy | uncensored for adults; the only hard rule: no sexual content involving minors |
Error reference
Errors come back as JSON with a stable type; failed and refused requests are not billed.
| Code | Type | Meaning |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | check the Authorization header or use your current key |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | refused by the content policy |
404 | not_found | unknown endpoint |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | over 300/min or 8 parallel — back off and retry |
503 | upstream_busy | temporary overload, retry shortly |
Questions and answers
How do I top up my credit?
Top up by crypto (USDT on TRC20, USDC on Base). Payments accept whole amounts from $20 to $500. Credits do not expire, and you receive bonus credit for larger top-ups.
What is the trial offer?
New accounts receive $0.50 of trial credit valid for 7 days. Claim this credit with one click on your API key page. No credit card is needed to start. This allows you to test the API before committing to prepaid credit.
Does the API generate images or video?
No. The ltx api is a text-only chat-completions API. It handles prompts, scripts, and text extraction for pipelines that may include image or video generation, but it does not produce media itself.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.