Qwen3.8 Free on AIHubMix: Fix 429s, "Rate Limited by Provider", and a Drained Token Pool

· AIHubMix · 13 min read · Tutorial

Qwen3.8 Free on AIHubMix: Fix 429s, "Rate Limited by Provider", and a Drained Token Pool

Most problems with qwen3.8-max-free and qwen3.8-flash-free come from three places: the free-tier caps, the campaign capacity GMI Cloud has set aside upstream, and how quickly thinking tokens and agent context drain a 1M-token daily pool. Some of these show up as errors. Others show up as an odd-looking answer, or an empty quota by lunchtime. Alongside them, the everyday API errors still apply: a wrong key or model ID, a context that's too long, a broken tool-call history, JSON mode, content moderation, and images that are too small.

Each one has a fix, and one setting covers most of them: key-level fallback from the free IDs to the paid qwen3.8-max and qwen3.8-flash. Set it up once and a busy upstream, a spent quota, or the campaign's end around November 13, 2026 (Pacific Time) stops being an outage.

Quick map

What you see Likely cause Fix
429 after 10 calls in a minute Free per-minute cap Pace requests, or fall back
429 for the rest of the day Daily request or token cap Wait for the reset, or fall back
"Rate limited by provider" Campaign capacity busy upstream Back off and retry, or fall back
A reply saying the trial is used up 10 trial calls spent, no top-up Top up $1 or more
524 after about two minutes Non-streaming request cut off upstream Stream the response
Daily tokens gone after a few agent runs Thinking plus resent context Turn thinking off, cap the context
Free IDs stop working Campaign ended or credits ran out Switch to the paid IDs

Errors from the free tier and the campaign

429: "Sorry, you have reached the limit of the free model quota."

What you see. After a top-up of $1 or more, AIHubMix free models allow 10 requests a minute, 100 a day and 1M tokens a day, shared across the whole free catalog. "Past a cap the API returns 429 until the next minute or day starts," per the free models page. In AIHubMix's gateway logs, a request past a cap comes back with this message and a top-up link: "Sorry, you have reached the limit of the free model quota. Please switch to a paid model to enjoy unlimited concurrency." It doesn't say which cap you hit. AIHubMix's HTTP status code reference lists a different message for request frequency, "The xx model Too many requests; please try again later.", so match on the 429 status rather than the text.

Why. The caps are per account, not per model. A batch job on another free model eats into the same minute and the same day.

How to reproduce it. Eleven quick requests in a row hit the per-minute cap. This uses 11 of your 100 daily requests:

for i in $(seq 1 11); do
  curl -s -o /dev/null -w "%{http_code}\n" https://aihubmix.com/v1/chat/completions \
    -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model":"qwen3.8-flash-free","messages":[{"role":"user","content":"hi"}],"max_tokens":16}'
done

If all 11 land inside one minute, the first ten print 200 and the eleventh prints 429.

Fix. Keep batch jobs under 10 requests a minute with a simple rate limiter. For the daily cap, either wait for the reset or set up fallback (below) so overflow goes to the paid model.

"Rate limited by provider – contact support to request higher concurrency or try again later."

What you see. In AIHubMix's own test on October 16, a call to qwen3.8-max-free returned HTTP 429 with this body, while the same key kept working on qwen3.8-flash-free:

{"error":{"message":"Model qwen3.8-max-free rate limited by provider – contact support to request higher concurrency or try again later. (tid: …)","type":"service_unavailable","param":"","code":"rate_limit_exceeded"}}

AIHubMix's status code reference lists the same message under 503, so check for both codes.

Why. The free IDs run on capacity GMI Cloud has set aside for the campaign. When many people call Max at once, that upstream pool is full for a while. It's not your quota: other free models keep working with the same key.

Fix. Retry with exponential backoff (for example 30, 60 and 120 seconds). For anything that can't wait, let fallback send the request to the paid qwen3.8-max. Keep the tid if you contact support; it identifies the request.

A reply that says your trial is used up

What you see. No error at all. A new account gets 10 trial calls in total, shared across every free model. After the tenth, the API keeps answering, but the answer is a note that the trial is used up. An app that shows model output to users will show them that note.

Fix. Top up $1 or more. That switches the account permanently to the daily quotas above.

524: "bad response status code 524"

What you see. A non-streaming request hangs for about two minutes and then fails with HTTP 524. AIHubMix's gateway records the error as:

{"message":"bad response status code 524","type":"upstream_error","param":"524","code":"bad_response_status_code"}

