Download the PHP package sudhaus7/ai-eloki-platform without Composer
On this page you can find all versions of the php package sudhaus7/ai-eloki-platform. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ai-eloki-platform
Eloki Platform
eloki.net platform bridge for Symfony AI.
Eloki exposes an OpenAI-compatible chat API in front of an Ollama backend, so this bridge combines an OpenAI-shaped request/response contract with Ollama-style option handling and NDJSON streaming.
This bridge includes support for:
- Chat completions (
POST api/chat/completions) - Embeddings (
POST api/embeddings) - Streaming responses (NDJSON deltas)
- Reasoning / thinking output
- Tool calling
- Structured output (JSON schema)
- Dynamic model discovery (
GET api/models)
Installation
Requires PHP 8.2+, symfony/ai-platform ^0.12 and symfony/http-client ^7.3|^8.0.
Set your API key in the environment so the bridge can pick it up without extra wiring:
Usage
The endpoint is fixed at https://demo.eloki.net/ — the factory takes no $endpoint argument.
Factory::createProvider() returns the bare provider if you want to compose it with other providers
in your own Platform instance. Both factory methods accept an $apiKey, a custom
HttpClientInterface, Contract and EventDispatcherInterface.
Authentication
The API key is sent as Authorization: Bearer …. If you do not pass apiKey explicitly, the bridge
falls back to $_ENV['ELOKI_API_KEY']:
Factory::createHttpClient() exposes the same wiring on its own — a base-URI-scoped
EventSourceHttpClient with the bearer token applied — if you need a preconfigured client outside
the platform, e.g. to build a standalone ModelCatalog:
Without a client and without ELOKI_API_KEY in the environment, ModelCatalog throws an
InvalidArgumentException.
Streaming
Streaming is opt-in — the bridge sends stream: false unless you ask for it:
Text, thinking and completed tool calls are emitted as separate deltas, followed by token usage and
a finish_reason metadata delta.
Options
Option handling follows Ollama's split between top-level request keys and nested model options.
Known top-level keys (stream, format, keep_alive, tools, think, logprobs,
top_logprobs for chat; truncate, keep_alive, dimensions for embeddings) stay at the root of
the payload, everything else is moved into options:
Models
The model catalog is resolved at runtime from GET api/models — there is no hardcoded model list.
Capabilities are derived from the server's model metadata:
| Eloki / Ollama capability | Symfony AI capability |
|---|---|
completion |
INPUT_MESSAGES |
embedding |
EMBEDDINGS |
tools, builtin_tools |
TOOL_CALLING |
thinking |
THINKING |
vision |
INPUT_IMAGE |
Models that report completion additionally get OUTPUT_TEXT and OUTPUT_STREAMING, and every
non-embedding model gets OUTPUT_STRUCTURED. Presets (models flagged
preset: true) are read from info.meta.capabilities, plain models from ollama.capabilities.
A model whose metadata carries no capabilities raises an InvalidArgumentException — that usually
means the Eloki server is too old and needs an upgrade.
Resources
License
MIT