Base URL and Authentication
Use the provided base URL and a valid API key to connect your client. The endpoint is https://api.qwencodeapikey.com/v1. You must include your key in the Authorization header of every request. This ensures the service identifies your prepaid credit account correctly.
curl https://api.qwencodeapikey.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Check my api key validity status"}]
}'
You can generate a key via Google or email on the signup page. The key appears immediately. Keep it secure, as it controls your spending.
Chat Completions Endpoint
Send messages to the /v1/chat/completions endpoint to get text responses. This is the standard interface for most OpenAI SDKs. You define the model as uncensored and provide a list of messages in the messages array. The API processes your input and returns a generated completion.
from openai import OpenAI
client = OpenAI(base_url="https://api.qwencodeapikey.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)
Ensure your client library points to the correct base URL. The model ID uncensored triggers the open-weight model tuned for fewer refusals. It handles conversational turns just like any other chat API.
Models Endpoint
Query GET /v1/models to verify available models and their details. This endpoint returns a list of models accessible to your key. It helps you confirm the uncensored model is active and ready for requests. Use this for debugging client configurations before sending full payloads.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.qwencodeapikey.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);
Check the response structure to ensure your SDK parses the model list correctly. This endpoint does not consume credit, making it safe for initialization checks.
Request Parameters and Streaming
Support standard parameters like temperature, top_p, stop, and seed. Enable streaming by setting stream: true. The API sends tokens via Server-Sent Events (SSE). Token usage statistics appear in the final chunk of the stream. This allows real-time display of generated text.
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)
Set max_tokens to control output length. The default is 2,048 tokens. You can increase this up to 16,000 tokens per request. Adjust parameters to balance creativity and precision in your responses.
Rate Limits and Constraints
Each key allows 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. These limits prevent abuse and ensure stable performance. If you exceed the rate, you receive a 429 error. Adjust your client logic to handle retries with exponential backoff.
The context window supports 100,000 tokens total. This includes both prompt and completion. Large contexts require careful token management to stay within limits.
JSON Mode and Function Calling
Use response_format: {"type": "json_object"} for structured output. This ensures the model returns valid JSON, useful for programmatic integration. Function calling works via the tools parameter. Define tools in the standard OpenAI format. The model will call functions as needed.
Errors and refusals do not consume credit. This applies even if the model refuses a request due to the hard content limit. You only pay for actual token usage. Credit never expires, so you can top up when convenient.
Error Handling and Usage
Handle HTTP errors gracefully. A 401 error indicates an invalid or expired API key. A 402 error means your prepaid credit is exhausted. A 429 error signals rate limit exceeded. Check the response body for detailed error messages.
Usage is tracked per key. One active key per account simplifies billing. If you make a mistake, such as a double charge, use the Support page. Credit is not refunded but remains valid. Errors are free, so failed requests do not drain your balance.
Summary and Best Practices
Start with the base URL and a valid key. Use the uncensored model ID for fewer refusals. Stream responses for better user experience. Monitor rate limits to avoid interruptions. Use JSON mode for structured data. Handle errors to maintain reliability. Credit is prepaid and never expires. Top up with crypto when needed. This API fits seamlessly into existing OpenAI codebases. No new SDKs required. Just change the base URL and key.