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

# Effect AI SDK

> Use Phaseo from Effect TypeScript applications.

Use this guide when your application already uses Effect and you want Phaseo behind an Effect service or workflow.

## Status

Phaseo exposes OpenAI-compatible HTTP endpoints. Effect's first-party provider packages are useful when they support the provider you need directly; if your installed Effect OpenAI package does not expose a base URL option, call Phaseo through Effect's HTTP client or wrap the [OpenAI SDK](https://phaseo.app/docs/v1/guides/integrations/openai-sdk.md) in your own Effect layer.

## Install

```bash theme={null}
npm install effect @effect/platform
```

## Call Phaseo with Effect HTTP

```ts theme={null}
import { FetchHttpClient, HttpClient, HttpClientRequest } from "@effect/platform";
import { Config, Effect, Redacted } from "effect";

const generate = Effect.gen(function* () {
	const apiKey = yield* Config.redacted("PHASEO_API_KEY");
	const client = yield* HttpClient.HttpClient;

	const request = HttpClientRequest.post(
		"https://api.phaseo.app/v1/chat/completions",
	).pipe(
		HttpClientRequest.bearerToken(Redacted.value(apiKey)),
		HttpClientRequest.jsonBody({
			model: "openai/gpt-5-nano",
			messages: [{ role: "user", content: "Reply with only: ok" }],
		}),
	);

	return yield* client.execute(request).pipe(
		Effect.flatMap((response) => response.json),
	);
});

const runnable = generate.pipe(Effect.provide(FetchHttpClient.layer));
```

## Wrap the OpenAI SDK in an Effect service

If you already use the official OpenAI SDK elsewhere, keep the Phaseo configuration in one layer:

```ts theme={null}
import OpenAI from "openai";
import { Config, Effect } from "effect";

const makeClient = Effect.gen(function* () {
	const apiKey = yield* Config.string("PHASEO_API_KEY");

	return new OpenAI({
		apiKey,
		baseURL: "https://api.phaseo.app/v1",
	});
});
```

## Notes

* Use `https://api.phaseo.app/v1` for OpenAI-compatible calls.
* Keep model ids in Phaseo format, for example `openai/gpt-5-nano`.
* Use a custom Effect layer when you want a provider-style abstraction across the rest of your application.
* Test streaming and tool calls with your exact Effect package versions before production rollout.

## Related

* [OpenAI SDK](https://phaseo.app/docs/v1/guides/integrations/openai-sdk.md)
* [AI SDK](https://phaseo.app/docs/v1/guides/integrations/ai-sdk.md)
* [Streaming](https://phaseo.app/docs/v1/guides/streaming.md)


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