Factory::createPlatform() call, or through the ai.platform.edenai service in a Symfony application. This page targets Symfony AI v0.15.0.
Overview
Symfony AI ships an official Eden AI bridge for its Platform component. It covers both halves of the Eden AI V3 API:- The OpenAI-compatible endpoints,
/v3/chat/completionsand/v3/embeddings, with streaming and tool calling. - The expert models served by
/v3/universal-ai: OCR, document parsing, text to speech, speech to text, image analysis and image generation.
Installation
Every setup needs the bridge. The Symfony bundle, agents and the Wikipedia tool used below are separate packages:Configuration
Store your key in the environment, then declare the platform in your bundle configuration:Quick Start
Outside a Symfony application, there is no bundle to read the key for you. Plain PHP does not load the.env file above, so export EDEN_AI_API_KEY in your shell first: getenv() returns false when it is unset, and the key then becomes an empty string and the request answers 401. Build the platform from the factory:
Model naming
Chat and embeddings models use theprovider/model format. The platform looks each name up in a model catalog before it sends anything, and the catalog you pass decides which names work:
- The bundled
ModelCatalog, which is the default, lists exact ids such asopenai/gpt-4o-mini,anthropic/claude-sonnet-5andgoogle/gemini-2.5-flash. It has none of Eden AI’s*-latestaliases, so an alias such asopenai/gpt-latestthrows aModelNotFoundExceptionwith it. ModelApiCatalogreads the live catalog from Eden AI, so it also accepts aliases. See Dynamic Model Catalog.
openai/text-embedding-3-small, openai/text-embedding-3-large and openai/text-embedding-ada-002.
Expert models use feature/subfeature/provider, and some take the backing model as a fourth segment:
ocr/ocr/googleocr/financial_parser/affindaocr/resume_parser/openai/gpt-4oaudio/tts/amazon/neuralimage/object_detection/google
Dynamic Model Catalog
The bundledModelCatalog curates a subset of what Eden AI serves. To reach anything else, register it through the $additionalModels argument, or hand the factory a ModelApiCatalog, which discovers the current catalog from Eden AI’s public endpoints. With it, aliases work too:
Streaming
Passstream in the options and iterate the text deltas. Tokens arrive as they are produced:
Agents and Tool Calling
The platform plugs into Symfony’s Agent component, so tools work the same way they do with any other bridge. The agent decides when to call a tool, runs it, and feeds the result back to the model:OCR and Document Parsing
Pass aDocument or an Image for a local file, or a DocumentUrl or ImageUrl for a remote one. A local file is uploaded through /v3/upload before the request, so both forms behave the same from your code:
language go in the options array, or inline in the model name (ocr/ocr/google?language=en):
Not every provider reads an uploaded file.
ocr/financial_parser/openai returns a successful but empty result when its input is a file ID, while it parses the same document handed over as a URL. ocr/financial_parser/affinda reads both. Pass a DocumentUrl to the providers behaving that way.Speech and Image Models
Audio, document and image content is uploaded before the request, so a local file works the same way as a URL:Asynchronous Jobs
Speech to text runs on/v3/universal-ai/async. When a provider answers fast enough, the transcription is in the response and the call is over. Otherwise the invocation returns a JobResult, a handle you can wait on straight away or store and pick up from a worker later. toString() turns a handle into a string for storage, and JobHandle::fromString() rebuilds it:
invoke(). How long to wait, and whether to wait at all, stays your decision. Pass a webhook_receiver option to be notified out of band instead, and resolve the handle when the webhook fires.
Inside a Symfony application the job client is a service, ai.platform.job_client.edenai, and the bundle registers JobRunner as a service too:
Runnable Examples
Symfony ships working scripts for every capability above, in examples/edenai: chat, streaming, tool calling, embeddings, OCR, invoice and resume parsing, text to speech, speech to text with and without upload, object detection, logo detection and image generation.Next Steps
- Chat Completions - Core LLM endpoint
- List LLM Models - Browse available providers and models
- Expert Models - OCR, speech, image and text features
- Symfony AI documentation - The bridge reference on symfony.com