Skip to main content
Aikeedo resolves AI work through a factory: it asks for a capability interface and a model, and gets back the first registered service that supports that model. A plugin registers its own services the same way the core does.

Decide what to build

Your provider has its own API. Implement the capability interfaces you support, register them, and add your models to the registry.

The contracts

Every service implements Ai\Domain\Services\AiServiceInterface:
Then add the capability interfaces you implement: Implement only what your provider actually does. A provider can be chat-only, or image-only.

A text completion service

src/Services/AcmeTextCompletionService.php
Throw Ai\Domain\Exceptions\ApiException when the provider fails. Aikeedo surfaces it to the user instead of a generic error.

A streaming chat service

MessageServiceInterface::generateMessage() returns a generator of stream parts. Yield deltas as they arrive, and finish with a usage part carrying the cumulative cost:

Register the services

src/Plugin.php
Registration is lazy: the class is only built when a model needs it. The factory returns the first registered service that implements the requested interface and supports the model, so keep supportsModel() strict.

Make your models selectable

Services answer “can I handle this model”. What users pick from comes from the model registry, which is config/registry/base.json merged with the installation’s own config/registry/registry.json. A plugin adds its models by writing to that registry, which is exactly how custom servers are stored. Do it in the install or activate hook, not on every boot:
src/Plugin.php
Entries that don’t exist in base.json survive the merge only when they’re marked "custom": true. Without that flag your service and models disappear on the next boot.
Key fields: Remove your entries again in the uninstall hook, so the registry doesn’t keep models nothing can serve.

Credits

Aikeedo charges the workspace based on what your service reports. Use CostCalculator with the rate keys you declared, and return the cost on the response or as a UsagePart. See AI models and credits.

Testing

Your models appear under Settings → AI models and can be enabled.
A plan that grants the model lets a user select it in chat.
Streaming shows text arriving progressively, not all at once at the end.
Credits are deducted, and the amount matches the configured rates.
A provider error shows a readable message instead of a 500.
Deactivating the plugin leaves the installation working, with your models simply unavailable.