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

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# OpenCode

> Connect OpenCode to the Phaseo Gateway with a custom OpenAI-compatible provider.

OpenCode can call Phaseo through a custom OpenAI-compatible provider. Use this setup when you want OpenCode model selection, usage, and routing to go through one Phaseo API key.

## 1) Configure OpenCode

Install OpenCode from its official release, then use the Phaseo CLI to add a global provider, sync all compatible Phaseo models, and store a dedicated key in OpenCode's credential store:

```bash theme={null}
phaseo opencode --model openai/gpt-5.6-terra
```

The command creates a `Phaseo CLI: OpenCode API Key` that expires after 90 days and has a \$100 monthly spend limit (run `phaseo opencode` again to replace an expired key), preserves unrelated OpenCode settings and credentials, and supports `--dry-run`. It updates an existing global `opencode.jsonc` when present, otherwise it uses `~/.config/opencode/opencode.json`.

Use `--catalog default` to configure only the selected model.

The CLI retains its own copy in the OS credential store and revokes the key when you run `phaseo integrations remove opencode`.

## Manual configuration

Create or update `opencode.json` in your project, or your global OpenCode config:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "model": "phaseo/openai/gpt-5.5",
  "provider": {
    "phaseo": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Phaseo",
      "options": {
        "baseURL": "https://api.phaseo.app/v1",
        "apiKey": "{env:PHASEO_API_KEY}"
      },
      "models": {
        "openai/gpt-5.5": {
          "name": "GPT-5.5"
        },
        "openai/gpt-5.4-mini": {
          "name": "GPT-5.4 Mini"
        },
        "anthropic/claude-sonnet-4.5": {
          "name": "Claude Sonnet 4.5"
        }
      }
    }
  }
}
```

Add or remove models from the `models` object to match the Phaseo model ids you want in OpenCode.

## 2) Start OpenCode

Restart OpenCode after editing the config, then choose the Phaseo model from `/models`.

Remove only the Phaseo provider later with:

```bash theme={null}
phaseo integrations remove opencode
```

## Verification

* Run a small prompt before using file-editing workflows.
* If a model is rejected, confirm the exact id with the [Models endpoint](https://phaseo.app/docs/v1/api-reference/endpoint/models.md).
* If authentication fails, rerun `phaseo opencode` and check `opencode auth list`.

## Add docs context

To let OpenCode read Phaseo docs during a session, add the [Docs MCP](https://phaseo.app/docs/v1/guides/integrations/docs-mcp.md) server as well.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.