Feature · Provider interface
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.
Capabilities
01
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
The same fluent builder in each language: pick a provider and model, add a prompt, ask for text.
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
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
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
Configuration is explicit first and environment second, and each port exposes an injectable HTTP transport so tests can run without a network connection.
06
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
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
particle-academy/prism PHP
@particle-academy/prism TypeScript
prism-ai-core Python
Next
Related features
Language ports
Three languages, one contract
Core and the companion families in PHP, TypeScript and Python, held together by one shared conformance corpus.
Durable agent sessions
Agent harness
Durable sessions, threads, modes, approvals and subagents with their own budgets, for agents that outlive a request.
OpenTelemetry tracing
Observability
Generations, steps and tool calls as GenAI-convention OpenTelemetry spans, exported over OTLP.