Qwen API Base URL: What to Use and How to Set It
One string decides whether your client reaches this API or fails with a 404: the base URL. Here is the exact value, where it goes in each SDK, and the mistakes that break it.
Updated
Key points
- The base URL is https://api.qwenapi.top/v1 and the model ID is uncensored.
- SDKs append /chat/completions themselves, so never paste the full endpoint path as the base.
- A GET request to /models is the fastest way to confirm the URL and key are right.
- This is an independent service, not the official endpoint of Alibaba or any other vendor.

The base URL in one line
If you are searching for the qwen api base url to plug into an OpenAI-style client, the value for this service is https://api.qwenapi.top/v1. Put that in the field your tool calls "base URL", "API base" or "endpoint", add your key as a Bearer token, and set the model name to uncensored. That is the whole configuration.
One clarification before the details. This site is an independent provider. It runs one open-weight model that is tuned to answer without content refusals for lawful adult use. It is not the official endpoint of Alibaba, Qwen or any other model vendor, and it does not route requests to other vendors. If a tutorial tells you to use a vendor's own hostname, that hostname belongs to the vendor and will not accept a key issued here. For the longer story on what the model is and how it compares, see the integration guide.
Two methods are available under that base: POST /v1/chat/completions and GET /v1/models. There is no image, audio, embeddings or fine-tuning endpoint, so a client that asks for one will get an error from the server, not from your configuration.
How a base URL becomes a request
An OpenAI-compatible SDK never sends a request to the base URL itself. It joins the base URL with a fixed path for each operation. For a chat call, the path is /chat/completions. For a model list, it is /models. So your base URL should stop right before that path, and it should include the /v1 segment.
| What you enter as base URL | What the SDK requests | Result |
|---|---|---|
https://api.qwenapi.top/v1 | https://api.qwenapi.top/v1/chat/completions | Works |
https://api.qwenapi.top/v1/ | Same, most SDKs trim the slash | Works in most clients |
https://api.qwenapi.top | https://api.qwenapi.top/chat/completions | 404, the /v1 is missing |
https://api.qwenapi.top/v1/chat/completions | .../chat/completions/chat/completions | 404, path doubled |
https://api.qwenapi.top/v1/v1 | .../v1/v1/chat/completions | 404, usually a copy and paste slip |
Some GUI tools behave differently and ask for the complete endpoint instead of a base. If a field is labelled "Chat completions URL" or "Full endpoint", paste the long form. If it is labelled "API base" or "Base URL", paste the short form. When the label is unclear, try the short form first, then use the table above to read the error.
Setting it in Python, Node and curl
The Python SDK takes the base URL as a constructor argument. Create the key on the API key page and keep it in an environment variable rather than in source code.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.qwenapi.top/v1",
api_key=os.environ["QWENAPI_KEY"],
)
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(resp.choices[0].message.content)
Node works the same way. The option is called baseURL with a capital URL, which trips people up when they translate from Python.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.qwenapi.top/v1",
apiKey: process.env.QWENAPI_KEY,
});
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(resp.choices[0].message.content);
With curl you write the full URL yourself, so the path is explicit and the base is only the prefix.
curl https://api.qwenapi.top/v1/chat/completions \
-H "Authorization: Bearer $QWENAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "uncensored", "messages": [{"role": "user", "content": "Say hello in five words."}]}'
Using environment variables instead of code
Both official OpenAI SDKs read OPENAI_BASE_URL and OPENAI_API_KEY when you construct a client with no arguments. That is handy when you want to point an existing project at a different provider without touching the code. Many third-party tools built on those SDKs inherit the same behaviour.
export OPENAI_BASE_URL="https://api.qwenapi.top/v1"
export OPENAI_API_KEY="paste-your-key-here"
# the model name still has to be set in your app: "uncensored"
python my_app.py
The model name is the part people forget. An app that was written for another provider usually has a model string such as a vendor model name hard-coded or set in a config file. Replace it with uncensored. This service has a single model ID, so there is nothing to choose between and no list of variants to memorise.
Keep in mind that a variable set in one terminal tab does not exist in another, and that an IDE launched from your desktop launcher may not see variables you exported in a shell profile. If a tool still reports the wrong host, print the variable from inside the same process that runs the tool.
Check the URL before you debug anything else
The cheapest test is a model list. It sends no prompt, so it costs nothing and it tells you in one round trip that the host, path and key all line up.
curl -i https://api.qwenapi.top/v1/models \
-H "Authorization: Bearer $QWENAPI_KEY"
# expect HTTP 200 and a list that contains the model id: uncensored
The -i flag prints response headers. Look for X-Request-Id, which you can quote to support if something goes wrong, and X-Balance-USD, which shows your remaining credit. The rate-limit headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency tell you what your key is allowed to do. A full key gets 300 requests per minute and 8 concurrent requests. A trial key gets 60 per minute and 2 at once.
Once /models answers, a first chat call is the next step. The quick-start documentation walks through that request, streaming included.
Keeping the URL out of your code
Hard-coding a host in ten files is how a simple change becomes an afternoon of searching. Put the base URL in one place: a settings module, a .env file that is not committed, or your deployment platform's configuration. Read it once at startup and pass the same client object around. When the address or the key ever needs to change, you edit one line.
The same habit helps when you run more than one environment. A local machine, a staging server and production can each hold their own key, so a leaked development key never touches production traffic, and you can see in the account balance which environment is spending. Rotate a key by creating the new one, deploying it, and only then retiring the old one. Check the deployment really restarted: a long-running worker that read its settings at boot keeps using the old value until it restarts.
If your traffic passes through a corporate proxy or a gateway of your own, keep the upstream address in that gateway's configuration and give your applications the gateway's address as their base URL instead. The applications then never learn the provider's host, and you can swap providers in one place. The path layout stays the same, so the table above still applies to whatever address you hand out.
Fixing the errors you will actually see
404 Not Found
Nearly always a path problem. Compare your base against the table earlier: a missing /v1, a doubled path, or a typo in the host. Also check for a stray space or a smart quote that a word processor inserted into a pasted URL.
401 Unauthorized
The host is right and the key is not. Confirm the header reads Authorization: Bearer followed by a space and the key. Some tools have separate fields for "API key" and "organization"; leave the organization empty. Make sure you are not sending a key from another provider that was saved in the tool earlier.
429 with rate_limited or concurrency
The request reached the server and was refused for volume. The error code rate_limited means too many requests per minute. The code concurrency means too many requests at the same moment. A streamed request holds its slot until the stream ends, so a UI that opens many streams and never closes them will hit this quickly. A 429 with a Retry-After: 5 header means temporary overload, and waiting five seconds then retrying is the right response.
Connection errors or timeouts
Check that your network allows outbound HTTPS to the host, and that a corporate proxy is not rewriting it. For long generations, raise the client timeout rather than lowering the output size. The context window is 100,000 tokens in total, prompt and completion together.
Where each kind of tool puts the field
Names differ between products, but the idea is always the same: one field for the server address, one for the secret, one for the model name.
- Chat front ends and roleplay apps: look for a "Custom" or "OpenAI-compatible" connection type. SillyTavern, for example, lets you add an OpenAI-compatible endpoint under its chat completion settings. The address goes in the URL box, the key in the key box, and
uncensoredin the model box. - Code editors: editors that support a custom OpenAI endpoint usually put the setting under a model or provider page. Check your editor's own documentation, since the labels change between releases.
- Frameworks: LangChain, LlamaIndex and similar libraries wrap the OpenAI SDK and expose
base_urloropenai_api_baseas a parameter. - Self-hosted gateways: proxies that fan out to many providers want the same base URL in a provider entry, plus the model name you want to expose.
Before you pay for anything, you can try all of this with the trial credit described on the pricing page: a new user can claim $0.50 with one click on the key page, no card needed, valid for 7 days. That is enough to test every connection above.
More guides
Questions and answers
What is the Qwen API base URL for this service?
It is https://api.qwenapi.top/v1. Use it with a Bearer key and the model ID uncensored. It works only with keys issued by this service.
Should the base URL end with a slash?
Most SDKs accept both forms and trim the slash. If a tool builds the path by plain string joining, leave the slash off to avoid a double slash in the request.
Can I use the official Alibaba endpoint with my key from here?
No. This is an independent provider with its own keys. A key from here works only on this host, and a key from another vendor will not work here.
Why do I get 404 when the key is correct?
A 404 points to the path, not the key. Check that the base ends in /v1 and that you did not paste /chat/completions into a field that already adds it.
Does the base URL change between streaming and normal calls?
No. Streaming is the same endpoint with stream set to true in the request body, and the response arrives as server-sent events.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.