mirror of
https://github.com/tester-army/e2e.git
synced 2026-11-22 07:55:36 +08:00
* feat(oauth): sign in with OpenCode Console for Zen and Go models * fix(oauth): keep the Console refresh token, isolate tests from OPENCODE_API_KEY A refresh grant without a refresh_token now keeps the previous one, as the ChatGPT and SpaceXAI providers do. The vendor test helper blanks OPENCODE_API_KEY so a key in the shell no longer replaces the stored login under test. Docs and changeset now say the models listing covers Zen and Go only, and that MISCONFIGURED needs a readable workspace config.
246 lines
7.7 KiB
Plaintext
246 lines
7.7 KiB
Plaintext
---
|
|
title: Subscriptions
|
|
description: Use your ChatGPT, GitHub Copilot, OpenCode Console, 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` |
|
|
| OpenCode Console (OpenCode Zen and OpenCode Go) | `npx e2e login opencode-console` |
|
|
| 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">
|
|
<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"
|
|
import { chatgpt } from 'e2e/oauth/chatgpt';
|
|
|
|
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"
|
|
import { copilot } from 'e2e/oauth/copilot';
|
|
|
|
const agent = { model: copilot('claude-sonnet-5') };
|
|
```
|
|
</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"
|
|
import { opencodeConsole } from 'e2e/oauth/opencode-console';
|
|
|
|
// 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') };
|
|
```
|
|
</Tab>
|
|
<Tab title="SuperGrok">
|
|
<CodeGroup>
|
|
```bash npm
|
|
npm install -D ai @ai-sdk/xai
|
|
npx e2e login spacexai
|
|
```
|
|
|
|
```bash pnpm
|
|
pnpm add -D ai @ai-sdk/xai
|
|
pnpm exec e2e login spacexai
|
|
```
|
|
|
|
```bash bun
|
|
bun add -d ai @ai-sdk/xai
|
|
bunx e2e login spacexai
|
|
```
|
|
</CodeGroup>
|
|
|
|
```ts title="Model setup"
|
|
import { grok } from 'e2e/oauth/grok';
|
|
|
|
const agent = { 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:
|
|
|
|
<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>
|
|
|
|
Each line is the id to pass to `chatgpt()`, `copilot()`, `opencodeConsole()`,
|
|
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;
|
|
OpenCode Console lists the Zen and Go models your workspace has enabled,
|
|
each tagged with the plan that pays for it, and leaves out custom providers; SuperGrok lists the language models the
|
|
token reaches.
|
|
|
|
Copilot also lists models that `copilot()` cannot call, and marks them:
|
|
|
|
- `not enabled`: the model is off for your plan. Turn it on in your Copilot
|
|
settings on GitHub, or ask your organization admin if they manage your
|
|
seat.
|
|
- `no chat or responses`: Copilot serves the model only over APIs `copilot()`
|
|
does not speak, such as Anthropic's Messages API, so pick another model.
|
|
|
|
On its first call `copilot()` picks the endpoint from the model's entry in
|
|
this same listing: chat completions for most models, Copilot's Responses API
|
|
for the ones served only there. When the listing cannot be read, that call
|
|
goes over chat completions and the next call reads it again. The Responses
|
|
call runs through `@ai-sdk/openai`, so install it beside
|
|
`@ai-sdk/openai-compatible` to use those models; `e2e init` adds both.
|
|
|
|
### OpenCode Console
|
|
|
|
One OpenCode Console sign-in serves both plans billed through it:
|
|
|
|
- A bare id, such as `deepseek-v4.1-flash`, is an OpenCode Zen model, paid from
|
|
the workspace's credits.
|
|
- A `go/` id, such as `go/deepseek-v4.1-flash`, is an OpenCode Go model, paid
|
|
from the Go subscription. Go models are listed only when you hold the
|
|
workspace's Go subscription.
|
|
|
|
The list leaves out models your workspace has turned off, and Zen's free
|
|
models, which OpenCode keeps for its own clients.
|
|
|
|
On its first call `opencodeConsole()` reads the workspace config to pick the
|
|
model's API: chat completions, OpenAI Responses (`@ai-sdk/openai`), Anthropic
|
|
Messages (`@ai-sdk/anthropic`), or Google (`@ai-sdk/google`). Install those
|
|
beside `@ai-sdk/openai-compatible`; `e2e init` adds all four. Set
|
|
`providerOptions` under the key of that API: `opencode` for chat completions
|
|
models, on Zen and Go alike, and `openai`, `anthropic`, or `google` for the
|
|
others.
|
|
|
|
## 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.
|
|
- OpenCode Console prints a device code and opens the page where you approve
|
|
it and pick the workspace; the page shows e2e as an unknown client. To
|
|
switch workspaces, run `npx e2e logout opencode-console` and sign in again.
|
|
- 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. When a vendor rejects the saved token, or its refresh
|
|
token, the run fails with `LOGIN_REQUIRED` and names the
|
|
`npx e2e login <provider>` command to run.
|
|
|
|
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.
|
|
|
|
For OpenCode Console in CI, create a service account API key in the Console
|
|
(Service Accounts, then API Keys) and set it as `OPENCODE_API_KEY`;
|
|
`opencodeConsole()` uses it instead of the stored login. `e2e models` still
|
|
reads the stored login.
|
|
|
|
<CodeGroup>
|
|
```bash npm
|
|
OPENCODE_API_KEY=oc_sk_... npx e2e run
|
|
```
|
|
|
|
```bash pnpm
|
|
OPENCODE_API_KEY=oc_sk_... pnpm exec e2e run
|
|
```
|
|
|
|
```bash bun
|
|
OPENCODE_API_KEY=oc_sk_... bunx e2e run
|
|
```
|
|
</CodeGroup>
|