Quickstart: Uncensored Text API for Image Pipelines
Integrate an uncensored LLM into your image generation pipeline with this OpenAI-compatible quickstart. Use the provided endpoints to generate, refine, or post-process text without content filters.
https://api.imagegenapi.com/v1uncensored
Base URL & Authentication
Our API follows the standard OpenAI chat-completions structure. To begin, navigate to the Get API key page and sign up with an email and password. The API key is displayed immediately. No phone number or credit card is required for the trial, though prepaid credit is needed for sustained usage.
Set your base URL to https://api.imagegenapi.com/v1. Include your API key in the Authorization header as a Bearer token. This setup works with any OpenAI-compatible client library. The model identifier to use is uncensored, an open-weight model tuned to answer without refusals for lawful adult use.
Sending a Prompt
Send a standard chat.completions request to generate text. The API accepts a list of messages in the messages array. It returns a JSON object containing the completion. This is ideal for one-off prompt generation or metadata editing tasks where streaming is not required.
curl https://api.imagegenapi.com/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."}]
}'The request body includes the model field set to uncensored and your conversation history. The response contains the assistant's reply, which you can then feed into your image generation pipeline or use as a caption.
Python SDK Integration
For Python developers, use the official openai library. Configure the base_url and api_key to point to our service. This allows you to leverage familiar Python idioms while accessing our uncensored model.
from openai import OpenAI
client = OpenAI(base_url="https://api.imagegenapi.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)Initialize the client with your key and the correct base URL. Call chat.completions.create() with your messages. This approach is best for batch processing or when you need to parse the JSON response directly in your application logic. Remember that the model ID must be uncensored.
Node.js SDK Usage
Node.js developers can use the openai npm package. Set the baseURL to our endpoint. This is useful for server-side rendering or API gateways where you need to process text responses asynchronously.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.imagegenapi.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);Create the client instance with your API key and base URL. Invoke chat.completions.create() to get the text output. This method is suitable for generating scripts, captions, or extracting information from text before it is used in your image pipeline.
Streaming Responses
For real-time text generation, enable streaming by setting stream: true. The API returns a Server-Sent Events (SSE) stream, not a single JSON object. You must handle the delta chunks as they arrive to reconstruct the full message.
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)Iterate over the stream to display text incrementally. This is critical for applications where latency matters, such as live prompt editing or interactive chat interfaces. Each chunk contains a portion of the response, allowing you to render text as it is generated.
Rate Limits & Constraints
Each API key is limited to 300 requests per minute. The request body must not exceed 8 MB. If you exceed the limit, you will receive a 429 error. Regenerate your key if needed, which revokes the old one.
If your prepaid credit is exhausted, the API will reject requests. There is no free unlimited tier; you must top up with credit. The 401 error indicates an invalid or missing API key. Ensure your key is correctly set in the authorization header. The context window is 100,000 tokens for prompt plus completion.
What the API supports
The numbers below are the real limits of this API, not marketing. Compare them with what your app needs.
| Parameter | Details |
|---|---|
| Compatibility | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Model ID | uncensored |
| Base URL | https://api.imagegenapi.com/v1 |
| Authentication | Authorization: Bearer YOUR_KEY |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Max context | 100,000 tokens, input and output combined |
| SSE 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 |
| Max output | 16,000 tokens max; 2,048 if max_tokens is not set |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| JSON mode | JSON object mode via response_format json_object |
| Parallel requests | up to 8 in parallel per key |
| Requests per minute | 300 requests per minute per key |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Max body | 8 MB request body |
| Token prices | $0.25 per 1M input tokens · $1.00 per 1M output tokens |
| Payment | USDT (TRC20) or USDC (Base), any whole amount from $10 to $500 |
| How you pay | prepaid credit, charged by real token usage; errors and refusals are free |
| Volume bonus | +5% from $50, +10% from $100 |
| Credit expiry | no monthly fee; paid credit does not expire |
| Trial credit | $0.50 for 7 days, no card |
| Content | adult content allowed; sexual content involving minors is refused |
| Account | sign in with Google or with e-mail + password |
| Keys | one active key per account; a new key replaces the old one |
Errors and what to do
The type field is stable, the message is for humans. Errors cost nothing.
| Status | Type | Reason |
|---|---|---|
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 | 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 | 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
Is this the official OpenAI API?
No, it is an OpenAI-compatible API. We use our own uncensored model, not GPT-3.5 or GPT-4. The endpoint structure is identical, so existing OpenAI clients work with minimal configuration changes.
Does the API generate images or audio?
No, this is a text-only API. It generates text responses that can be used as prompts for image generation services. It does not produce images, audio, or video directly.
How do I handle streaming responses in Node.js?
Set <code>stream: true</code> in your request. The API returns an SSE stream. You must iterate over the stream to collect the <code>delta</code> chunks and reconstruct the full message. Do not expect a single JSON object.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Get API key