Skip to main content
@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, traces, and CI-friendly dataset-backed eval tests.

Install

Minimal Example

Docs And Source In node_modules

After install, a coding agent can inspect the installed package directly:
That gives the agent version-matched docs plus the exact implementation and generated API types that shipped with your project.

Module Map

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. Use the environment-driven path unless you have a specific reason to override client options in code.
If you’re using Phoenix Cloud, 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

Use explicit options when you want configuration to live in code or when you need to override the environment for a specific client instance.

createClient Parameters

Resolved Phoenix Options

These are the Phoenix-specific options this package resolves before creating the underlying OpenAPI client:

Header Override Rule

If you pass options.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

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.
The root export exposes generated API types: 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

Source Map

  • src/client.ts
  • src/authFetch.ts
  • src/config.ts
  • src/generated/api/v1.ts
  • src/types/core.ts
  • src/prompts/
  • src/datasets/
  • src/experiments/
  • src/spans/
  • src/sessions/
  • src/traces/
  • src/vitest/
  • src/jest/
  • src/testing/
  • src/types/