- qwenuncensored.top
- qwen2.5:latest: Migrating a Pipeline to an API
qwen2.5:latest: Migrating a Pipeline to an API
If your scripts say qwen2.5:latest, you are using a local-runner tag that may no longer match what you tested. This is a practical plan for moving such a pipeline to a hosted OpenAI-compatible API without breaking it.
Updated

Key points
- Treat the move as a model change, not a config change: build a small regression set first.
- The endpoint serves one model, ID uncensored. It does not offer a Qwen 2.5 build by name.
- JSON mode, stop sequences, seed and streaming are available, so most extraction pipelines port cleanly.
- 10,000 documents of 800 input and 200 output tokens cost $2.20.
Why people migrate away from a pinned local tag
The tag qwen2.5:latest shows up in Ollama commands, in LangChain and LlamaIndex configs, and in plenty of cron scripts that someone wrote a year ago and nobody touched since. It worked on the laptop or the home server it was written on. Then the situation changed: the box needs the GPU for something else, a teammate wants to run the same job on a laptop with no GPU, or the job grew from fifty documents to fifty thousand.
Those are good reasons to move the call to a hosted endpoint, and the code change is small because Ollama itself offers an OpenAI-compatible route. The hard part is behaviour. You are not swapping a URL for the same model. You are swapping the model, and the pipeline's outputs will shift. This article is about handling that shift deliberately.
One fact up front, so you can decide quickly. Our endpoint serves a single model with the ID uncensored. It is an open-weight model tuned to answer without content refusals for lawful adult use, run by an independent provider. It is not the official Qwen API, and it does not expose a Qwen 2.5 build under any name. If your project requires that exact family for reasons of licensing review, benchmarks or reproducibility, keep running it where you run it now. If the requirement is only that the job produces good output, read on.
Step 1: freeze what your pipeline does today
Before touching the client, capture a baseline. Pull a sample of real inputs, run them through the current setup, and store input and output pairs in a file. Thirty to fifty items is enough to catch most problems, as long as the sample includes your worst cases: very long inputs, empty fields, odd characters, languages other than English.
import json, sys
from openai import OpenAI
def run(client, model, prompts, **kw):
out = []
for p in prompts:
r = client.chat.completions.create(
model=model, messages=p["messages"], **kw
)
out.append({"id": p["id"], "text": r.choices[0].message.content,
"in": r.usage.prompt_tokens, "out": r.usage.completion_tokens})
return out
prompts = [json.loads(line) for line in open("sample.jsonl")]
local = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
hosted = OpenAI(base_url="https://api.qwenuncensored.top/v1", api_key=sys.argv[1])
base = run(local, "qwen2.5:latest", prompts, temperature=0)
new = run(hosted, "uncensored", prompts, temperature=0)
json.dump({"base": base, "new": new}, open("compare.json", "w"), indent=1)Keep the temperature at 0 or very low for both runs so that differences come from the model and not from sampling noise. If you want repeatable runs while debugging, also pass seed, which the API forwards. Do not rely on identical output across runs, though. Judge by the properties your pipeline needs.
Step 2: define pass and fail in measurable terms
Reading fifty outputs by eye does not scale, and you will miss format drift. Write checks that match how downstream code uses the text. Typical ones:
- Does the output parse as JSON, and does it contain every required key?
- Is a field one of an allowed set of values, such as a label from a fixed list?
- Is the length within bounds, for example a summary of at most 80 words?
- Does the text contain forbidden strings, like a leading phrase you strip with a regex?
- For extraction, does each extracted value appear verbatim in the source?
Count failures per check for both models. A model that is slightly worse on tone but never breaks the JSON may suit your pipeline better than one with nicer prose that fails the parser once in twenty calls. For subjective quality, read a random ten and note what bothers you; then adjust the prompt, not the checks.
Step 3: port the calls that depend on structure
Pipelines that extract fields usually lean on one of three techniques: asking for JSON in the prompt, using a grammar or format option in the local runner, or parsing free text with regexes. On this API the supported route is JSON mode, set with response_format. Local-runner features that constrain output to a schema are not part of the compatible surface, so validate on your side.
import json
from openai import OpenAI
client = OpenAI(base_url="https://api.qwenuncensored.top/v1", api_key="YOUR_KEY")
ALLOWED = {"billing", "bug", "feature", "other"}
def classify(ticket: str) -> dict:
for attempt in range(2):
r = client.chat.completions.create(
model="uncensored",
response_format={"type": "json_object"},
temperature=0,
max_tokens=200,
messages=[
{"role": "system", "content":
'Return JSON with keys "label" (one of billing, bug, feature, other) '
'and "confidence" (number 0 to 1). No other text.'},
{"role": "user", "content": ticket},
],
)
try:
data = json.loads(r.choices[0].message.content)
if data.get("label") in ALLOWED:
return data
except json.JSONDecodeError:
pass
return {"label": "other", "confidence": 0.0}The retry-then-fallback shape is worth keeping whatever model you use. Note that max_tokens is optional here. Without it the completion can use the rest of the 100,000-token window, so set it yourself when you know the answer is short; it also guards you against a runaway reply.
Other parameters to review: stop sequences are passed through, so patterns like cutting at a blank line still work. The penalties (presence_penalty, frequency_penalty) are passed through as well. Local-only options such as num_ctx should be deleted. If your job used tools, the docs describe how tool calling is shaped on this endpoint.
Prompt adjustments that usually pay off
A prompt written for one model carries habits that came from trial and error with that model. After the swap, expect to touch it. Common adjustments:
- Say the format once, clearly, and show one example. A single worked input and output pair does more than a paragraph of rules.
- Remove old workarounds. Lines like "do not apologise" or "never start with Sure" were often added to fix one model's quirks. Delete them, run the checks, and add back only what a failing case demands.
- Put variable text last. Instructions first, then the document. It keeps the rules in view and makes prompts easy to diff.
- Be explicit about length. "At most 60 words" beats "brief". Pair it with
max_tokensas a safety net, set a little above what you expect. - Lower the temperature for extraction. Anything that feeds a parser should run at 0 to 0.2. Raise it only for writing tasks.
Change one thing at a time and rerun the saved sample after each change. It sounds slow, but the sample takes a couple of minutes and a handful of cents of credit, and it tells you which edit helped. Editing five things at once leaves you guessing.
One more habit is worth building: log the token counts. Every response carries a usage block, and the X-Balance-USD header shows the credit left after the call. Write both to your job log. When a prompt change doubles the input size, you will see it in the numbers the same day and not on the next top-up.
Finally, keep the old prompt versions in source control with the model name next to them. Six months from now, someone will ask why the classifier labels changed in spring, and a commit that says which model and prompt were active answers the question in seconds.
Step 4: size the run and the bill
Take a batch job of 10,000 documents. Each has 800 input tokens, including the instructions, and yields 200 output tokens. Input totals 8,000,000 tokens, which is 8 x $0.15 = $1.20. Output totals 2,000,000 tokens, which is 2 x $0.50 = $1.00. The batch costs $2.20.
Time matters as much as money. A full key allows 8 concurrent requests and 300 requests per minute, so 10,000 calls take at least 10,000 / 300, roughly 34 minutes at the request cap, whatever the concurrency. Eight workers is a sensible pool size. Do not launch 50 threads: the extra ones just collect 429 responses with the code concurrency.
from concurrent.futures import ThreadPoolExecutor
import time
from openai import RateLimitError
def safe_classify(t):
for i in range(5):
try:
return classify(t)
except RateLimitError:
time.sleep(5)
return None
with ThreadPoolExecutor(max_workers=8) as pool:
results = list(pool.map(safe_classify, tickets))Each retry in the example sleeps five seconds, which matches the Retry-After: 5 header the API sends on temporary overload. Failed or refused requests are not charged, so a retry does not double your bill. The pricing page shows the top-up tiers if you want to buy credit ahead of a large job.
Step 5: switch gradually
A hard cutover is a risk you do not need. A calmer path:
- Run the hosted model in shadow mode for a few days. Send both, store both, use the old result.
- Look at the disagreement rate on your checks. Review a sample of the disagreements by hand.
- Move a small share of traffic, say 10 percent, then raise it as the numbers hold.
- Keep the old path behind a flag for a week or two. The model name should be a setting, not a constant buried in a function.
The trial is enough to run the baseline above. New accounts can claim $0.50 of credit with one click after sign-up, valid for 7 days, no card required. At 800 input and 200 output tokens per document, one document costs $0.00012 + $0.0001 = $0.00022, so 2,000 documents cost $0.44 and fit inside the trial. Trial keys are limited to 2 concurrent requests and 60 per minute, so use two workers. Create the key on the API key page.
The data question comes up in every migration review, so here is the short answer: prompts are not used for training. Still, send only what the job needs. Strip identifiers that have no bearing on the task, the same way you would for any third-party service.
More guides
- Qwen Agent Function Call on an OpenAI-Compatible API
- qwen3:latest Explained, and a Hosted Alternative
- Qwen 3 API: The Uncensored Alternative
FAQs
Is this the official Qwen API?
No, we are an independent service. We host an open-weight variant of the model optimized for uncensored use. We are not affiliated with the original Qwen team or any other vendor. Check the official Qwen documentation for their specific models and pricing.
What is the max output length?
There is no separate output cap. If you do not set the max_tokens parameter, the response can run to the end of the window. The total context window, including the prompt, is 100,000 tokens.
How do I top up my account?
We accept top-ups by crypto (USDT on TRC20, USDC on Base). Minimum top-up is $20, maximum is $500. Bonuses apply at $50 (+5%), $100 (+10%), and $200 (+15%).
Are prompts used for training?
No. Your prompts are processed by our servers but are not used to train the model. Your data privacy is maintained, requiring only an email for account creation.
Questions and answers
Does this endpoint serve Qwen 2.5?
No model is offered under that name. The endpoint serves one open-weight model with the ID uncensored, run by an independent provider, and it is not the official Qwen API.
What do I put in the model field instead of qwen2.5:latest?
Use uncensored, and point the base URL at https://api.qwenuncensored.top/v1. GET /v1/models returns the same ID.
Will my outputs match the old ones?
Expect differences, because it is a different model. Compare on a saved sample with automated checks before you switch real traffic.
Can I run batch jobs at full speed?
Up to 8 concurrent requests and 300 requests per minute on a full key. Beyond that you get HTTP 429, so cap your worker pool and retry after a few seconds.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Get API key