Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Assigning a different AI model to each OpenCode task is possible through task-specific agents and commands. Use an agent when a role has its own prompt or permissions, use a command when a repeatable action should always select a particular model, and use /models or opencode run --model for a one-off choice. Set the root model in opencode.json or opencode.jsonc only when you want a default for new work.

The important rule is precedence: a command’s explicit model wins first, then the model configured on the command’s agent, then the current session model. A session selection takes precedence over the root default. A subagent with no model of its own inherits the invoking parent session’s model, while selecting a primary agent by ID does not automatically change the session’s selected model.

What is the simplest way to route different OpenCode tasks to different models?

Create named agents for roles such as planning, implementation, and review, then assign each agent an exact provider/model identifier. Invoke the appropriate agent for each task. For a named workflow that should always use the same model, define a command with either an explicit model or an agent whose configuration includes that model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For temporary decisions, choose a model with /models inside the current session or run a single request with:

Popular on Amazon
Silkland 40Gbps USB C 90 Degree Right Angle Adapter 2 Pack, 240W USB4 | Male to Female Extender, 8K@60Hz, Thunderbolt 4/3, Steam Deck, ROG Ally, MacBook, Switch 2, iPhone 18/17/16/15, Quest 3 VR
  • 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
  • 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
  • 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
  • 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
  • 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
opencode run --model provider/model "Review this migration plan"

Replace provider/model with an ID shown by OpenCode’s model selector. These choices are separate from the persistent root default in your configuration file.

How does OpenCode decide which model a task uses?

OpenCode has several model-selection scopes. Understanding the scope prevents a common mistake: changing an agent or primary-agent selection and assuming the whole session has switched models.

Selection Scope Persists? Best use
Command model That command invocation In the command definition A repeatable action that must use one specific model
Command’s configured agent model Commands that name that agent In the agent definition Several commands sharing the same specialist role
Agent model Work delegated to that agent In the agent definition Planning, coding, research, or review roles
/models Current interactive session No; it does not rewrite configuration Trying a different model for the rest of a session
opencode run --model One CLI run No A single scripted or ad-hoc request
Root model Default for new work Yes, in opencode.json or opencode.jsonc A safe baseline when no narrower selection exists

OpenCode’s commands documentation defines command precedence as explicit command model first, the selected command agent’s model second, and the current session model third. The agents documentation explains that a subagent uses its configured model or inherits the parent session’s model when no model is configured.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What should I check before assigning models?

Confirm the exact catalog ID and provider before editing a configuration. A model name copied from a provider’s marketing page may not be the identifier OpenCode accepts.

  1. Open the model selector. Use /models in an interactive session and locate the model entry you intend to use.
  2. Copy the full ID. OpenCode expects the provider/model form. IDs are case-sensitive. Some models expose variants that can be selected with an optional #variant suffix.
  3. Check the active project. The provider must be available and the model enabled in the project where the task runs. Credentials or provider settings from another project do not automatically carry over.
  4. Check capabilities. For a role that needs tools, long context, image input, or another capability, confirm that the selected model and provider support it.

The Models documentation covers selector behavior and identifiers, while the Providers documentation explains provider configuration and availability.

How do I give each OpenCode agent its own model?

Use an agent when the task is a distinct role with its own instructions, tool access, or permissions. For example, a planning agent can use a model optimized for analysis, a coding agent can use a model suited to implementation, and a review agent can use a model selected for cautious critique.

1. Choose the roles you actually need

Start with task boundaries rather than model names. Typical boundaries include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Planner: turns a request into an ordered implementation plan and identifies risks.
  • Implementer: edits code, follows the plan, and reports changes.
  • Reviewer: checks a patch for defects, regressions, and missing tests.
  • Documentation writer: converts confirmed behavior into user-facing documentation.

Do not create an agent merely to give a different label to the same work. An agent is most useful when its instructions or permissions differ as well as its model.

Also popular on Amazon
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

2. Add a model to each agent definition

In opencode.json or opencode.jsonc, define each named agent with the exact model ID. The precise surrounding fields depend on your OpenCode configuration, so retain the required fields from the current schema. The essential part is the per-agent model value:

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "planner": {
      "model": "provider/planning-model"
    },
    "implementer": {
      "model": "provider/coding-model"
    },
    "reviewer": {
      "model": "provider/review-model"
    }
  }
}

The names in this example are illustrative. Replace them with your actual agent IDs and the selector entries available in your project. If your configuration already contains descriptions, modes, permissions, or prompts, add the model property without deleting those settings.

