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

# AI SDK

> Use the official Phaseo provider for the Vercel AI SDK.

Phaseo ships an official Vercel AI SDK provider in the `@phaseo/ai-sdk-provider` package.

## Install

AI SDK 7 and the native Phaseo `ProviderV4` implementation are the default for new projects:

```bash theme={null}
npm install @phaseo/ai-sdk-provider
```

The unversioned Phaseo package follows npm's `latest` tag and therefore selects the active AI SDK 7-compatible provider line. The package declares AI SDK 7 as a peer dependency, which npm installs automatically.

### AI SDK 6 maintenance line

AI SDK 6 uses the previous `ProviderV3` contract. Install its tagged compatibility release:

```bash theme={null}
npm install @phaseo/ai-sdk-provider@ai-sdk-v6
```

Phaseo provider 1.x remains in maintenance while AI SDK 7 is current. When AI SDK 8 reaches a stable release, Phaseo will mark the 1.x line as deprecated on npm. Deprecation will not remove existing releases; any eventual end-of-support decision will be announced separately.

### AI SDK 5 compatibility

AI SDK 5 accepts the older ProviderV2 contract. Install Phaseo's dedicated compatibility release:

```bash theme={null}
npm install @phaseo/ai-sdk-provider@ai-sdk-v5
```

If your package manager is configured not to install peer dependencies automatically, install the matching `ai` major (`ai@^7`, `ai@^6`, or `ai@^5`) separately.

```ts theme={null}
import { phaseo } from "@phaseo/ai-sdk-provider";
import { generateText } from "ai";

const result = await generateText({
	model: phaseo("openai/gpt-4o"),
	prompt: "Summarize this in one sentence.",
});
```

The v5 line supports text generation and streaming, tools, structured output, embeddings, images, transcription, and speech. Standardized reranking is available in the AI SDK 6 and 7 provider contracts.

## Basic usage

```ts theme={null}
import { phaseo } from "@phaseo/ai-sdk-provider";
import { generateText } from "ai";

const result = await generateText({
	model: phaseo("openai/gpt-4o"),
	prompt: "Summarize this in one sentence.",
});
```

## Supported AI SDK 7 surfaces

Provider 2.x implements and tests AI SDK 7's native v4 contracts for:

* Text generation and streaming
* Provider-agnostic reasoning settings and reasoning output
* Standard function tools, streamed tool inputs, and tool-result round trips
* JSON and JSON Schema structured output
* Text and image file inputs using V7's tagged file-data format
* URL citation sources
* Embeddings and image generation
* Reranking
* Transcription and speech generation
* Provider metadata, usage, request headers, abort signals, and raw stream chunks

Use model ids from the [Models endpoint](https://phaseo.app/docs/v1/api-reference/endpoint/models.md). Individual capabilities still depend on the selected model and upstream provider.

## Reranking and capability boundaries

Reranking is available through the AI SDK `rerank()` helper and `phaseo.rerankingModel(modelId)`. ProviderV4 capabilities that require Phaseo API surfaces not currently exposed—managed file uploads and references, skills, and provider-executed tool definitions, results, or approval responses—are not advertised. Application-executed function tools continue to use the AI SDK's normal execution and approval flow. Unsupported provider-specific or custom prompt parts fail with a clear error instead of being silently discarded.

```typescript theme={null}
import { rerank } from "ai";
import { phaseo } from "@phaseo/ai-sdk-provider";

const result = await rerank({
  model: phaseo.rerankingModel("voyage/rerank-2"),
  query: "Which document is about TypeScript?",
  documents: [
    "TypeScript adds static types to JavaScript.",
    "Rust is a systems programming language.",
  ],
  topN: 1,
});
```


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