# Models & Allocations

> Source: https://parallelworks.com/docs/ai/code/models

# 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 the `me:` owner, for example `me:personal/gpt-5.2-codex`.
- **Organization providers** use the `org:` owner (for example `org:openai/gpt-5.2`) and require a [budget allocation](#allocations).

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:

```bash
pw ai models ls

# As JSON, for scripting
pw ai models ls -o json
```

### The 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**: <kbd>Enter</kbd> selects the highlighted model; <kbd>Esc</kbd> first clears an active filter, then closes the picker.
- **Refresh**: <kbd>Ctrl</kbd>+<kbd>R</kbd> 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:

```text
# Open the interactive picker
/model

# Switch directly to a specific model
/model Jake.Thayne:openai/gpt-5.2
```

The 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 code` without 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 <kbd>Shift</kbd>+<kbd>Tab</kbd> persists the same way; see [Permissions](/docs/ai/code/permissions).

Defaults are stored in your `pw code` settings and can also be set per project. See [Settings](/docs/ai/code/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:

```bash
pw code --allocation PW-QA-TEST org:openai/gpt-5.2
```

### Choosing 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](/docs/ai/code/non-interactive) cannot open a picker, so an organization model without `--allocation` fails immediately:

```text
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`:

```bash
pw ai codex connect --name personal
```

This 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**: `--reconnect` re-authorizes an existing provider without changing its identity.
- **Quota**: check the subscription's usage windows from inside a session with [`/usage`](/docs/ai/code/usage-and-costs).

For other provider types and sharing options, see [AI Providers](/docs/ai/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](/docs/ai/code/subagents) for the full model resolution rules.

## Related Documentation

- [pw code Overview](/docs/ai/code): Feature overview and quick start
- [Settings](/docs/ai/code/settings): Where defaults are stored
- [Slash Commands](/docs/ai/code/slash-commands): `/model`, `/allocation`, and more
- [Non-Interactive Mode](/docs/ai/code/non-interactive): Model and allocation flags in scripts
- [Subagents](/docs/ai/code/subagents): Subagent model resolution
- [Usage & Costs](/docs/ai/code/usage-and-costs): Cost estimates and provider quotas
- [AI Providers](/docs/ai/ai-providers): Configure AI providers
