useModel() selects the model that powers the next agent step. OpenComputer
handles provider authentication and response streaming.
useModel() is a declaration. It returns nothing and does not make a model
request itself.
Model identifiers
Use aprovider/model string:
Select a model conditionally
Because the agent re-renders for each model step, selection can respond to the current input:Keep credentials out of agent code
Do not place provider API keys inagent.ts, tools, prompts, or the React
application. OpenComputer authenticates the selected provider without adding
the credential to agent code.
For credentials used by your own HTTP tools instead of model inference, use
Secrets and outbound requests.
Use a connected model account
Organizations on Pro or Max can connect a Codex account and route eligible OpenAI models through it. Use the nativeopenai provider when you want the
connected account; Managed OpenRouter models continue to use the
openrouter/provider/model form.
See Bring your own model account (BYOK) for setup, project
enablement, billing behavior, and troubleshooting.