In AIHubMix's gateway logs for October 18–19, this was the most frequent error on qwen3.8-max-free. It shows up on qwen3.8-flash-free too, less often.

Why. The free route's upstream sits behind Cloudflare, which closes a request after about 125 seconds without a response and returns 524 ("A timeout occurred"). Every 524 that AIHubMix traced was a non-streaming request that got nothing back in those 125 seconds. A non-streaming request only gets a response once the whole answer is ready, and Max is slow to finish one: AIHubMix measures about 55 seconds of latency and about 9 tokens a second on the free route. That leaves roughly 70 seconds, or about 600 tokens with thinking included, before the cutoff (an estimate from those two figures). Raising your client timeout doesn't help, because the cutoff is upstream, and resending the same request runs into it again.

Fix. Stream Max requests, and stream long Flash requests too. A streamed response starts arriving as soon as the model produces its first tokens, well inside the cutoff. Use Flash for anything interactive.

Everyday API errors

Not every error on the free IDs is about quotas. These come up just as often, on the free and paid IDs alike. AIHubMix passes most 400 errors through from the upstream model, per its status code reference. The free IDs run on GMI Cloud and the paid ones on Alibaba Cloud, so the exact wording of a 400 can differ between the two routes. The messages below are quoted from AIHubMix's reference, from Alibaba Cloud's error code reference, and from AIHubMix's gateway logs.

Status Error Usual cause
401 Unauthorized Wrong or missing key
503 Incorrect model ID Typo, or another platform's ID
403 Key not authorized for the model Model not enabled on the key
400 Range of input length Context over the limit
400 Role "tool" without "tool_calls" Broken tool-call history
400 JSON mode errors Prompt wording or thinking
400 Inappropriate content Content moderation
400 Image length and width Image 10px or less on a side

401: "Unauthorized – access token is invalid or expired."

Why. The key is wrong, revoked or expired. With no Authorization header at all, the message is "Unauthorized – no access token supplied; please log in and include a valid token." The usual causes are an environment variable that isn't set in the shell running the code, so an empty key goes out, or a key from another platform, such as QwenCloud or GMI Cloud, sent to AIHubMix.

Fix. Check the variable in the same shell: echo ${AIHUBMIX_API_KEY:0:3} should print sk-. AIHubMix keys only work on https://aihubmix.com/v1, and other platforms' keys don't work there.

503: "Incorrect model ID. Please request to view the model page or you do not have permission to use this model"

Why. Model IDs must match exactly. The free IDs are qwen3.8-max-free and qwen3.8-flash-free, all lowercase, with a hyphen before free. IDs copied from other platforms, such as GMI Cloud's Qwen/Qwen3.8-Max, don't exist on AIHubMix. One copy-paste doesn't error at all: QwenCloud's ID qwen3.8-max is a valid AIHubMix ID, but it's the paid model, so the request quietly bills you.

How to reproduce it.

curl -s https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen-3.8-max-free","messages":[{"role":"user","content":"hi"}]}'

Fix. Copy the ID from the model page. And since this comes back as a 503, retry logic that treats every 5xx as temporary will keep retrying a typo; treat this message as permanent.

403: "Forbidden – key(last 6 digits of request key) not authorized to access the requested model."

Why. AIHubMix keys can be limited to a list of models. A key created for another project, with its own model list, can't reach the Qwen3.8 free IDs until you add them.

Fix. Edit the key in API key management and add qwen3.8-max-free and qwen3.8-flash-free. If you set up fallback, add the paid backups too: fallback skips models outside the key's list.

400: "Range of input length should be [1, xxx]"

Why. This is Alibaba's message for input over the model's context limit; the number in place of xxx is the limit. Agent sessions are the usual cause, since the history grows on every turn. Alibaba also notes that long prompts with thinking on "may cause response truncation or request timeout."

Fix. Trim the history, start a new session for a new task, or turn on your tool's compaction. Trim carefully, though, or you'll run into the next error.

400: messages with role "tool" must be a response to a preceeding message with "tool_calls"

Alibaba's reference lists this message, typo included, along with its mirror image: "An assistant message with "tool_calls" must be followed by tool messages responding to each "tool_call_id"". Qwen Code users reported the first one in issue #2360.

Why. The history sent to the model has a tool result whose tool call was trimmed away, or a tool call whose result is missing. Hand-rolled history trimming and context compaction are the usual culprits.

Fix. Treat a tool call and its results as one unit. Every tool_call_id in an assistant message needs a matching tool message right after it:

