Decide what to build
- A new provider
- An OpenAI-compatible server
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 implementsAi\Domain\Services\AiServiceInterface:
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
supportsModel() strict.
Make your models selectable
Services answer “can I handle this model”. What users pick from comes from the model registry, which isconfig/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
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. UseCostCalculator 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.