EN ▾

Text API quickstart

Get started with our uncensored text API in minutes. Use any OpenAI-compatible SDK to generate prompts, scripts, or captions for your image and speech pipelines.

Base URL and Authentication

Our API follows the standard OpenAI chat-completions format. You interact with the service using the base URL https://api.qwenimageapi.top/v1. Authentication is handled via a Bearer token in the Authorization header. You obtain this key immediately after signing up with Google or email on the Get API key page. Ensure you copy the key exactly as displayed; it is only shown once.

First Request

Send a basic completion to test connectivity. Use the model ID uncensored to ensure content filters do not block lawful adult, creative, or controversial topics. The API returns text directly. If you need structured output, see JSON Mode below.

curl https://api.qwenimageapi.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."}]
  }'

Check the response for choices[0].message.content. This confirms your key works and credits are deducted correctly.

Python SDK Integration

Use the official openai Python package. Point it to our base URL and pass your key. This works with any Python project generating text for image prompts or speech scripts.

from openai import OpenAI

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

The SDK handles JSON serialization automatically. Remember that the model ID must be uncensored.

Node.js SDK Usage

For JavaScript or TypeScript pipelines, install the OpenAI Node SDK. Configure the base URL and API key similarly to the Python example. This is ideal for web servers processing text before sending it to image or speech generators.

import OpenAI from "openai";

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

The response object contains the generated text in response.choices[0].message.content.

Streaming Responses

Enable streaming by setting stream: true. The API returns Server-Sent Events (SSE). Each chunk contains partial text. Token usage metrics appear in the final chunk. This reduces perceived latency for long prompt generation.

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)

Consume chunks sequentially. Do not ignore the final chunk, as it contains usage data.

Limits, Errors, and Context

Each key allows 300 requests per minute and 8 concurrent requests. The request body must stay under 8 MB. If your key is invalid, you receive a 401 error. If you have no credit, you get a 402 error. Rate limits return a 429. The context window is 100,000 tokens total. The response can run to the end of the window. Errors and refusals do not consume credit. Credit never expires. Only sexual content involving minors is strictly blocked. No other content is refused for lawful use.

API facts in one table

If your tool speaks the OpenAI API, these are the details that matter.

ItemValue
ProtocolOpenAI Chat Completions schema; official openai SDKs work unchanged
MethodsPOST /v1/chat/completions · GET /v1/models
Modeluncensored
AuthenticationBearer token in the Authorization header
Base URLhttps://api.qwenimageapi.top/v1
Max outputup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Structured outputresponse_format: {"type": "json_object"}
Function callingYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
Context window100,000 tokens (prompt + completion together)
SSE streamingSupported (stream: true), usage included at the end
Sampling parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
Rate limit300/min per key
Request sizeup to 8 MB per request
Response headersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Parallel requests8 requests at the same time per key
Token pricesinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Free trial$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
Volume bonus+5% from $50, +10% from $100, +15% from $200
PaymentUSDT (TRC20) or USDC (Base), any whole amount from $20 to $500
Billingprepaid credit, charged by real token usage; errors and refusals are free
Credit expirypaid credit never expires, no subscription
Content policyuncensored for adults; the only hard rule: no sexual content involving minors
Key managementone active key per account; a new key replaces the old one
AccountGoogle or e-mail and password

When a request fails

The type field is stable, the message is for humans. Errors cost nothing.

HTTPTypeWhat to do
400bad_requestmalformed request or too long for the context window
401missing_key · invalid_key · key_revokedcheck the Authorization header or use your current key
402no_creditout of credit; add credit and retry
403content_blockedsexual content involving minors — refused, not billed
404not_foundunknown endpoint
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busymodel busy — retry in a few seconds

Questions and answers

What happens if I make a mistake with my request?

Errors like invalid JSON or bad parameters do not consume your prepaid credit. You can retry as needed without cost. If you experience a double charge, contact Support via the dashboard.

Can I use this for image generation directly?

No. This API only generates text. It is designed to create prompts, captions, or scripts that you then feed into an image or speech generator. It does not return images or audio.

How do I top up my credit?

Top up using crypto only: USDT (TRC20) or USDC (Base). Minimum top-up is $20, maximum is $500. Payments are processed on-chain. No credit cards or PayPal are accepted.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API keyRead the docs