> ## Documentation Index
> Fetch the complete documentation index at: https://docs-preview.webcompute.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Model setup

> Configure a reusable model profile for web agent browsing from the CLI and optional MCP run_web_agent.

`web agent` needs a model profile or one-off model flags. Model setup is separate from your Webcompute API key and from SDK application configuration.

## Interactive setup

```bash theme={null}
web model setup
```

The guided setup starts with:

```text theme={null}
Set up an AI model for web agent browsing.

Choose a provider and model, then save them as a model profile for use with the web agent CLI or MCP when run_web_agent is enabled.

Your API key is read from your environment and not stored here.
```

A model profile stores the provider route, model ID, and the name of the environment variable containing your provider key. It does not store the raw provider key.

After saving a profile named `browsing`, run:

```bash theme={null}
web agent --profile browsing --url https://example.com "Tell me the page title."
web model doctor browsing
web mcp setup claude --surface agent --model browsing --instructions
```

The MCP command is needed when you want a host to use Webcompute as a browser subagent through `run_web_agent`.

Inspect profiles later:

```bash theme={null}
web model list
web model show browsing
web model show browsing --sdk
web model doctor browsing
```

Use `web model show <profile> --sdk` to regenerate copy-paste SDK code that uses the same route, model, and env-var name explicitly.

Use `web model use <profile>` when you have more than one saved profile:

```bash theme={null}
web model use browsing
```

## One-off model flags

Pass model access directly when you do not want to save a profile:

```bash theme={null}
web agent \
  --route openrouter \
  --model openai/gpt-5.4-mini \
  --api-key-env OPENROUTER_API_KEY \
  --url https://www.sec.gov/edgar/search/ \
  --allow-domain sec.gov \
  "Find Apple's latest 10-Q filings."
```

Supported routes:

| Route               | Use it for                 |
| ------------------- | -------------------------- |
| `openai`            | OpenAI API keys            |
| `openrouter`        | OpenRouter model routing   |
| `openai-compatible` | OpenAI-compatible gateways |
| `anthropic`         | Anthropic API keys         |
| `google`            | Google Gemini API keys     |

For compatible gateways, use `--model-api chat-completions` or `--model-api responses` when the gateway needs an explicit API family.

## Environment variables

Provider keys should live in environment variables:

```bash theme={null}
export OPENROUTER_API_KEY=your_provider_key
```

The CLI stores the environment variable name in the model profile. It does not need the raw provider key in your browsing goal.

For scripted setup, pass all required values:

```bash theme={null}
web model setup \
  --name browsing \
  --route openrouter \
  --model openai/gpt-5.4-mini \
  --api-key-env OPENROUTER_API_KEY \
  --default
```

`web model setup --json` is non-interactive and machine-readable. Add `--quiet` to a fully specified setup command when scripts should save the profile without success prose or SDK snippets.

## Where model profiles apply

Model profiles are used by:

* `web agent`.
* MCP when `run_web_agent` is enabled on the `agent` or `all` surface.

SDK `web.agent()` requires explicit model config. SDK code can use the same route, model, and credential env-var values. The SDK model-profile helpers work with profile-shaped config supplied by your application code; they do not load local CLI config.

Reference: [CLI command reference](/reference/cli-command-reference).