messages = [
    {"role": "user", "content": "What's the weather in Hangzhou?"},
    {"role": "assistant", "content": None, "tool_calls": [{
        "id": "call_1", "type": "function",
        "function": {"name": "get_weather", "arguments": "{\"city\": \"Hangzhou\"}"},
    }]},
    {"role": "tool", "tool_call_id": "call_1", "content": "{\"temp_c\": 21}"},
]
# When trimming, drop messages[1] and messages[2] together, never just one of them.

400: JSON mode

Alibaba's reference lists two JSON-mode errors:

  • "'messages' must contain the word 'json' in some form, to use 'response_format' of type 'json_object'."
  • "Json mode response is not supported when enable_thinking is true"

Why. The first is the same rule OpenAI's JSON mode has: the prompt has to mention JSON. The second matters more for Qwen3.8, where thinking is on by default, so a json_object request that works on other models can fail here. Alibaba's reference doesn't list which models return the second message, so test it on the ID you use.

Fix. Mention JSON in the prompt, and switch thinking off for JSON-mode calls:

curl -s https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-flash-free",
    "messages": [{"role": "user", "content": "Reply in JSON with the city and date: meet in Hangzhou on Nov 3."}],
    "response_format": {"type": "json_object"},
    "enable_thinking": false
  }'

400: "Input text data may contain inappropriate content."

Why. This is content moderation, and it applies to the free IDs as well as the paid ones. In AIHubMix's gateway logs for October 18–19, it was the error that the most people hit on the free IDs, with exactly this text. On the paid route, Alibaba puts its code in front: "InternalError.Algo.DataInspectionFailed: Input text data may contain inappropriate content." Alibaba's reference lists the code as data_inspection_failed, with variants for output: "Output data may contain inappropriate content." and "Input or output data may contain inappropriate content." User-generated text pasted into a prompt, such as scraped pages or support tickets, is the usual trigger. Fallback won't get around it, because the paid IDs screen the same way.

Fix. Find the passage that trips it by splitting the input, then filter or rephrase it. Resending the same input gets the same answer.

400: "The image length and width do not meet the model restrictions."

Why. Every image in the request has to be more than 10 pixels on each side. The message ends with the size it rejected, for example "[height:8 or width:8 must be larger than 10]". AIHubMix's gateway logs show it on both free IDs. Images that small usually get in by accident, such as icons or tracking pixels picked up along with a scraped page.

Fix. Check image sizes before sending, and drop or upscale anything 10 pixels or less on either side.

The quiet failure: a drained token pool

Nothing errors until the 1M-token pool is empty, and then everything returns 429 at once. Three things drain it faster than expected.

Thinking tokens

Both models think by default, and Alibaba bills thinking as output tokens; on the free route, those tokens count toward your daily pool. In AIHubMix's test, a two-sentence answer from qwen3.8-flash-free used 89 output tokens, 36 of them on thinking. Max thinks more: Artificial Analysis measured it using 190M output tokens on its index against an 87M median.

For extraction, formatting and short lookups, turn thinking off. enable_thinking is Alibaba's documented switch for Qwen3.8; with the OpenAI SDK it goes in extra_body:

resp = client.chat.completions.create(
    model="qwen3.8-flash-free",
    messages=[{"role": "user", "content": "Return only the invoice number: INV-2026-0042, due Nov 3"}],
    extra_body={"enable_thinking": False},
)
print(resp.choices[0].message.content)
print(resp.usage.completion_tokens_details)

Check that reasoning_tokens in the usage block drops to 0. If it doesn't, the switch didn't reach the model on that route, and thinking is still being spent.

Agent loops resend context

Coding agents send the whole conversation, including file contents and tool results, on every turn. A session that has grown to 40K tokens, run for 20 more turns, sends 800K input tokens: most of a day's pool before any output. Cap the context window in your tool's model settings, start fresh sessions for new tasks, and use compaction if your tool has it.

One big request

Max and Flash both accept 1M tokens of context, which is the same size as the daily pool. A single request that fills the window uses up the day.

When the campaign ends

The free window closes around November 13, 2026 (Pacific Time), or earlier if GMI Cloud's campaign credits run out. After that, the -free IDs are no longer free. Code that already falls back to the paid IDs keeps working. Code that calls the free IDs directly needs one change: drop -free from the model name.

Set up fallback once

