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-key

See the AI/ML API documentation for available model IDs.

Parameters

ParameterTypeDefaultDescription
idstr"gpt-5.6-luna"Model ID
namestr"AIMLAPI"The name of the model
providerstr"AIMLAPI"The provider of the model
api_keyOptional[str]NoneAPI key. Defaults to AIMLAPI_API_KEY
base_urlstr"https://api.aimlapi.com/v1"AI/ML API base URL
max_tokensint4096Maximum 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.