Models & Allocations
pw code can run on any chat model your AI providers offer. This page covers how models are identified, how to discover and switch between them, and how budget allocations work for organization providers.
Model IDs
Model IDs have the form owner:provider-name/model-name:
- Personal providers are addressed by their owner's username, for example
Jake.Thayne:openai/gpt-5.2. - Your own connected subscriptions (such as a ChatGPT/Codex subscription connected with
pw ai codex connect) appear under theme:owner, for exampleme:personal/gpt-5.2-codex. - Organization providers use the
org:owner (for exampleorg:openai/gpt-5.2) and require a budget allocation.
An ID passed to pw code must contain a /; anything else is rejected as an invalid model format.
Discovering Models
List every model available to you across all configured providers:
pw ai models ls
# As JSON, for scripting
pw ai models ls -o jsonThe Interactive Model Picker
If you start pw code without specifying a model, the model picker opens automatically. You can also open it any time in a session by running /model with no arguments, or from the Model row in /settings.
In the picker:
- Grouped by provider: each row shows the friendly name and the full model ID.
- Type to filter: the list narrows as you type, matching against both the model ID and its display name.
- Select or dismiss: Enter selects the highlighted model; Esc first clears an active filter, then closes the picker.
- Refresh: Ctrl+R refreshes the list from the platform; the fetched list is cached for the rest of the session.
Switching Models In-Session
Use the /model slash command:
# Open the interactive picker
/model
# Switch directly to a specific model
/model Jake.Thayne:openai/gpt-5.2The new model applies to all subsequent turns in the conversation.
Which Choices Persist
- A model chosen from the picker is saved as your default and is used the next time you start
pw codewithout specifying a model. - A model set by typing
/model <model-id>applies to the current session only. - Allocation choices persist either way, whether picked from the allocation picker or set with
/allocation <name>. - The permission mode cycled with Shift+Tab persists the same way; see Permissions.
Defaults are stored in your pw code settings and can also be set per project. See Settings.
Allocations
Models from organization providers (org: IDs) draw their spend from a budget allocation. Personal provider models do not use allocations.
On the command line, pass the allocation name with the --allocation flag:
pw code --allocation PW-QA-TEST org:openai/gpt-5.2Choosing an Allocation Interactively
In an interactive session, you never have to know the allocation name up front. When you select an organization model (or send a message with one active) and no allocation is set, pw code fetches the allocations you are permitted to use and prompts you to pick one. Each row shows the allocation's spend so far against its total budget. You can also open the picker at any time with /allocation, or change it directly with /allocation <name>.
If no allocations are available to you, pw code reports it and asks you to contact your organization admin for access.
Allocations in One-Shot Runs
A one-shot (non-interactive) run cannot open a picker, so an organization model without --allocation fails immediately:
an allocation is required for org provider models. Use --allocation to specify one.
Run 'pw code' without --prompt to browse available allocations interactively.Using a Personal ChatGPT/Codex Subscription
You can connect a personal ChatGPT/Codex subscription as an AI provider and use its models in pw code:
pw ai codex connect --name personalThis starts a device-code sign-in: open the printed URL, enter the code, and authorize. Once connected, the subscription's models become available as me:personal/<model>, and usage draws on the subscription's own quota rather than a platform budget.
- Reconnect:
--reconnectre-authorizes an existing provider without changing its identity. - Quota: check the subscription's usage windows from inside a session with
/usage.
For other provider types and sharing options, see AI Providers.
Default Model for Subagents
Delegated subagent tasks can run on a different default model than your session, which is useful for pointing mechanical background work at a cheaper or faster model. Set it via the Subagent model row in /settings (the subagentModel setting); leave it empty to have subagents inherit the session's model. See Subagents for the full model resolution rules.
Related Documentation
- pw code Overview: Feature overview and quick start
- Settings: Where defaults are stored
- Slash Commands:
/model,/allocation, and more - Non-Interactive Mode: Model and allocation flags in scripts
- Subagents: Subagent model resolution
- Usage & Costs: Cost estimates and provider quotas
- AI Providers: Configure AI providers