AI/ML API
Configure models served through the AI/ML API OpenAI-compatible endpoint.
AIMLAPI configures the AI/ML API endpoint.
Run the dependency and key setup below before this model-configuration fragment:
from agno.models.aimlapi import AIMLAPI
model = AIMLAPI(id="gpt-5.6-luna")uv pip install -U agno openai
export AIMLAPI_API_KEY=your-api-keySee the AI/ML API documentation for available model IDs.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | str | "gpt-5.6-luna" | Model ID |
name | str | "AIMLAPI" | The name of the model |
provider | str | "AIMLAPI" | The provider of the model |
api_key | Optional[str] | None | API key. Defaults to AIMLAPI_API_KEY |
base_url | str | "https://api.aimlapi.com/v1" | AI/ML API base URL |
max_tokens | int | 4096 | Maximum number of tokens to generate |
AIMLAPI extends OpenAILike and accepts all of its parameters.
The adapter merges fixed attribution headers from AIMLAPI_HEADERS with default_headers; caller overrides win case-insensitively. See the provider guide.