Quickstart for Ltx pipelines
Integrate the Ltx API into your pipeline by pointing your OpenAI-compatible SDK to our base URL. Use the uncensored 'uncensored' model for text completion, function calling, and structured JSON outputs without content refusals.
Base URL and Authentication
Configure your client to target https://api.ltxapi.cc/v1. Authentication relies on a single API key per account, generated via the dashboard using Google or email credentials. Pass this key in the Authorization header as a bearer token. Unlike services offering multiple keys, this API enforces one active key per account; generating a new key immediately revokes the previous one. This simplifies key rotation and audit trails for automation pipelines.
First Request
Send a standard chat completion request to test connectivity and token pricing. The endpoint accepts standard OpenAI payload structures. Ensure you specify the model ID as "uncensored" to access the tuned model. The API returns raw text responses without filtering lawful adult or controversial topics, making it suitable for creative writing or data extraction tasks where refusals are common.
curl https://api.ltxapi.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 SDK Integration
Use the official OpenAI Python library by overriding the base URL. This ensures compatibility with existing codebases while leveraging the Ltx uncensored model. Initialize the client with your API key and the custom base URL. This approach allows you to use standard methods like chat.completions.create without rewriting your integration logic. The SDK handles serialization and response parsing automatically.
from openai import OpenAI
client = OpenAI(base_url="https://api.ltxapi.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 SDK Integration
For JavaScript environments, configure the OpenAI Node SDK to point to our base URL. This enables seamless integration into Node.js pipelines for serverless functions or backend services. Set the apiKey and baseURL properties during initialization. The SDK supports standard completion calls, allowing you to replace OpenAI's endpoint with the Ltx API for uncensored text generation.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.ltxapi.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 Responses
Enable streaming by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream of token chunks. Each chunk includes usage statistics in the final event, allowing you to track token consumption in real-time. This is essential for applications displaying text progressively or requiring immediate partial results. Ensure your client handles SSE events correctly to avoid memory leaks.
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)
Rate Limits and Constraints
The API enforces strict limits to ensure stability. Each key is limited to 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. Errors include 401 for invalid keys, 402 for insufficient credit, and 429 for rate limits. Credit is charged only for successful token usage; errors and refusals are free. The context window is 100,000 tokens total, with no separate output cap per request.
API facts in one table
If your tool speaks the OpenAI API, these are the details that matter.
| Feature | Support |
|---|---|
| Compatibility | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Endpoints | POST /v1/chat/completions · GET /v1/models |
| Model | uncensored |
| Authentication | Authorization: Bearer YOUR_KEY |
| Base URL | https://api.ltxapi.cc/v1 |
| Max output | prompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap |
| Streaming | Yes — server-sent events; the last chunk carries token usage |
| Tools / tool calls | 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 |
| Context window | 100,000 tokens, input and output combined |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Requests per minute | 300/min per key |
| Concurrency | 8 requests at the same time per key |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Max body | 8 MB request body |
| Billing | prepaid credit, charged by real token usage; errors and refusals are free |
| Free trial | $0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Price | $0.15 per 1M input tokens · $0.50 per 1M output tokens |
| Top-up | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Subscription | paid credit never expires, no subscription |
| Volume bonus | +5% on $50+, +10% on $100+, +15% on $200+ |
| Content policy | adult content allowed; sexual content involving minors is refused |
| Account | sign in with Google or with e-mail + password |
| Key management | one active key per account; a new key replaces the old one |
Errors and what to do
Every error is JSON with a type you can switch on. You are never charged for an error.
| Code | Type | Meaning |
|---|---|---|
400 | bad_request | invalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend |
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 | sexual content involving minors — refused, not billed |
404 | not_found | unknown endpoint |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | model busy — retry in a few seconds |
Questions and answers
How many API keys can I generate?
You can have only one active API key per account. Generating a new key immediately invalidates the previous one. This design simplifies key management for individual developers and small automation pipelines.
Does the API support function calling?
Yes, the API supports function calling via the tools parameter. You can define tools in the standard OpenAI format, and the model will return structured tool calls in the response. This enables complex workflows where the model triggers external actions based on user input.
What happens if I exceed the rate limit?
The API returns a 429 status code when you exceed 300 requests per minute or 8 concurrent requests. Your credit is not charged for these requests if they are rejected due to rate limits. Implement exponential backoff in your client to handle retries efficiently.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.