3. Invoke the role that matches the task

Select the named agent when starting or delegating work, using the agent controls provided by your OpenCode workflow. A planner request then uses the planner’s model, while a review request uses the reviewer’s model. The parent session’s model is used only when the selected agent has no own model.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Do not confuse agent identity with session model

Choosing a primary agent by ID does not itself change the model selected for the current session. If you need both a different primary agent and a different session model, configure the agent’s model and separately select the session model, or use a command with an explicit model.

That distinction matters in mixed workflows. A primary agent can have its own role definition while an unconfigured subagent still inherits the parent session’s model. Add explicit model values to every agent for which predictable routing is important.

How do I make an OpenCode command use a fixed model?

Commands are a good fit for repeatable named actions such as “plan-change,” “review-diff,” or “write-release-notes.” In the command definition, either set an explicit model or set an agent whose configuration already contains the desired model.

  1. Open your command configuration using the format documented in the Commands documentation.
  2. For the strongest, most local override, add the command’s explicit model property with the exact provider/model ID.
  3. If several commands should share one role, set their agent to a named agent and put the model on that agent instead.
  4. Save the configuration and invoke the command in a session where the provider is available.

The effective order is:

  1. The command’s explicit model.
  2. The model configured on the command’s selected agent.
  3. The current session model.

This order lets you share a role while still making an exception. For example, most review commands can point to a reviewer agent, while one security-audit command can specify a stronger or differently capable model directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When should a command override its agent?

Use an explicit command model when the action is exceptional or needs a hard guarantee independent of future agent changes. Use the agent model when the model is part of the role and should update consistently for every command that invokes that role.

Also popular on Amazon
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

How do I choose a model for one OpenCode session?

Type /models in the interactive session, then choose one of the enabled models listed for the current project. The selection applies to that session only; it does not rewrite opencode.json or opencode.jsonc.

This is useful when you are exploring a task and do not yet want to encode a permanent routing rule. It is also a quick way to confirm that a provider account, model ID, and project configuration are working before assigning the model to an agent or command.

Remember that a session selection is not a provider login. The selector lists models whose providers are available in that project. If a model appears in one project but not another, check the provider credentials and enabled-model settings in the project where you are working.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I select a model for one CLI invocation?

Pass --model to opencode run:

opencode run --model provider/model "Review this migration plan"

This choice applies only to that run and leaves the configured default unchanged. It is convenient for scripts, cron jobs, or a one-time request that should not affect an interactive session.

Use the exact selector ID, including any required variant suffix. If the command fails because the model cannot be found, do not shorten or re-capitalize the name; return to /models and copy the available entry for the same project.

How do I set a safe default for new OpenCode work?

Set the root model property in opencode.json or opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "provider/model"
}

The root value is a default for new work when the model is enabled and its provider is available. It is not a forced override for a model already selected in the current session, and it does not replace a command’s explicit model or a configured agent model at the narrower scope.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the root setting for a sensible baseline, not for every exception. A global default is easier to maintain when most tasks share one model; agents and commands then express the smaller set of task-specific differences.

Also popular on Amazon
BENFEI USB C Hub 5-in-1 with 4K HDMI(Certified), 100W Power Delivery, 3 USB-A, Silicone Cable, Aluminum Case Compatible with MacBook Pro/Air, iPad Pro, iMac, iPhone 15 Pro/Pro Max, XPS, Thinkpad
  • Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
  • Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
  • 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
  • 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
  • Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.

The Config documentation describes the root configuration and schema. Keep the file valid JSONC if you use comments, and verify that the model ID remains enabled after changing provider settings.

What model-routing design works for planning, coding, and review?

A practical design gives each materially different role an agent and reserves command-level overrides for exceptional workflows.

Task Recommended boundary Where to put the model Why
Break a feature into steps planner agent Agent model Every planning request follows the same reasoning policy
Implement the approved plan implementer agent Agent model Code changes and tool use stay associated with one role
Review a pull request reviewer agent Agent model Review behavior remains independent of the coding model
Run a high-scrutiny audit security-audit command Command model The audit can override the normal reviewer model
Try a model before standardizing it Interactive session /models No persistent configuration change

Details checked November 2026.

This arrangement also makes failures easier to diagnose. If planning suddenly uses the coding model, inspect the planner agent’s model. If only one command is wrong, inspect its explicit model before changing the shared agent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What happens when a model is missing or unavailable?

OpenCode can use a configured model only when its provider is available and the model is enabled in the active project. A valid-looking string is not enough: the provider account, project settings, capabilities, and exact identifier must all line up.

