> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AI/ML API

> Use AI/ML API with access to 300+ models in Agno agents.

AI/ML API provides unified access to 300+ AI models, including models from OpenAI, Anthropic, Google, and DeepSeek.

## Authentication

Set your `AIMLAPI_API_KEY` environment variable. Get your key at [aimlapi.com](https://aimlapi.com/?utm_source=agno\&utm_medium=github\&utm_campaign=integration).

```bash Mac theme={null}
export AIMLAPI_API_KEY=***
```

```bash Windows theme={null}
setx AIMLAPI_API_KEY ***
```

## Example

Install the `openai` package:

```shell theme={null}
uv pip install -U agno openai
```

Use `AI/ML API` with your `Agent`:

```python agent.py theme={null}
from agno.agent import Agent
from agno.models.aimlapi import AIMLAPI

agent = Agent(
    model=AIMLAPI(id="gpt-5.2"),
    markdown=True,
)

agent.print_response("Explain how black holes are formed.")
```

## Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `id` | `str` | `"gpt-4o-mini"` | The ID of the model to use |
| `name` | `str` | `"AIMLAPI"` | The name of the model |
| `provider` | `str` | `"AIMLAPI"` | The provider of the model |
| `api_key` | `Optional[str]` | `None` | The API key for AI/ML API (defaults to AIMLAPI\_API\_KEY env var) |
| `base_url` | `str` | `"https://api.aimlapi.com/v1"` | The base URL for the AI/ML API |
| `max_tokens` | `int` | `4096` | Maximum number of tokens to generate |

`AIMLAPI` extends the OpenAI-compatible interface and supports most parameters from the [OpenAI model](https://agno-v2.mintlify.site/models/providers/native/openai/completion/overview.md), where applicable.

## Available Models

AI/ML API serves 300+ models from OpenAI, Anthropic, Google, Meta, DeepSeek, and others. The catalog changes often, so check the [model database](https://docs.aimlapi.com/api-references/model-database) for current model IDs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.