AIHubMix can switch models at the gateway when the primary model fails, configured per API key, with no change to your code. Model mapping and fallback covers the full rules. For the Qwen3.8 free IDs:

  1. Open API key management in the AIHubMix console and edit the key your app uses.
  2. Under "Fallback models on error", add qwen3.8-max first and qwen3.8-flash second.
  3. Keep calling qwen3.8-max-free in your code.

Leave the free IDs out of the backup list. A free model can only be the primary model; in the backup list it's silently skipped.

Situation Falls back?
Free model hits a quota or rate limit Yes, to a paid backup
Every upstream channel fails before the reply starts Yes
The stream has already started No
Your client timed out No
Your own key is invalid or out of balance No

Fallback requests are billed at the paid model's price, so keep some balance on the account. If fallback requests start failing with 403 "Your account balance is insufficient. Please recharge your account to continue using the API.", top up: fallback doesn't route around your own balance. Once the balance drops below -$1, the free models stop working too, until you top up.

To see which model answered, read the response headers:

curl -s -i https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3.8-max-free","messages":[{"role":"user","content":"hi"}]}' \
  | grep -i -E 'x-aihubmix-(model|fallback)'

X-Aihubmix-Fallback: true means the request fell back. X-Aihubmix-Model names the model that answered, which is also the one you're billed for.

Coding tools

Any tool that accepts an OpenAI-compatible provider works with the free IDs, including OpenCode, Cline, Kilo Code, Qwen Code and Hermes Agent. AIHubMix has setup pages for each; the OpenCode guide is a good starting point. The values are the same in every tool:

Setting Value
Provider type OpenAI-compatible
Base URL https://aihubmix.com/v1
API key Your AIHubMix key
Model ID qwen3.8-flash-free or qwen3.8-max-free
Context window Up to 1M; set lower to save the pool
Max output Up to 131K

Two known issues apply in every tool. Agent loops drain the shared token pool, as described above. And Max's long latency makes it slow as the main model in an interactive agent. Tools that let you pick separate models for planning and editing, such as Cline's Plan and Act modes, can put Max on planning and Flash on the edits.

A 15-minute smoke test. Point your tool at qwen3.8-flash-free and ask it to add one unit test for a small function in a real repository, then run the test. Success looks like this: the agent reads the file, writes the test, runs it through a tool call, and the AIHubMix usage log shows the requests under the free model at $0. Then repeat the planning step on qwen3.8-max-free and check the time and tokens it used.

Checklist

  • Topped up $1 or more, so the daily quota replaces the 10 trial calls
  • Model ID copied exactly from the model page, and enabled on the key
  • Batch jobs paced under 10 requests a minute
  • Max requests stream, since non-streaming ones get a 524 after about 125 seconds
  • Thinking off for simple requests, and reasoning_tokens checked
  • Agent context capped, with new sessions for new tasks
  • History trimming keeps each tool call and its results together
  • JSON-mode calls mention JSON and run with thinking off
  • Images more than 10 pixels on each side
  • Fallback set to qwen3.8-max, then qwen3.8-flash
  • Some balance left for fallback requests
  • A reminder set for around November 13, when the free window closes

FAQ

Why do I get 429 on qwen3.8-max-free when I've barely used it?
Either another free model on your account used up the shared minute or day, or the campaign's upstream capacity is busy. The error message tells you which: "reached the limit of the free model quota" is your account's cap, and "rate limited by provider" is the upstream.

Why does my request return "Incorrect model ID"?
The model name doesn't match an AIHubMix ID exactly. Use qwen3.8-max-free or qwen3.8-flash-free, all lowercase; IDs from GMI Cloud or other platforms don't exist here. It comes back as a 503, so make sure retry logic doesn't keep retrying it.

Why does qwen3.8-max-free return 524?
The request was non-streaming, and the answer took longer than about 125 seconds, so the upstream closed it. Stream Max requests; a longer client timeout won't help.

Can I put qwen3.8-flash-free in the fallback list?
No. Free models can only be the primary model; AIHubMix skips them in the backup list.

How do I stop thinking from using my free tokens?
Pass enable_thinking set to false in extra_body for requests that don't need reasoning, and check that reasoning_tokens drops to 0 in the usage block.

Why does my coding agent burn through the daily pool so fast?
Agents resend the whole conversation on every turn. Cap the context window, start new sessions for new tasks, and use Flash as the main agent model.

What happens to the free IDs after November 13?
They stop being free, and earlier if GMI Cloud's campaign credits run out. Switch to qwen3.8-max or qwen3.8-flash, or rely on the fallback you've set.

Keep reading: the Qwen3.8 Free series

Sources

More from the blog