Models in MAIAR
MAIAR contains a pluggable model layer. A model provider wraps one or many concrete models (OpenAI, Ollama, etc.) and exposes the capabilities they support—text generation, image generation, multimodal reasoning, and so on.
Plugins and the runtime consume these capabilities without needing to know which physical model they come from.
The Model Provider Base-Class​
Every provider extends the abstract ModelProvider
class that lives in @maiar-ai/core
.
The class already implements logging, capability bookkeeping and type-safe execution—your job is to
- call
super()
with metadata (id, description), - register at least one capability, and
- implement the lifecycle hooks:
init
,checkHealth
, andshutdown
.
Model Capabilities​
A capability is an atomic skill that a model can perform. Typical examples include:
text-generation
– Generate plain text from a prompt.image-generation
– Create an image from a text prompt.multi-modal-text-generation
– Combine text & images as inputs.
The runtime guarantees that only validated data reaches your implementation and that plugins only call models that actually possess the requested capability.
For an in-depth guide see the Capabilities documentation.
Official Providers​
MAIAR ships with providers for the some common back-ends.
Each provider can expose multiple capabilities depending on which model(s) you include in the models
array.
OpenAI​
import { OpenAIModelProvider } from "@maiar-ai/model-openai";
const agent = Runtime.init({
// ... other configurations
models: [
new OpenAIModelProvider({
apiKey: process.env.OPENAI_API_KEY!,
models: ["gpt-4o"] // you can list several models!
})
]
});
Ollama​
import { OllamaModelProvider } from "@maiar-ai/model-ollama";
const agent = Runtime.init({
// ... other configurations
models: [
new OllamaModelProvider({
baseUrl: "http://localhost:11434",
model: "llama2" // also works with deepseek reasoning models
})
]
});
Feel free to copy any of these providers as a starting point for your own models. Because everything revolves around capabilities, your plugins will continue to work as long as the required capability id is present – regardless of where the underlying intelligence comes from.