Feature · Provider interface

One API, every provider

Prism exposes the same provider-facing capabilities in PHP, TypeScript and Python. Choose a language once; the concepts, capability names and failure boundaries stay the same.

The PHP reference carries eighteen providers. The TypeScript and Python ports carry Anthropic, Mistral and OpenAI.

  • PHP
  • TypeScript
  • Python

Capabilities

What it does

01

Every capability, in every language

All three implementations cover text, structured output, streaming, embeddings, images, moderation, text to speech, speech to text, files, batches and fill-in-the-middle.

02

One request shape

The same fluent builder in each language: pick a provider and model, add a prompt, ask for text.

TypeScript
import { Prism } from '@particle-academy/prism';

const response = await Prism.text()
  .using('openai', 'gpt-4o')
  .withPrompt('Explain why the sky is blue in one sentence.')
  .asText();

03

Honest provider coverage

Not every capability reaches every provider. In the ports, images, moderation, text to speech, files and batches work with OpenAI, and fill-in-the-middle works with Mistral. Unsupported actions fail explicitly.

04

Errors you can branch on

TypeScript and Python failures carry a stable machine-readable code. PHP applications branch on exception type. Messages are for display, never for control flow.

05

Testable without a socket

Configuration is explicit first and environment second, and each port exposes an injectable HTTP transport so tests can run without a network connection.

06

Human-in-the-loop tools

In PHP, a tool can be client-executed or require approval. Approval is deny-by-default: a tool call that never receives an approval is refused, never executed.

How it fits

Where it sits in the ecosystem

Core is the provider interface: every other package builds on it or beside it. Harness runs agents on top of it, and the companion packages add agent sessions, storage, retrieval, external tools, browser automation and observability.

PHP requires PHP 8.2+ and Laravel. The TypeScript package requires Node 20+. The Python distribution requires Python 3.10+ and installs the prism import; install prism-ai-core, not prism-ai, which is an unrelated PyPI package.

Install

Add it to your project

  1. 01

    particle-academy/prism PHP

  2. 02

    @particle-academy/prism TypeScript

  3. 03

    prism-ai-core Python

The packages

On the registries

PHP · Packagist

particle-academy/prism

TypeScript · npm

@particle-academy/prism

Python · PyPI

prism-ai-core