---
title: "Use any OpenAI-compatible model in your coding agent"
description: "Point Aider, Cline, Roo Code, opencode, Continue and Codex CLI at any OpenAI-compatible endpoint. The exact field names for each, plus the settings that break."
url: https://broadrouter.com/blog/use-open-models-in-coding-agents/
lang: en
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Use open models in coding agents: Aider, Cline, opencode, Codex

By the BroadNet Inference team · 4 min read · Published 2026-11-14 · Updated 2026-11-16

Every major coding agent takes three values for a custom model: a base URL, an API key and a model ID. Aider uses OPENAI\_API\_BASE, Cline and Roo Code an OpenAI Compatible provider, opencode a custom provider, Continue apiBase. Codex CLI now speaks only the Responses API, so a chat-completions endpoint needs a translating proxy such as LiteLLM.

## Key takeaways

-   Three values connect any agent: base URL (https://inference.broadnet.ai/v1 for BroadNet), API key and the exact model ID.
-   Set context size and max output tokens yourself. Agents can't detect them for custom model IDs.
-   Tool-driven agents need a model with tool calling; Aider's text edit formats do not.
-   Codex CLI's config reference lists responses as the only supported wire\_api, so it can't call a chat-completions-only API directly.
-   Roo Code was archived on May 15, 2026. Zoo Code is a community fork that continues it; Cline is the upstream project.

**On this page**

1.  What do you need from the provider?
2.  Agent by agent: the exact settings
3.  How do you test the endpoint before the agent?
4.  What breaks most often?
5.  Where BroadNet Inference fits

_[image: A developer working at a laptop with code on screen, at dusk.]_

Coding agents were built for one or two big providers, but almost all of them now accept a custom OpenAI-compatible endpoint. That lets you run them on open models: cheaper per task, often with larger context, and on infrastructure you choose. This page is the map. It gives the exact setting names for each agent and links to a full step-by-step guide where we have one.

## What do you need from the provider?

Every agent below needs the same three values:

| Value | BroadNet Inference |
| --- | --- |
| [Base URL](https://broadrouter.com/glossary/base-url/) | `https://inference.broadnet.ai/v1` |
| API key | Your pay-as-you-go or plan key |
| Model ID | `broadnet/glm-5.3`, `broadnet/deepseek-v4.1-flash` or `broadnet/qwen3.8-27b` |

Two more settings matter for every agent: the **context window** and the **max output tokens**. Agents can’t detect them for custom model IDs, so they guess. Set them from the [models page](https://broadrouter.com/models/).

## Agent by agent: the exact settings

| Agent | Where you set it | Base URL field | Model field | Full guide |
| --- | --- | --- | --- | --- |
| Aider | Environment variables | `OPENAI_API_BASE` | `--model openai/<id>` | [Aider guide](https://broadrouter.com/guides/aider-unlimited-deepseek/) |
| Cline | Settings, API Provider: OpenAI Compatible | Base URL | Model | [Cline guide](https://broadrouter.com/guides/cline-openai-compatible/) |
| Roo Code / Zoo Code | Settings, API Provider: OpenAI Compatible | Base URL | Model | [Roo Code guide](https://broadrouter.com/guides/roo-code-openai-compatible/) |
| opencode | `opencode.jsonc`, `providers` | `settings.baseURL` | `models.<key>.modelID` | [opencode guide](https://broadrouter.com/guides/opencode-custom-provider/) |
| Continue | `config.yaml`, `provider: openai` | `apiBase` | `model` | [Continue guide](https://broadrouter.com/guides/continue-dev-openai-compatible/) |
| Codex CLI | `config.toml`, `[model_providers.<id>]` | `base_url` | `model` | See below |

### Aider

```bash
export OPENAI_API_BASE=https://inference.broadnet.ai/v1
export OPENAI_API_KEY=your-key
aider --model openai/broadnet/deepseek-v4.1-flash
```

The `openai/` prefix tells Aider to use the OpenAI-compatible route. Aider may warn that it doesn’t know the model’s context size; that’s expected for models outside its list.

### Cline

Pick **OpenAI Compatible** as the API Provider, then fill Base URL, API Key and Model. Open **Model Configuration** and set the context window and max output tokens. Cline can use different models for Plan and Act modes, which is a cheap way to save the more expensive model for planning.

### Roo Code and Zoo Code

Roo Code’s repository was archived on May 15, 2026, and its README says the extension was shut down. It points to **Zoo Code**, a fork started by the Roo Code community that continues its development, and to Cline. Existing Roo Code installs use the same OpenAI Compatible fields as Cline, and Roo’s changelog shows legacy XML tool calling was removed, so pick a model listed with native tool calling. For Zoo Code, follow its own docs.

### opencode

opencode adds providers in `opencode.jsonc` under `providers`, with the OpenAI-compatible package and `settings.baseURL`. BroadNet IDs already contain a slash, so use a short map key such as `glm-5.3` and put the full ID in `modelID`. Set `capabilities` and `limit` yourself; otherwise opencode falls back to assumptions.

### Continue

```yaml
models:
  - name: GLM 5.3
    provider: openai
    model: broadnet/glm-5.3
    apiBase: https://inference.broadnet.ai/v1
    apiKey: your-key
    capabilities: [tool_use]
    defaultCompletionOptions:
      contextLength: 1048576
      maxTokens: 8000
```

Continue needs `tool_use` for Agent mode. Leave it out for models without tool calling.

### Codex CLI

Codex defines providers in `config.toml` with `base_url` and `env_key`. Its current config reference says `responses` is the **only** supported `wire_api` value, and Codex now rejects `wire_api = "chat"` with an error. BroadNet Inference serves `/v1/chat/completions`, so Codex can’t call it directly. The workaround is a proxy that translates. LiteLLM’s docs say its proxy exposes `/v1/responses` and can bridge it through chat completions:

1.  Run the [LiteLLM proxy](https://broadrouter.com/guides/litellm-proxy-custom-provider/) with BroadNet as an OpenAI-compatible backend, and turn on the chat-completions bridge as LiteLLM’s Responses API page describes.
2.  Point Codex’s `base_url` at the proxy.
3.  Test a short task. Bridges can drop Responses-only features, so check tool calls work end to end.

If that sounds like too much plumbing, opencode and Aider are terminal agents that talk to chat completions natively.

## How do you test the endpoint before the agent?

When an agent fails, it’s hard to tell whether the agent or the endpoint is at fault. Check the endpoint alone first, with one request that offers a tool:

```bash
curl -s https://inference.broadnet.ai/v1/chat/completions \
  -H "Authorization: Bearer $BROADNET_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"broadnet/glm-5.3","max_tokens":2000,
       "messages":[{"role":"user","content":"Read the file README.md"}],
       "tools":[{"type":"function","function":{"name":"read_file",
         "parameters":{"type":"object","properties":{"path":{"type":"string"}},"required":["path"]}}}]}'
```

If the reply has `finish_reason: "tool_calls"` and a `read_file` call, the model and key are fine, and any remaining problem is in the agent’s settings. If it answers in plain text, pick another model for tool-driven agents. The [API request builder](https://broadrouter.com/tools/api-request-builder/) writes this request for you in curl, Python or Node.

## What breaks most often?

1.  **Wrong model ID.** Copy it exactly, including the `broadnet/` prefix.
2.  **Empty answers.** All three large models reason before answering, and reasoning counts toward the output limit. Raise it. [Why answers come back empty](https://broadrouter.com/guides/reasoning-tokens-empty-response/).
3.  **Tool-call errors.** Use a model with [tool calling](https://broadrouter.com/glossary/tool-calling/) listed. BroadNet lists tools for GLM 5.3 and Qwen3.8 27B, not for DeepSeek V4.1 Flash. More on this in [tool calling with open models](https://broadrouter.com/blog/tool-calling-open-models/).
4.  **429 errors.** A pay-as-you-go key allows 30 requests a minute and 4 in flight. Two editor windows on one key add up. See [errors and retries](https://broadrouter.com/guides/errors-and-retries/).
5.  **Responses API by default.** Some tools default to OpenAI’s newer API. Switch them to chat completions where they allow it.

Which model to choose per agent is covered in [best open model for coding agents](https://broadrouter.com/blog/best-open-model-for-coding-agents/). How the three most popular agents differ is in [Cline vs Roo Code vs Aider](https://broadrouter.com/blog/cline-vs-roo-code-vs-aider/).

## Where BroadNet Inference fits

BroadNet Inference gives every agent above one OpenAI-compatible endpoint for GLM 5.3, DeepSeek V4.1 Flash and Qwen3.8 27B, with zero data retention. Its unlimited plans make DeepSeek V4.1 Flash a flat $60 a month per session, which suits Aider and other agents that run all day. It is not a drop-in for Codex CLI without a proxy, and it doesn’t host provider-side tools such as web search. Start with a key at [inference.broadnet.ai](https://inference.broadnet.ai/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-use-open-models-in-coding-agents&utm_content=body).

Free tools for this

-   [Agent run cost estimator](https://broadrouter.com/tools/agent-run-cost-estimator/) Context growth per step, total tokens and cost of one agent run, with a DeepSeek session comparison.
-   [LLM batch job planner](https://broadrouter.com/tools/llm-batch-job-planner/) Run time, binding limit, cost per model and the flat sessions needed to finish a big job by a deadline.
-   [Flat-rate vs per-token LLM cost calculator](https://broadrouter.com/tools/flat-rate-vs-per-token-calculator/) Break-even between an unlimited plan and paying per token, per agent.
-   [LLM rate limit and concurrency calculator](https://broadrouter.com/tools/llm-rate-limit-calculator/) Which limit binds first: RPM, TPM or concurrency, with Little's law.

[All free tools](https://broadrouter.com/tools/)

## Terms in this article

[Tool calling](https://broadrouter.com/glossary/tool-calling/)

Tool calling, also called function calling, is an LLM API feature in which the model returns a structured request to run a function the developer has defined, with JSON arguments. The application runs the function and sends the result back; the model never runs code itself.

[Base URL](https://broadrouter.com/glossary/base-url/)

A base URL is the fixed root address of an API, such as https://api.example.com/v1, that a client puts in front of every endpoint path, such as /chat/completions. In OpenAI-compatible SDKs, changing the base URL, together with the API key and model ID, points the same code at a different provider.

[Pay-as-you-go](https://broadrouter.com/glossary/pay-as-you-go/)

Pay-as-you-go is a pricing model in which you pay only for what you use, metered per unit such as tokens, requests or audio minutes, with no subscription or minimum commitment. Most LLM APIs bill this way, from a prepaid balance or a periodic invoice.

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[Chat Completions API](https://broadrouter.com/glossary/chat-completions-api/)

The Chat Completions API is OpenAI's HTTP endpoint, POST /v1/chat/completions, that takes a model name and a list of role-tagged messages and returns the model's next message. Its request and response shape became the common format that OpenAI-compatible providers and SDKs reuse.

[Context window](https://broadrouter.com/glossary/context-window/)

A context window is the maximum number of tokens a language model can work with in a single request. It covers the prompt, conversation history, tool definitions, images and the generated output, including any reasoning tokens. Anything that does not fit must be cut, summarised or split across several requests.

[Open-weight model](https://broadrouter.com/glossary/open-weight-model/)

An open-weight model is a machine learning model whose trained weights are published for anyone to download and run, usually under a licence with conditions. It differs from fully open-source AI, which also releases the training code and detailed information about the training data, so others can study and reproduce the model.

[AI coding agent](https://broadrouter.com/glossary/coding-agent/)

An AI coding agent is a software tool in which a language model works on a codebase in a loop: it reads files, edits them, runs commands such as tests, reads the output and decides the next step until the task is done or a limit is reached.

## Questions

### Can I use Codex CLI with an OpenAI-compatible API?

Only if the endpoint speaks the Responses API. Codex's config reference lists responses as the only supported wire\_api value. For a chat-completions-only provider, put a proxy such as LiteLLM in front; its docs describe bridging /v1/responses through /v1/chat/completions.

### Is Roo Code still maintained?

No. Its GitHub repository was archived on May 15, 2026 and the README says the extension was shut down. It points users to Zoo Code, which it calls a fork started by the Roo Code community, and to Cline.

### Why does my agent say the model is not found?

The model ID must match the provider's ID exactly. BroadNet IDs include a prefix, for example broadnet/glm-5.3. In Aider you also add the openai/ prefix in front of it.

### Why does the agent return empty answers with an open model?

Reasoning models spend part of the output budget thinking. If max output tokens is small, the visible answer never starts. Raise it to a few thousand tokens.

### Which open model should I put in my coding agent?

For agents that work through tool calls, use a model with tool calling listed, such as GLM 5.3. For Aider, DeepSeek V4.1 Flash works well and is covered by BroadNet's unlimited plans.

## Keep reading

-   [Claude Code with open models: proxies, native endpoints and limits](https://broadrouter.com/blog/claude-code-with-openai-compatible-models/)
-   [Best open model for coding agents: pick by tools, context and cost](https://broadrouter.com/blog/best-open-model-for-coding-agents/)
-   [Cline vs Roo Code vs Aider for teams on open models (2026)](https://broadrouter.com/blog/cline-vs-roo-code-vs-aider/)
-   [Use MCP servers with OpenAI-compatible models (any provider)](https://broadrouter.com/blog/mcp-with-openai-compatible-models/)
-   [Switching to an OpenAI-compatible API: a migration checklist](https://broadrouter.com/blog/openai-compatible-api-migration-checklist/)
-   [OpenClaw and Hermes Agent on a cheap model: setup and token math](https://broadrouter.com/blog/openclaw-hermes-agent-cheap-model/)
-   [Prompt injection in coding agents: defences that actually hold](https://broadrouter.com/blog/prompt-injection-coding-agents/)
-   [Guide: Run Aider on unlimited DeepSeek V4.1 Flash](https://broadrouter.com/guides/aider-unlimited-deepseek/)
-   [Guide: Use Cline with BroadNet Inference (OpenAI Compatible provider)](https://broadrouter.com/guides/cline-openai-compatible/)
-   [Guide: Use Roo Code with BroadNet Inference (OpenAI Compatible)](https://broadrouter.com/guides/roo-code-openai-compatible/)
-   [Guide: Add BroadNet Inference to opencode as a custom provider](https://broadrouter.com/guides/opencode-custom-provider/)
-   [Guide: Use Continue with BroadNet Inference (config.yaml and apiBase)](https://broadrouter.com/guides/continue-dev-openai-compatible/)
-   [Guide: Route LiteLLM to BroadNet Inference (SDK and proxy)](https://broadrouter.com/guides/litellm-proxy-custom-provider/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-use-open-models-in-coding-agents&utm_content=page-cta) ·

**Sources**

-   [Aider docs, OpenAI compatible APIs](https://aider.chat/docs/llms/openai-compat.html)
-   [Aider docs, options reference (--message, --yes-always; checked 2026-11-14)](https://aider.chat/docs/config/options.html)
-   [Cline docs, OpenAI Compatible provider](https://docs.cline.bot/provider-config/openai-compatible)
-   [Roo Code repository, archive notice (checked 2026-11-14)](https://github.com/RooCodeInc/Roo-Code)
-   [Roo Code changelog, legacy XML tool calling removed (checked 2026-11-16)](https://github.com/RooCodeInc/Roo-Code/blob/main/CHANGELOG.md)
-   [Zoo Code repository (checked 2026-11-14)](https://github.com/Zoo-Code-Org/Zoo-Code)
-   [opencode docs, Providers](https://opencode.ai/docs/providers/)
-   [Continue docs, OpenAI provider](https://docs.continue.dev/customize/model-providers/top-level/openai)
-   [Continue docs, config.yaml reference (capabilities, defaultCompletionOptions; checked 2026-11-14)](https://docs.continue.dev/reference)
-   [Codex config reference, model\_providers and wire\_api (checked 2026-11-14)](https://learn.chatgpt.com/docs/config-file/config-reference)
-   [LiteLLM docs, /v1/responses bridge to chat completions (checked 2026-11-14)](https://docs.litellm.ai/docs/response_api)
