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

# Subscriptions

> Run AI test steps on a plan you already pay for, such as ChatGPT Plus or Pro, GitHub Copilot, OpenCode Console, SuperGrok, Claude Max or Team credits, or a Claude Code or Codex login.

Run agent steps using a plan you already pay for. Sign in once, then plug
the plan's model into `e2e.config.ts`.

| Plan | How to connect |
| --- | --- |
| ChatGPT Plus or Pro | `npx e2e login openai` |
| GitHub Copilot | `npx e2e login github-copilot` |
| OpenCode Console (OpenCode Zen and OpenCode Go) | `npx e2e login opencode-console` |
| SuperGrok or X Premium+ | `npx e2e login spacexsi` |
| Claude Max or Team (Claude Code) | API key, paid from the plan's monthly API credits, not its usage limits |
| Claude Code or Codex login | [Run steps on your coding agent](#use-your-coding-agent) |

## Set up

For a new project, run `e2e init` and select your plan
([quickstart](https://e2e.com/docs/quickstart)). For an existing project, install the packages,
sign in, and set `agents: { default: agent }` in `e2e.config.ts`.

<Tabs>
  <Tab title="ChatGPT">
<CodeGroup>
```bash npm
npm install -D ai @ai-sdk/openai
npx e2e login openai
```

```bash pnpm
pnpm add -D ai @ai-sdk/openai
pnpm exec e2e login openai
```

```bash bun
bun add -d ai @ai-sdk/openai
bunx e2e login openai
```
</CodeGroup>

```ts title="Model setup"

const agent = { model: chatgpt('gpt-6-luna') };
```
  </Tab>
  <Tab title="GitHub Copilot">
<CodeGroup>
```bash npm
npm install -D ai @ai-sdk/openai-compatible @ai-sdk/openai
npx e2e login github-copilot
```

```bash pnpm
pnpm add -D ai @ai-sdk/openai-compatible @ai-sdk/openai
pnpm exec e2e login github-copilot
```

```bash bun
bun add -d ai @ai-sdk/openai-compatible @ai-sdk/openai
bunx e2e login github-copilot
```
</CodeGroup>

```ts title="Model setup"

const agent = { model: copilot('claude-sonnet-5') };
```

Which models your plan serves is up to GitHub; see [Pick a model](#pick-a-model).
  </Tab>
  <Tab title="OpenCode Console">
<CodeGroup>
```bash npm
npm install -D ai @ai-sdk/openai-compatible @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
npx e2e login opencode-console
```

```bash pnpm
pnpm add -D ai @ai-sdk/openai-compatible @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
pnpm exec e2e login opencode-console
```

```bash bun
bun add -d ai @ai-sdk/openai-compatible @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
bunx e2e login opencode-console
```
</CodeGroup>

```ts title="Model setup"

// OpenCode Zen, billed to the workspace's credits
const agent = { model: opencodeConsole('deepseek-v4.1-flash') };
// OpenCode Go, billed to your Go subscription
const goAgent = { model: opencodeConsole('go/deepseek-v4.1-flash') };
```

On the Anthropic route, requests default `maxOutputTokens` to 8192 when
unset so the Anthropic SDK doesn't cap unknown OpenCode model IDs at 4096.
  </Tab>
  <Tab title="SuperGrok">
<CodeGroup>
```bash npm
npm install -D ai @ai-sdk/xai
npx e2e login spacexsi
```

```bash pnpm
pnpm add -D ai @ai-sdk/xai
pnpm exec e2e login spacexsi
```

```bash bun
bun add -d ai @ai-sdk/xai
bunx e2e login spacexsi
```
</CodeGroup>

```ts title="Model setup"

const agent = { model: grok('grok-4') };
```
  </Tab>
  <Tab title="Claude Max or Team">
Claude plans have no sign-in for other apps. To run agent steps on Claude
Code itself, with its own login, see [your coding agent](#use-your-coding-agent). To use the
plan's API credits in a new project, select **Skip for now** for the model in
`e2e init`. Then:

1. In claude.ai, link a Claude Console organization. On Max, go to
   Settings > Billing. On Team, an Owner or Primary Owner goes to
   Organization settings > Billing. See [Anthropic's guide](https://support.claude.com/en/articles/17154008-monthly-api-credits-for-max-and-team-plans).
2. In that organization, create an API key. Set it as `ANTHROPIC_API_KEY`.
3. Install the packages and set the model:

<CodeGroup>
```bash npm
npm install -D ai @ai-sdk/anthropic
```

```bash pnpm
pnpm add -D ai @ai-sdk/anthropic
```

```bash bun
bun add -d ai @ai-sdk/anthropic
```
</CodeGroup>

```ts title="Model setup"

const agent = { model: anthropic('claude-sonnet-5-5') };
```

Set `agents: { default: agent }` in `e2e.config.ts`.

Unused credits expire at the end of each billing cycle. Other Claude plans
have no API credits. On those, use an [API provider](https://e2e.com/docs/models), or a Claude
model through your Copilot plan.
  </Tab>
</Tabs>

## Pick a model

`e2e models` lists the model ids your login can use:

<CodeGroup>
```bash npm
npx e2e models            # every stored login
npx e2e models openai     # one provider
```

```bash pnpm
pnpm exec e2e models            # every stored login
pnpm exec e2e models openai     # one provider
```

```bash bun
bunx e2e models            # every stored login
bunx e2e models openai     # one provider
```
</CodeGroup>

The id is not always the name the vendor's app shows.

With `OPENCODE_API_KEY` set, `e2e models opencode-console` lists the ids that
key serves, the same key `opencodeConsole()` uses in place of the login.

- **Copilot** flags models that are `not enabled` (turn them on in your
  GitHub Copilot settings or ask your org admin) or `no chat or responses`
  (pick a different model). Copilot Free only serves models via
  [auto model selection](https://docs.github.com/en/copilot/get-started/plans),
  so calling a specific model ID usually fails; pick another ID or an
  [API provider](https://e2e.com/docs/models).
- **OpenCode Console** lists `go/` models only if you have Go, and hides
  disabled or free Zen models. Key `providerOptions` by `opencode` for chat
  completions models, or by `openai`, `anthropic`, or `google` otherwise.

## Sign-in help

- **ChatGPT** opens your browser. Pass `--device` to use a device code
  instead.
- **Copilot** reuses your GitHub CLI (`gh`) login. Without `gh`, pass
  `--client-id` for your own GitHub OAuth app with device flow enabled (add
  `--enterprise-url` for GitHub Enterprise).
- **OpenCode Console** prints a device code to approve in your workspace. To
  switch workspaces later, run `npx e2e logout opencode-console` and sign in
  again.
- **SuperGrok** prints a device code and verification URL.

Run `npx e2e login` with no arguments to see which accounts are connected,
and `npx e2e logout` to remove one. Expired tokens refresh automatically
(including across parallel workers). If a saved login stops working, e2e
tells you which `npx e2e login <provider>` command to rerun. See the
[CLI reference](https://e2e.com/docs/reference/cli#e2e-login) for all flags.

## CI

Use API keys in CI. Claude Max or Team already uses one. For OpenCode
Console, set `OPENCODE_API_KEY` to an OpenCode Go subscription API key, or to
a service account API key created in the Console (Service Accounts, then API
Keys). For ChatGPT, Copilot, and SuperGrok, use an [API provider](https://e2e.com/docs/models).

[`E2E_OAUTH_CREDENTIALS`](https://e2e.com/docs/reference/environment) can give a stored login to
CI, but e2e doesn't save refreshed tokens back to it. A login with a
rotating refresh token works there only for a limited time.

## Use your coding agent

`@e2e-dev/acp` runs every agent step and [`e2e explore`](https://e2e.com/docs/explore) on
Claude Code or Codex over the
[Agent Client Protocol](https://agentclientprotocol.com). The agent signs in
with its own login or API key, so e2e needs no model provider.

The agent gets `complete_step` and the built-in agent's action tools for
the verbs the target's engine supports. The runner records every action, so
steps replay from the [cache](https://e2e.com/docs/cache) without the agent. Your tests don't
change.

<Tabs>
  <Tab title="Claude Code">
Install the package and Zed's Claude Code adapter. Sign in with `claude`, or
set `ANTHROPIC_API_KEY`.

<CodeGroup>
```bash npm
npm install -D @e2e-dev/acp @agentclientprotocol/claude-agent-acp
```

```bash pnpm
pnpm add -D @e2e-dev/acp @agentclientprotocol/claude-agent-acp
```

```bash bun
bun add -d @e2e-dev/acp @agentclientprotocol/claude-agent-acp
```
</CodeGroup>

```ts title="e2e.config.ts"

export default {
  targets: [{ engine: web(), app: { url: 'http://localhost:3000' } }],
  agents: { default: { executor: claudeCode({ model: 'sonnet' }) } },
} satisfies E2EConfig;
```
  </Tab>
  <Tab title="Codex">
Install the package and the Codex adapter, then sign in with `codex login`,
or set `OPENAI_API_KEY` or `CODEX_API_KEY`. When Codex has no login,
`codex()` signs it in with that key and Codex saves it as its login (in
`CODEX_HOME/auth.json` with the default store) until you run `codex logout`.
When `APP_SERVER_LOGS` is set, `codex()` skips API-key sign-in so the
adapter log doesn't write credentials in plaintext (a saved login still
works). Pass `env: { OPENAI_API_KEY: '' }` to hide a key from Codex when
your app uses it, and start the first session on a fresh `CODEX_HOME`
alone so Codex initializes its local state cleanly.

<CodeGroup>
```bash npm
npm install -D @e2e-dev/acp @agentclientprotocol/codex-acp
```

```bash pnpm
pnpm add -D @e2e-dev/acp @agentclientprotocol/codex-acp
```

```bash bun
bun add -d @e2e-dev/acp @agentclientprotocol/codex-acp
```
</CodeGroup>

```ts title="e2e.config.ts"

export default {
  targets: [{ engine: web(), app: { url: 'http://localhost:3000' } }],
  agents: { default: { executor: codex() } },
} satisfies E2EConfig;
```
  </Tab>
</Tabs>

`claudeCode()` and `codex()` take these options:

| Option | What it does |
| --- | --- |
| `model` | Which model to use (for example `'sonnet'`). Defaults to the agent's own default; if unsupported, the error lists available models. |
| `env` | Extra environment variables for the agent process. |
| `system` | Extra instructions appended to the agent's initial prompt. |
| `name` | Label shown for this executor in reports. |

### What the agent can use

Because actions taken with a coding agent's own tools (shell, filesystem,
web search) aren't recorded and can't replay safely, e2e restricts the agent
strictly to step tools:

- Sessions open in an empty temp directory with no filesystem or terminal
  access.
- Only step-tool permission requests are approved; all others are rejected.
- If the agent invokes one of its own tools anyway, e2e immediately fails
  the step and closes the session so later steps start clean.

Both presets also disable the agent's own tools, user MCP servers, and
shell/web access for these sessions.

<Accordion title="Per-preset isolation details">
- **Claude Code:** no built-in tools, no user/project/local settings, no
  MCP servers except step tools, no saved sessions, and no permission-prompt
  bypass.
- **Codex:** read-only mode, no shell, web search, apps, plugins, browser,
  computer use, or shell snapshots (which would copy environment keys to
  disk), and all user Codex MCP servers turned off for these sessions. If
  Codex spawns a subagent, e2e fails the step like any other unauthorized
  tool.
</Accordion>

### Secrets

A secret param reaches the agent by name only. When the target's engine can
fill secrets, the agent calls `type_secret` and the runner types the value,
as for the built-in agent.

The agent's process gets your environment without the `E2E_SECRET_*` and
`E2E_USER_*` variables.

<Warning>
A secret in any other variable reaches the agent. Examples are `API_KEY`
behind `secrets: { apiKey: process.env.API_KEY }`, or the variable an
`E2E_SECRET_*` value was copied from. Keep secrets in `E2E_SECRET_*` and
`E2E_USER_*` only.
</Warning>

<AccordionGroup>
  <Accordion title="How a test runs">
One agent session serves one test attempt. The first agent step that the
cache can't replay starts it. Each later step is one more message in the
same conversation, and the session closes when the attempt ends, or
earlier on a `POLICY_DENIED` step.

Each message carries the step, its non-secret params, the steps done so
far, and the current screen. Action results say what changed on screen, and
a `screenshot` reaches the agent as an image.

An assertion can't change the screen. `observe`, `screenshot`, scrolling,
and hovering still work. The agent ends every step with `complete_step`:
`passed`, `failed`, or `blocked` with an error code, as the built-in agent
does.
  </Accordion>
  <Accordion title="Limits">
  - The Agent Client Protocol doesn't report model requests. Each prompt
    turn counts as one model call against `maxModelCalls`, with its tokens
    and cost when the agent reports them. `maxSteps` and the step timeout
    bound the turn.
  - `waitFor` and `extract` run on the agents entry's `judge` or `model`
    when it has one. Otherwise the agent answers them in a second session
    per test attempt that has no tools. There, `vision` needs an agent that takes
    images in a prompt.
  - An agents entry with an `executor` takes no `tools`, so the agent gets no
    project tools from `defineTool`.
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="Models" icon="brain" href="/models">
    Use an API key, a gateway, or a local model instead.
  </Card>
  <Card title="Agents and personas" icon="users" href="/agents">
    Give tests different models and instructions.
  </Card>
</CardGroup>
