Quick answer: You can run ERNIE 5.5 Flash free in OpenCode and Claude Code through OpenRouter’s baidu/ernie-5.5-flash-preview:free endpoint. In OpenCode, connect OpenRouter and set "model": "openrouter/baidu/ernie-5.5-flash-preview:free". In Claude Code, point ANTHROPIC_BASE_URL at OpenRouter and pin the ERNIE slug as your model. It costs $0 per token, but without purchased credits you get 50 requests a day.
That daily cap is the whole story for coding agents. An agent doesn’t make one request per task; it makes one per step. This guide sets up both agents, shows a coding task that fits the free budget, and tells you where the free route breaks.
All limits below were checked on OpenRouter’s official pages on November 12, 2026.
What is ERNIE 5.5 Flash Preview?
ERNIE 5.5 Flash Preview is Baidu’s chat and agent model released on November 10, 2026. It’s a sparse mixture-of-experts model with 280 billion total parameters, 14 billion active per token and a 1,024,000-token context window. Baidu pitches it at coding, agentic work and deep research, and OpenRouter lists it as reasoning-enabled with tool calling.

There’s also a pretraining-only ERNIE 5.5 Flash Base on Hugging Face, but that’s the one you fine-tune or serve yourself. The Preview is what your coding agent talks to. For the full model breakdown, read what is ERNIE 5.5 Flash. If you’re coming from the previous generation, the ERNIE 5.1 overview covers what changed.
ERNIE 5.5 Flash free limits on OpenRouter
OpenRouter’s model page shows the :free variant at $0 input and $0 output, served by one provider, Baidu Qianfan. The rate limits come from OpenRouter’s limits documentation and apply to every model ID that ends in :free.
| Item | Value (checked 2026-11-12) |
|---|---|
| Model ID | baidu/ernie-5.5-flash-preview:free |
| Price | $0 input, $0 output |
| Context window | 1,024,000 tokens |
| Requests per minute | 20 |
| Requests per day, under 10 credits ever purchased | 50 |
| Requests per day, 10+ credits ever purchased | 1,000 |
| Providers behind it | 1 (Baidu Qianfan) |
Two details matter for agents. OpenRouter’s pricing page says failed attempts count toward the daily cap. And a negative credit balance blocks free models with a 402 until you top up.

The 1,000-a-day tier depends on credits you’ve bought, not credits you spend.
Set up ERNIE 5.5 Flash in OpenCode
OpenCode supports OpenRouter natively, so this is the shorter of the two setups. You need an OpenRouter account and an API key from your OpenRouter dashboard.
- Install or update OpenCode, then start it in your project folder:
cd your-project
opencode
- Connect OpenRouter. Inside OpenCode, run
/connect, pick OpenRouter and paste your key. You can also export it before launching:
export OPENROUTER_API_KEY="sk-or-v1-..."
- Pin the model in
opencode.jsonat the project root. OpenCode’s providers docs say to use the full OpenRouter model ID after theopenrouter/prefix:
{
"$schema": "https://opencode.ai/config.json",
"model": "openrouter/baidu/ernie-5.5-flash-preview:free"
}
- Confirm the selection with
/models. If ERNIE doesn’t appear in the list, the config value still wins, so check the spelling of the slug, including:free.
Every prompt now goes to ERNIE 5.5 Flash Preview through OpenRouter. If you’ve followed our GLM-5.3-Flash OpenCode guide or the DeepSeek V4.1 Flash one, the pattern is identical: only the slug changes.
Set up ERNIE 5.5 Flash in Claude Code
Claude Code can talk to OpenRouter because OpenRouter exposes an Anthropic-compatible Messages endpoint. The ERNIE model page lists POST https://openrouter.ai/api/v1/messages as a supported route for this model.
Be clear about the support level first. OpenRouter’s Claude Code integration guide says Claude Code with OpenRouter “is only guaranteed to work with the Anthropic first-party provider” and that Claude Code “may not work correctly with other providers.” Running ERNIE here works through documented settings, but it’s not a guaranteed pairing.
- Set the connection variables in your shell profile, exactly as OpenRouter documents them:
export OPENROUTER_API_KEY="sk-or-v1-..."
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"
export ANTHROPIC_API_KEY="" # must be explicitly empty
- Pin ERNIE for every model class Claude Code uses, so no step quietly falls back to a paid Anthropic model:
export ANTHROPIC_DEFAULT_OPUS_MODEL="baidu/ernie-5.5-flash-preview:free"
export ANTHROPIC_DEFAULT_SONNET_MODEL="baidu/ernie-5.5-flash-preview:free"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="baidu/ernie-5.5-flash-preview:free"
You can put the same keys in the env block of .claude/settings.json if you want the setup scoped to one project.
- Reload the shell, start
claude, and run/status. You should seeAuth token: ANTHROPIC_AUTH_TOKENandAnthropic base URL: https://openrouter.ai/api. If it namesANTHROPIC_API_KEYor a Claude account login, the variables didn’t reach the session. - Open
/modelto confirm the classes resolve to ERNIE, then check the model column in your OpenRouter activity dashboard after your first prompt.

