@arizeai/phoenix-client is the typed TypeScript client for Phoenix platform APIs. It ships a small root REST client plus focused module entrypoints for prompts, datasets, experiments, spans, sessions, and traces.
Install
Minimal Example
Docs And Source In node_modules
After install, a coding agent can inspect the installed package directly:
Module Map
| Import | Purpose |
|---|---|
@arizeai/phoenix-client | createClient, generated OpenAPI types, config helpers |
@arizeai/phoenix-client/prompts | Prompt CRUD plus toSDK conversion |
@arizeai/phoenix-client/datasets | Dataset creation and retrieval |
@arizeai/phoenix-client/experiments | Experiment execution and lifecycle |
@arizeai/phoenix-client/spans | Span search, notes, and span/document annotations |
@arizeai/phoenix-client/sessions | Session listing, retrieval, and session annotations |
@arizeai/phoenix-client/traces | Project trace retrieval |
Configuration
createClient() resolves Phoenix client options in this order: library defaults, environment variables, then explicit options. In most applications, the normal setup is to set PHOENIX_HOST and PHOENIX_API_KEY in the environment and call createClient() with no overrides.
Recommended Setup
Use the environment-driven path unless you have a specific reason to override client options in code.PHOENIX_HOST may look like https://app.phoenix.arize.com/s/my-space.
PHOENIX_API_KEY is converted into Authorization: Bearer <key> automatically. You do not need to build that header yourself unless you are explicitly overriding headers.
Explicit Overrides
createClient Parameters
| Field | Type | Description |
|---|---|---|
options | Partial<ClientOptions> | Explicit options passed to the underlying openapi-fetch client. |
getEnvironmentOptions | () => Partial<ClientOptions> | Optional resolver for environment-derived options. The default implementation reads process.env when available. |
Resolved Phoenix Options
These are the Phoenix-specific options this package resolves before creating the underlying OpenAPI client:| Option | Type | Description |
|---|---|---|
baseUrl | string | Base Phoenix URL. Defaults to http://localhost:6006, or PHOENIX_HOST when that environment variable is set. |
headers | ClientOptions["headers"] | Headers sent on every request. PHOENIX_API_KEY populates Authorization automatically. Explicit headers replace environment-derived headers. |
Header Override Rule
If you passoptions.headers, they replace the environment-derived header object rather than deep-merging with it. That means if you override headers and still want API key authentication, include Authorization yourself:
Environment Variables
| Variable | Maps to | Description |
|---|---|---|
PHOENIX_HOST | options.baseUrl | Base Phoenix URL, for example http://localhost:6006. |
PHOENIX_API_KEY | options.headers.Authorization | Bearer token for authenticated environments. |
PHOENIX_CLIENT_HEADERS | options.headers | Optional JSON-encoded object of additional headers to send on every request. Most setups do not need this. |
API Client
createClient() returns an openapi-fetch client that is typed against Phoenix’s generated OpenAPI schema. Use this layer when you need an endpoint that does not yet have a high-level helper.
pathsV1, componentsV1, operationsV1, Types, and PhoenixClient.
Prefer this layer when:
- you need a newly added endpoint before a helper exists
- you want direct control over route, body, and query params
- you are building thin wrappers around Phoenix routes in your own codebase
Where To Start
- Prompts, Datasets, Experiments — higher-level workflows
- Annotations — annotation concepts, then Span, Document, and Session annotations for detailed usage
- Spans, Sessions, Traces — retrieval and maintenance
Source Map
src/client.tssrc/config.tssrc/generated/api/v1.tssrc/types/core.tssrc/prompts/src/datasets/src/experiments/src/spans/src/sessions/src/traces/src/types/