“Model not found” or an empty selector

  • Run /models and copy the exact entry, including capitalization and provider prefix.
  • Check whether the provider is connected in the current project rather than another project.
  • Remove a guessed #variant suffix unless that variant is actually listed.
  • Confirm that the model has not been disabled by project configuration.

The task uses the wrong model

  • Check for a command-level explicit model; it has highest command precedence.
  • Check whether the command names an agent whose model differs from the session.
  • Inspect the selected session model. A session selection overrides the root default.
  • For delegated work, check whether the subagent has its own model. Without one, it inherits the parent session’s model.

A provider works in one project but not another

Provider credentials and enabled models are project-specific in practice. Configure or connect the provider in the project that launches the task, then reopen the selector and verify that the intended model appears there.

A custom provider behaves unexpectedly

For custom providers, configure the provider’s actual endpoint model name and the capabilities it supports. OpenCode cannot independently verify whether user-entered fallback values for a custom model are accurate, so confirm the model ID, context limits, input and output capabilities, and tool support with that provider before assigning it to an important agent.

The OpenCode Console provider documentation provides additional provider-specific guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How should I verify that routing is configured correctly?

Verify one scope at a time instead of changing several settings together.

Also popular on Amazon
𝟒𝐏𝐚𝐜𝐤 𝐔𝐩𝐠𝐫𝐚𝐝𝐞𝐝 USB to USB C Adapter,Type-C Female to A Male Charger Converter for iPhone 18 Charger,iWatch Ultra SE 9 10,iPhone 17 Pro Max 16 15 14,Samsung S25,AirPods,iPad,Car,Xbox
  • 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
  • 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
  • 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
  • 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
  • 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
  1. Verify availability: open /models and confirm every intended model is listed in the active project.
  2. Verify the root default: inspect the root model value and confirm it uses the exact catalog ID.
  3. Verify each agent: check that every role requiring deterministic routing has its own model property.
  4. Verify commands: look for an explicit command model before assuming the command inherits its agent’s model.
  5. Verify the session: remember that a model selected with /models applies to the current session and can outrank the root default.
  6. Verify delegation: an unconfigured subagent should be expected to inherit the parent session model; that is normal behavior, not a failed assignment.

Keep a short routing note in the project documentation listing each agent, its purpose, and its model ID. That makes later configuration reviews faster and exposes accidental duplication or stale IDs.

Which method should I use for each situation?

Choose based on how long the decision should last and whether the task has a distinct role.

  • Use an agent when the work has its own instructions, tools, permissions, or identity, such as planning versus code review.
  • Use a command with an explicit model when one repeatable action must always select a particular model, regardless of the agent or session.
  • Use a command that names an agent when several actions should share the same role and model.
  • Use /models when you want to switch the current interactive session without editing configuration.
  • Use opencode run --model for a single CLI invocation, script, or automated job.
  • Use the root model for the default that should apply when no narrower choice exists.

The most maintainable setup usually combines them: a root baseline, explicit models on important agents, and command-level overrides only for deliberate exceptions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What are the key rules to remember?

OpenCode does not require one model for an entire project. Model selection is hierarchical and task-aware, but each narrower selection must use a real, available catalog ID.

  • A configured agent can use a different model from the global default.
  • A subagent without its own model inherits the invoking parent session’s model.
  • Selecting a primary agent by ID does not automatically change the selected session model.
  • Command precedence is explicit command model, selected agent model, then current session model.
  • /models changes the current session; opencode run --model changes one CLI run; neither edits the persistent root default.
  • Provider availability and credentials can differ by project, so verify the exact selector entry where the task will run.

Frequently Asked Questions

Can two OpenCode agents use the same model but have different instructions?

Yes. Agent identity and model identity are separate settings, so multiple agents can point to one provider/model while differing in prompts, permissions, or tool access. This is useful when the role boundary matters more than model specialization.

Does changing the root model update an already open OpenCode session?

Not necessarily. The root value is a default for new work, while a model already selected in the current session takes precedence. Start a new session or select the intended model explicitly when you need an immediate change.

Can I use a model variant for only one task?

Yes, if that model exposes variants, use the exact provider/model#variant entry for the agent, command, or CLI invocation. Verify the suffix in the current model selector rather than guessing it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does a delegated task still use my parent model?

A subagent inherits the parent session’s model when its own configuration has no model value. Add an explicit model to that subagent’s agent definition if the delegated role must always use a different model.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply. Prices as of December 6, 2026 10:01 am GMT.