We cover the general Claude Code setup in more depth in how to use Claude Code with OpenRouter.
A real coding task that fits 50 requests
With 50 requests a day, you can’t let an agent wander. Give it a bounded task where you already know what “done” looks like. Here’s one that works well on a small repo:
In src/routes/orders.ts, GET /orders/:id returns 500 when the order
doesn't exist. Make it return 404 with {"error":"order_not_found"}.
Read only the files you need, make the smallest change, then run
the orders tests with npm test and stop. Don't refactor anything else.
Why this shape works on the free tier:
- It names the file. The agent skips a repo-wide search, which saves several requests.
- It defines the fix. The status code and body are in the prompt, so there’s no back-and-forth.
- It caps the scope. “Stop after the test run” ends the loop instead of letting the agent polish.
A task like this usually takes a handful of model calls: read the route, read the error handler, edit, run tests, report. A vague prompt like “clean up the orders module” can burn a day’s quota before anything ships.
The 1M context window is the other reason ERNIE suits agents. You can paste a long stack trace or a whole OpenAPI file into one prompt instead of spreading it across turns. One big request beats five small ones when every request counts.
Let ERNIE run your API tests with Apidog CLI
Once the agent has fixed an endpoint, you want proof the API still behaves, not just that a unit test passed. Apidog CLI lets the same agent run the test scenarios your team already keeps in Apidog, read the failures, fix the code and run them again. You write one prompt; ERNIE runs the commands.
Install the CLI, log in and add the agent skill:
npm install -g apidog-cli@latest
apidog auth login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com # pick OpenCode or Claude Code when prompted
Then give your agent one prompt:
Run the "Orders API" test scenario in Apidog project <projectId> against
the local environment. If any step fails, find the endpoint in this repo
that causes it, fix it, and rerun the scenario until it passes.
Summarize what you changed.
The agent looks up the scenario, runs it with a JSON report it can parse, then reruns after the fix:
apidog test-scenario list --project <projectId>
apidog run -t <scenarioId> --project <projectId> -e <envId> -r cli,json --out-dir ./apidog-reports
# agent edits the failing route, then:
apidog run -t <scenarioId> --project <projectId> -e <envId> -r cli,json --upload-report
The --upload-report flag sends the run summary to Apidog so your team can open it in the app. apidog test-report list --project <projectId> pulls past runs if the agent needs to compare.
Budget it, though. Each test run, report read and code edit is an agent step, so a fix-and-rerun loop can easily take 10 model requests. On the 50-a-day tier, run this loop once or twice, not all afternoon. The Apidog CLI in Claude Code guide and the apidog run command reference cover the rest of the flags. Apidog’s Free plan covers teams of up to 4 users.
When the free route falls over
The free endpoint is a preview model behind a single provider. Here’s what to expect and what to do about it.
| Symptom | Likely cause | Fix |
|---|---|---|
429 after a burst of steps |
20 requests per minute | Slow the agent down or wait a minute |
429 for the rest of the day |
50 daily requests used (failed attempts count) | Wait for the UTC reset or buy 10 credits for 1,000 a day |
402 on a free model |
Negative account balance | Add credits to bring the balance above zero |
| Agent breaks on JSON output | Structured output errors | Ask for plain text, parse it yourself |
| Claude Code features misbehave | Non-Anthropic model behind Claude Code | Use OpenCode for ERNIE, or switch the model back |
The structured output row deserves a number. On November 12, 2026, OpenRouter’s model page showed a 21.70% structured output error rate and a 1.01% tool call error rate for this endpoint. Tool calling, which coding agents depend on, looks healthy. Strict JSON schemas don’t, so keep agent workflows on tools and plain text.
Speed also differs from the headline. Baidu’s description claims more than 200 tokens per second, while OpenRouter measured a P50 of 79 tokens per second on the free endpoint that day.
Finally, “Preview” is in the name for a reason. The model, its limits and the :free variant can change without notice. If the slug stops resolving, check the OpenRouter page before you debug your config. For paid or direct access, the ERNIE 5.5 Flash API guide covers Baidu Qianfan.
FAQ
Is ERNIE 5.5 Flash really free in OpenCode? Yes. The baidu/ernie-5.5-flash-preview:free endpoint costs $0 per input and output token on OpenRouter. You’re limited to 20 requests per minute and 50 per day unless you’ve bought at least 10 OpenRouter credits.
Does Claude Code officially support ERNIE 5.5 Flash? Not officially. OpenRouter documents how to point Claude Code at other models, but says the setup is only guaranteed with the Anthropic first-party provider. It runs, but expect rough edges with tools. OpenCode is the safer pick for ERNIE.
What’s the model ID for ERNIE 5.5 Flash on OpenRouter? It’s baidu/ernie-5.5-flash-preview:free for the free variant. In OpenCode, prefix it with openrouter/. In Claude Code, use it as is in the ANTHROPIC_DEFAULT_*_MODEL variables.
How many coding tasks can I finish on 50 requests a day? It depends on the task. A tightly scoped fix might take 5 to 10 agent steps, so a handful of tasks fit. Open-ended refactors can use the whole quota in one go. Name files and define “done” in your prompt.
Can I use the full 1M-token context for free? OpenRouter lists a 1,024,000-token context window for the free variant, the same as the model’s full window. Large prompts still count as one request each, which makes long-context prompts efficient on the daily cap.
Is there a free option without OpenRouter? Our ERNIE 5.5 Flash free guide compares every $0 route. Baidu also published ERNIE 5.5 Flash Base on Hugging Face, which you can serve yourself, as covered in running ERNIE 5.5 Flash locally with vLLM.



