Quickstart: Connect Your Client
Connect your existing OpenAI-compatible client to our uncensored Chinese LLM API by updating the base URL and API key. This quickstart covers authentication, chat completions, streaming, and tool calling with concrete examples.
- Base URL
- https://api.chinesellmapi.com/v1
- Model
- uncensored
Base URL & Authentication
Our API follows the standard OpenAI format, allowing you to switch providers by changing only two variables: the base URL and the API key. You can obtain a key by signing up on the Get API key page with just an email and password. No credit card is required for the trial, and keys can be regenerated instantly if compromised.
Use the base URL https://api.chinesellmapi.com/v1 in your client configuration. The model ID you must send is uncensored. This is an open-weight model running on our dedicated infrastructure, distinct from GPT, Claude, or other vendor models. It is tuned to answer without content refusals for lawful adult use.
Chat Completions Endpoint (POST /v1/chat/completions)
Send text in and receive text out using the standard chat completions endpoint. This endpoint supports both non-streaming and streaming responses, as well as tool/function calling. You must include the model field set to uncensored in your request body.
Requests are limited to 8 MB in body size. If you exceed the 100,000 token context window (prompt + completion), the API will reject the request. Ensure your client handles standard HTTP responses correctly.
- Input: JSON body with
messagesarray. - Output: JSON with
choicescontainingmessage.content.
Make your first request with this example:
curl https://api.chinesellmapi.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."}]
}'
Python SDK Integration
Using the official OpenAI Python SDK is the most straightforward way to integrate. Install the package via pip and configure the client to point to our base URL. This approach works seamlessly with any library built on the OpenAI Python client.
Remember that our model is not GPT-4 or any other vendor model. It is an uncensored model. Adjust your prompt engineering accordingly, as the model may have different stylistic tendencies compared to other models.
Here is how to initialize the client and send a request:
from openai import OpenAI
client = OpenAI(base_url="https://api.chinesellmapi.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)
Node.js SDK Integration
For JavaScript or TypeScript projects, the openai npm package works with minor configuration changes. Set the baseURL to our API endpoint and provide your API key. This ensures compatibility with existing codebases that expect OpenAI-standard responses.
The response structure remains identical to the OpenAI format, including id, object, created, and choices fields. This makes it easy to swap in our uncensored model for testing or production without rewriting your data parsing logic.
Configure and call the API:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.chinesellmapi.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);
Streaming Responses (SSE)
Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE) containing incremental chunks of the response. This is ideal for user interfaces that need to display text in real-time as it is generated.
Each chunk contains partial content in delta.content. Handle these chunks incrementally in your client to update the UI. The stream ends when the final chunk is received with finish_reason set to stop or tool_calls.
Example streaming implementation:
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, Errors & Constraints
Monitor your usage to avoid interruptions. Each API key is limited to 300 requests per minute. If you exceed this, you will receive a 429 Too Many Requests error. Request bodies must not exceed 8 MB. The context window is strictly 100,000 tokens for prompt plus completion combined.
Common errors include:
- 401 Unauthorized: Invalid or missing API key.
- 402 Payment Required: Insufficient prepaid credit.
- 429 Rate Limit: Exceeded 300 requests per minute.
Pricing is transparent: $0.25 per 1M input tokens and $1.00 per 1M output tokens. Credits do not expire. Use the GET /v1/models endpoint to verify available models, though only uncensored is offered for chat completions.
Technical reference
A quick checklist for developers: format, limits, features, billing.
| Spec | Value |
|---|---|
| Protocol | OpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key |
| Model ID | uncensored |
| Authentication | Authorization: Bearer YOUR_KEY |
| Endpoints | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.chinesellmapi.com/v1 |
| Context window | 100,000 tokens (prompt + completion together) |
| Function calling | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| Other parameters | temperature, top_p, stop, seed and the two penalties are passed through |
| Max output | 16,000 tokens max; 2,048 if max_tokens is not set |
| SSE streaming | Supported (stream: true), usage included at the end |
| JSON mode | JSON object mode via response_format json_object |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Rate limit | 300 requests per minute per key |
| Parallel requests | up to 8 in parallel per key |
| Max body | 8 MB request body |
| Subscription | no monthly fee; paid credit does not expire |
| Token prices | input $0.25 / 1M tokens, output $1.00 / 1M tokens |
| Payment | crypto: USDT on TRON or USDC on Base, $10–$500, any whole sum |
| Free trial | $0.50 for 7 days, no card |
| Billing | pay as you go from prepaid credit; nothing is charged for failed or refused requests |
| Volume bonus | +5% from $50, +10% from $100 |
| Account | Google or e-mail and password |
| Content | adult content allowed; sexual content involving minors is refused |
| Key management | one key per account, regenerate any time (the old one stops working) |
When a request fails
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 | 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 | temporary overload, retry shortly |
Questions and answers
Is this model GPT-4 or another OpenAI model?
No. The model ID is <code>uncensored</code>, a single uncensored model, served directly with no routing between vendors. It is not GPT-4, Claude, or any other vendor model. It responds without refusals to lawful adult content.
Do you retain my data for training?
No. Prompts sent to the API are not used for training your model. Your account requires only an email and password, ensuring minimal data collection.
What happens if I exceed the rate limit?
You will receive a 429 status code. The limit is 300 requests per minute per API key. You can regenerate your key or wait for the window to reset. There are no monthly fees; you pay only for what you use.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.