Files
e2e/docs/subscriptions.mdx
T

111 lines
3.5 KiB
Plaintext

---
title: Subscriptions
description: Use your ChatGPT, GitHub Copilot, or SuperGrok subscription for agent steps.
---
Use an existing subscription without a separate API key. Choose your plan
in `e2e init`, install dependencies, then sign in:
| Subscription | Command |
| --- | --- |
| ChatGPT Plus or Pro | `npx e2e login openai` |
| GitHub Copilot | `npx e2e login github-copilot` |
| SuperGrok or X Premium+ | `npx e2e login spacexai` |
Follow the terminal prompts, then run `npx e2e run`. Agent calls use your
plan's usage limits. For a new project, start with the [quickstart](/quickstart).
Claude subscriptions are not supported. To use Claude, configure an
[API provider](/models) or a model available through your Copilot plan.
## Set up an existing project
`e2e init` leaves existing configs intact. To switch an existing project to
a subscription, install the AI SDK provider package the model wraps and
replace the model in your config. The sign-in flows ship with `e2e` itself:
<Tabs>
<Tab title="ChatGPT">
```bash
npm install -D ai @ai-sdk/openai
npx e2e login openai
```
```ts title="Model setup"
import { createAgent } from 'e2e/agent';
import { chatgpt } from 'e2e/oauth/chatgpt';
const agent = createAgent({ model: chatgpt('gpt-5.6-luna') });
```
</Tab>
<Tab title="GitHub Copilot">
```bash
npm install -D ai @ai-sdk/openai-compatible
npx e2e login github-copilot
```
```ts title="Model setup"
import { createAgent } from 'e2e/agent';
import { copilot } from 'e2e/oauth/copilot';
const agent = createAgent({ model: copilot('claude-sonnet-5') });
```
</Tab>
<Tab title="SuperGrok">
```bash
npm install -D ai @ai-sdk/xai
npx e2e login spacexai
```
```ts title="Model setup"
import { createAgent } from 'e2e/agent';
import { grok } from 'e2e/oauth/grok';
const agent = createAgent({ model: grok('grok-4') });
```
</Tab>
</Tabs>
Set `agents: { default: agent }` in `e2e.config.ts`. Choose a model
available to your account.
## Pick a model
The constructor takes the id the vendor uses, which is not always the name
the app shows. Ask the vendor which ids your login serves:
```bash
npx e2e models # every stored login
npx e2e models openai # one provider
```
Each line is the id to pass to `chatgpt()`, `copilot()`, or `grok()`, the
vendor's display name, and what it says about the model: reasoning levels,
vision, preview, or hidden. ChatGPT lists what the Codex backend serves your
plan; Copilot lists the chat models of your plan; SuperGrok lists the
language models the token reaches.
## Sign-in help
- ChatGPT opens a browser to sign in. Use `npx e2e login openai --device`
to sign in with a device code instead.
- Copilot reuses your GitHub CLI login. If you do not use `gh`, pass
`--client-id` for your own GitHub OAuth app with device flow enabled.
Use `--enterprise-url` for GitHub Enterprise.
- SuperGrok prints a device code and the URL where you enter it.
Run `npx e2e login` to choose a provider and see which accounts are signed
in. Run `npx e2e logout` to remove a saved login.
## Saved credentials and CI
Logins are stored in `~/.config/e2e/oauth.json`, or under
`$XDG_CONFIG_HOME`, with file permissions restricted to your user. Tokens
refresh automatically.
Use API keys in CI. `E2E_OAUTH_CREDENTIALS` can supply credential JSON
instead of the local file, but refreshed tokens are not saved back to that
variable. A value containing a rotating refresh token cannot be reused
indefinitely. See [CLI reference](/reference/cli#e2e-login) for all sign-in
options.