Your CI job asks Qwen Code to print READY, and it does. Which model ID did the job actually send? Two aliases can produce the same reply. To verify Qwen Code headless authentication and model selection together, pair the CLI result with the model field on the first inference request your staging endpoint receives. Then change one input at a time to see where an unknown alias and a missing key fail.
Use this guide if you maintain a CI job, can run Qwen Code v0.29.3 on a disposable Bash runner, and can inspect staging ingress or get a redacted extract from the endpoint operator. The worked example, task:provider-smoke-01, gives you a baseline invocation and two controls. The aliases and expected observations are illustrative. No staging runs were performed for this article.
QwenLM’s December 3, 2026 release lists environment-only OpenAI-compatible authentication and support for passing a bare undeclared -m ID to the current provider in a headless run. Use v0.29.3 for the example below. QwenLM release notes

Prepare a runner and a staging record you can read
- Use a disposable runner with the pinned
qwenexecutable on its path. Runqwen --versionand confirm it reports0.29.3before injecting the smoke-test inputs. Start in an empty directory outside any checkout. - Use a fresh runner home without a saved Qwen provider, sign-in state, or alternate credential. Check that
~/.qwen/settings.jsonand~/.qwen/.envare absent. KeepQWEN_MODELand provider or wire-format overrides out of the job environment. - Ask the staging operator for the approved Chat Completions API base and an existing staging-only credential permitted to use
docs-smoke. Confirm thatdocs-smoke-missingis absent and that the route rejects unknown aliases. A route that accepts unknown aliases via a default backend cannot serve as the rejection control in this worked case. - Confirm that the operator can see the incoming
modelfield and record whether staging accepted or rejected the request. Arrange a distinct time window for each invocation, with no overlapping traffic on the test route or credential identity. Ask how long records can take to appear and whether the view includes rejected requests.
The clean runner makes all three outcomes interpretable. The env-only startup path constructs an OpenAI provider in memory when user settings declare no provider and the required inputs are available. The implementation supports a missing user settings file. If a provider already exists in user settings, the env-only setup leaves it alone. A configured project model can also select a project provider. Those cases introduce settings that could explain a different incoming model or a successful run even when you remove an environment binding. Environment authentication implementation
The merged follow-up describes three input sources for env-only authentication: the process environment before .env loading, the user’s ~/.qwen/.env, and the user settings env block. Run from the clean home and an empty directory with no relevant configuration or dotenv files in its ancestors. Use a fresh worker for each case if your CI system can inherit state from an earlier job. A check that a secret is absent from one step’s CI configuration tells you only about that binding. A user env file can still supply a credential to a reused runner. Settings and authentication follow-up
Bind the base URL to the staging API root. In this illustrative case it is https://staging.example.com/v1. Substitute the approved base supplied by your operator. The client adds the request path, so give it the root ending in /v1 for this example. Confirm that the route supports Chat Completions and the request format Qwen sends, including any built-in tool definitions that accompany the prompt. The fixed prompt asks for a text response, and the exercise adds no repository tools, connectors or files. QwenLM model provider reference
Ask for the incoming value before alias resolution. A gateway might display docs-smoke at ingress and a different backend ID in a usage view. Both records can be correct because they describe different points in routing. For this exercise, ask for a timestamp, a request ID if one is available, the incoming model if parsed, and the disposition. A restricted log view or a redacted extract with those fields is enough. The endpoint operator can supply the extract while keeping raw headers and bodies in their existing log system.
If an engineer’s workstation already has saved routes, leave those settings in place and use the disposable worker. The saved-provider guide covers how to configure Qwen Code with Ollama, LM Studio and OpenRouter. This experiment needs one approved route and one process per case so you can tie a result to a small set of explicit inputs. Qwen Code provider setup guide
Send the fixed prompt and check both results
- Bind
STAGING_OPENAI_BASE_URLto the approved API base in the smoke step. BindSTAGING_OPENAI_API_KEYthrough the CI secret store. Keep shell tracing off and keep the binding scoped to the test step. - Note the start time and run the following Bash block once in the empty working directory. Use the fixed text in the block as the prompt and supply no piped input.
- Read the CLI’s exit status and final text. Find the first inference request attributable to that same invocation and compare its incoming
modelfield withdocs-smoke.
# task:provider-smoke-01
# Bind the two STAGING_* inputs in the CI step environment.
# Illustrative expected observation: READY, exit 0, model=docs-smoke at ingress.
set +x
OPENAI_API_KEY="${STAGING_OPENAI_API_KEY:?Inject the approved staging key}" \
OPENAI_BASE_URL="${STAGING_OPENAI_BASE_URL:?Set the approved staging API base}" \
OPENAI_MODEL=docs-smoke \
qwen -m docs-smoke -p 'Reply with exactly READY. Do not use tools.'
The STAGING_* names are the CI bindings for this example. Qwen reads the three OPENAI_* names. Bash’s :? expansions stop this block before launch if either staging binding is unset or empty. The resulting shell diagnostic names the unset input without printing its contents. The assignments before qwen put the values into that command’s process environment, so later commands in the parent shell do not inherit the assignments from this line. The CI secret binding itself lasts for the scope your job config gives it. QwenLM authentication documentation
The -p option supplies a direct headless prompt, and text is the documented default output format. Leave the Qwen invocation as the last command in the smoke step so CI can report its status. If you need to process its output later, keep the original status before running any filters. For example, a filter could successfully select READY from output even if the process that produced it later exits with an error. Record the final response and exit as two fields in the same CI result. QwenLM headless mode reference
The baseline keeps the environment model and the flag identical. A successful baseline establishes that the route and credential can serve docs-smoke from this runner. It leaves open which input selected the model. The unknown-alias control changes only -m, making the flag’s effect visible on the wire. For a bare undeclared ID, the headless implementation can add the ID to the current user provider in memory. The example uses this one-provider path. A slash-qualified flag value or settings split across multiple providers calls for checking the configured provider selection separately. Headless model flag implementation
QwenLM’s tagged auth test asserts exit zero, the literal canned response hi with a newline, and the configured model on the first request captured by a fake endpoint. The tagged flag tests assert that the first request carries undeclared-model with both settings and env-only authentication. The version test checks the --version flag without a model request. These tests establish what to inspect and support the flag path. In the worked example, READY depends on the staging model following the fixed prompt. Tagged authentication test · Tagged model and flag tests
Use the recorded time window and route or credential identity to find the request. If the record includes an attributable request ID, keep it. Select the earliest inference request for that invocation and exclude unrelated health or discovery traffic. Where retries or additional inference calls produce several records, keep their order. A later match leaves an unexplained first-request mismatch unresolved. If the window contains overlapping jobs and you cannot uniquely identify the first request, repeat the positive case in a quiet window and record that the earlier comparison was inconclusive.
In the illustrative baseline the process exits 0, the final response is READY, and staging ingress records model=docs-smoke with an accepted disposition. That completes the positive case. If the actual response is Ready. but the ingress value and exit match, the alias check passed and the reply check failed. If the response is READY but the incoming alias differs, the model check failed. This distinction helps you keep a formatting problem from turning into an unnecessary key rotation or alias change.
Change the requested alias, then remove the key
Run each control independently in the same clean runner setup and give it a distinct window. Keep the API base and prompt fixed. Use the baseline key for the unknown-alias control. Restore the baseline alias for the missing-credential control. If your CI treats a nonzero step as grounds to stop the remaining job, run the controls as separate disposable jobs and keep the raw outcomes visible. The expected failures are the observations you came to collect.
# Unknown alias. Run in its own staging smoke step.
# Illustrative expected observation: staging rejects model=docs-smoke-missing.
set +x
OPENAI_API_KEY="${STAGING_OPENAI_API_KEY:?Inject the approved staging key}" \
OPENAI_BASE_URL="${STAGING_OPENAI_BASE_URL:?Set the approved staging API base}" \
OPENAI_MODEL=docs-smoke \
qwen -m docs-smoke-missing -p 'Reply with exactly READY. Do not use tools.'
# Missing credential. Run separately on the clean runner.
# Illustrative expected observation: local failure with no staging inference record.
set +x
(
unset OPENAI_API_KEY STAGING_OPENAI_API_KEY
OPENAI_BASE_URL="${STAGING_OPENAI_BASE_URL:?Set the approved staging API base}" \
OPENAI_MODEL=docs-smoke \
qwen -m docs-smoke -p 'Reply with exactly READY. Do not use tools.'
)
| Input | Action | Expected result |
|---|---|---|
task:provider-smoke-01, approved staging key, OPENAI_MODEL=docs-smoke, callable alias docs-smoke |
Run the positive block with qwen -m docs-smoke -p 'Reply with exactly READY. Do not use tools.' and compare the process outcome with the first inference record. |
Illustrative. Exit 0 and final reply READY if the model follows the prompt. Staging ingress records model=docs-smoke and accepts the request. |
task:provider-smoke-01, same base and key, OPENAI_MODEL=docs-smoke, deliberately absent alias docs-smoke-missing |
Run the unknown-alias block with qwen -m docs-smoke-missing -p 'Reply with exactly READY. Do not use tools.' and inspect the rejection record for that invocation. |
Illustrative for a route that rejects unknown aliases. The CLI reports a failure and staging records model=docs-smoke-missing with a model rejection. |
task:provider-smoke-01, same base, OPENAI_MODEL=docs-smoke, no key or alternate provider on the clean runner |
Run the missing-credential subshell with qwen -m docs-smoke -p 'Reply with exactly READY. Do not use tools.' and check the same ingress view. |
Illustrative. The CLI fails locally before inference because the env-only provider lacks a required input. Staging shows no matching inference request in the verified window. |
The unknown-alias block leaves OPENAI_MODEL=docs-smoke in the environment. If ingress sees docs-smoke-missing, the different value shows that the flag affected the transmitted model. QwenLM’s fake endpoint accepts its undeclared test ID. The rejection in this example comes from your staging route’s policy. Read the operator’s classification and the incoming field together, since the HTTP status or error wording can vary. If the negative alias arrives unchanged and gets a successful response, verify the alias map or fallback policy with the endpoint operator before calling this a working rejection control.
The missing-key block uses a subshell so unsetting the two key variables affects the test process without clearing the parent shell’s bindings. It deliberately omits the positive block’s key precondition, allowing Qwen Code to start with incomplete inputs. The base URL precondition still applies. If Bash reports that the base is missing, fix the base binding and repeat this control. The intended observation comes from Qwen Code starting without the key and failing before inference. If the endpoint receives a request, check whether it belongs to this invocation and whether a saved provider, user env file, or inherited credential supplied the missing input.
Diagnose the first unexpected observation
- Determine whether Bash stopped on a required binding or whether Qwen Code launched and returned an error. Keep the process status and a short, redacted diagnostic.
- Check the staging window against the expected route and available credential identity. Verify that your ingress view includes rejected requests and that the positive case is visible through the same view.
- When a matching request exists, compare its incoming
modeland disposition with the expected row. When the request is absent, establish whether a local error or a transport or visibility problem can explain the gap.
The CLI reports a startup configuration error. Start with the settings location named in the diagnostic and confirm the job’s working directory and home. The settings follow-up describes diagnostics that name the user, project, local or explicit settings layer for obsolete tool rules. That points to settings validation even if the status line and the absence of a request resemble the missing-key control. Return to the clean runner for the smoke check. In the real job, correct the reported setting while preserving the permission behavior you intend. QwenLM settings validation follow-up
The CLI fails and the ingress view is empty. Check the URL binding against the approved host and API root and ask the operator whether the request might have stopped at DNS, TLS, a proxy or an edge rule before reaching the logging point. If the approved route normally shows successful requests, ask the operator to confirm that it has finished ingesting records for the run window. An empty filtered view with uncertain coverage should yield an inconclusive wire result. The gateway tracing guide works through the related distinction between request acceptance and visibility in a logging interface. Langfuse gateway tracing guide
Staging rejects the expected incoming model. The client supplied the intended string. Ask the operator for the rejection class and use it to choose what to inspect next. An authorization rejection directs you to the CI secret binding and the route’s permissions for that identity. An unknown-model rejection on the positive run directs you to the staging alias map. A request-format rejection directs you to the protocol and provider compatibility. If the rejected request reached an edge that did not parse its body, record the rejection and leave the incoming model unverified. Keep the original error summary through the retry so you can tell which repair changed the outcome.
Staging receives a different model. Check where the field was captured. A backend model from after alias resolution can differ from the incoming alias. If the original incoming value really differs, inspect the exact CI invocation, runtime version and settings inputs. Compare that invocation to the positive block before trying another model value. A second run with the corrected input gets its own window and first request. Keep the earlier mismatch in the diagnosis. To establish which backend generated an answer after alias resolution, use downstream routing evidence. Served-model verification guide
Save the result and restore the job
- Record the CI run reference, the executable version, the exit status and a sanitized result for each case. Add the first ingress model and disposition if recorded, plus a request reference when available. Record absence only after confirming the correct window and relevant log coverage.
- Remove the smoke step and its temporary bindings when the exercise ends. If you adapted an existing job, restore the last working job definition and previous secret references from version control or CI configuration history.
- After correcting a failed baseline, rerun the positive block with the approved inputs on a fresh worker. Compare both observations before introducing a checkout, files or custom tools.
A handoff for the illustrative case could read as follows. The labels are local to this example and contain no request identifiers or credentials.
Illustrative expected observations for task:provider-smoke-01, Qwen Code v0.29.3
Baseline CLI exit 0 / READY first ingress model docs-smoke / accepted
Unknown alias CLI failure first ingress model docs-smoke-missing / unknown model
Missing key local startup failure no matching inference request in verified window
For a real handoff, include each run’s timestamp and actual request reference when you have it. A CI maintainer can use the run reference to inspect the binary and step bindings. The staging operator can use the window and route to locate the request. Record a safe key identity label if both sides need to distinguish it from another credential on the same route. Summarize the smallest useful error excerpt after checking it for secrets. Omit authorization headers, raw environment dumps and full request bodies. Environment validation and redacted logs
The inline overrides expire with the invocation, and the provider and model changes used in this path are applied in memory. For rollback, focus on changes you made to the CI job itself, such as the working directory, binary pin or secret reference. Keep the local and staging observations together in the handoff so the maintainer responsible for the next change can see where the test stopped. The CI owner can show what Qwen returned and the staging owner can attest to what the first inference request carried. AgentOps operating-layer guide
Sources
- QwenLM release v0.29.3
- QwenLM authentication documentation
- QwenLM model provider reference
- QwenLM headless mode reference
- QwenLM environment authentication implementation
- QwenLM headless model flag implementation
- Qwen Code v0.29.3 authentication test
- Qwen Code v0.29.3 flag tests
- QwenLM settings validation and env-only authentication follow-up

