> ## 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.

# fx

> Connect Vercel Labs' fx coding agent to the Phaseo Gateway with a custom model connection.

[fx](https://fx.sh) is an open-source coding agent from Vercel Labs. It can call any OpenAI-compatible Chat Completions endpoint through a named custom connection, so Phaseo works as its model gateway. fx runs on macOS and Linux.

## 1) Configure fx

Use the Phaseo CLI to add the connection, sync compatible Phaseo models, and make Phaseo fx's active provider:

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

When fx is missing in an interactive terminal, Phaseo shows the official installer command and asks before running it. The command then:

* adds a `phaseo` connection to `~/.fx/settings.json`, preserving your other settings and connections;
* syncs up to 256 compatible Phaseo models, the most fx accepts, with their context and output limits;
* sets `phaseo` as the active fx provider and records the previous provider so removal can restore it;
* creates a `Phaseo CLI: fx API Key`, which expires after 90 days and has a \$100 monthly spend limit, and stores it in the owner-only file `~/.config/phaseo/integrations/fx.env`. Run `phaseo fx` again to replace an expired key.

Use `--catalog default` to configure only the selected model, or `--dry-run` to preview the file changes.

## 2) Load the key in your shell

fx reads custom-connection keys only from environment variables, never from its settings file. Add this line to `~/.zshrc` or `~/.bashrc` once, then open a new terminal:

```bash theme={null}
[ -f "$HOME/.config/phaseo/integrations/fx.env" ] && . "$HOME/.config/phaseo/integrations/fx.env"
```

The line sets `PHASEO_FX_API_KEY` when the file exists and does nothing after you remove the integration.

## 3) Start fx

```bash theme={null}
fx
```

Switch models with `/model`, or pick any Phaseo model ID for a single run with `FX_MODEL=<id> fx`. Switch back to another provider with `fx provider <name>`.

## Manual configuration

Add the connection to `~/.fx/settings.json`. fx does not accept custom connections in a project `.fx.json`.

```json theme={null}
{
  "provider": "phaseo",
  "providers": {
    "phaseo": {
      "protocol": "openai-chat-completions",
      "base_url": "https://api.phaseo.app/v1",
      "auth": { "type": "bearer", "env": "PHASEO_API_KEY" },
      "model_metadata": {
        "openai/gpt-5.6-terra": { "context_window": 400000, "max_output_tokens": 128000 }
      }
    }
  },
  "models": { "phaseo": "openai/gpt-5.6-terra" }
}
```

Then export `PHASEO_API_KEY` and run `fx`. Without a `context_window`, fx cannot work out when to compact the conversation, so declare limits for the models you use. The limits above are examples; take real values from the [Models endpoint](https://phaseo.app/docs/v1/api-reference/endpoint/models.md).

## Remove

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

This removes the `phaseo` connection and model, restores your previous fx provider if Phaseo is still active, deletes the key file, and revokes the key.

## Verification

* Run `fx status --json` to confirm the active provider, endpoint, and model.
* Run a small prompt such as `fx ask "Summarize README.md"` before file-editing work.
* If fx reports a missing credential, open a new terminal or check that the shell-profile line is present.
* AI Gateway-only fx features, such as gateway web search and credit checks, are not available through custom connections.


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