> ## 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.

# OpenAI-compatible models

> Use any OpenAI-compatible endpoint with Agno agents.

Many providers support the OpenAI API format. Use the `OpenAILike` model to access them by replacing the `base_url`.

## Example

```python agent.py theme={null}
from os import getenv
from agno.agent import Agent
from agno.models.openai.like import OpenAILike

agent = Agent(
    model=OpenAILike(
        id="mistralai/Mixtral-8x7B-Instruct-v0.1",
        api_key=getenv("TOGETHER_API_KEY"),
        base_url="https://api.together.xyz/v1",
    )
)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")
```

## Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `id` | `str` | `"not-provided"` | The id of the model to use |
| `name` | `str` | `"OpenAILike"` | The name of the model |
| `provider` | `str` | `"OpenAI"` | The provider of the model |
| `api_key` | `Optional[str]` | `"not-provided"` | The API key for authentication |
| `base_url` | `Optional[str]` | `None` | The base URL for the API service |
| `collect_metrics_on_completion` | `bool` | `False` | Collect token metrics only from the final streaming chunk (for providers with cumulative token counts) |

`OpenAILike` extends the OpenAI-compatible interface and supports all parameters from [OpenAIChat](https://agno-v2.mintlify.site/models/providers/native/openai/completion/overview.md). Simply change the `base_url` and `api_key` to point to your preferred OpenAI-compatible service.

## Responses API

For providers that implement the [Open Responses API specification](https://openresponses.org), use `OpenResponses`:

```python agent.py theme={null}
from agno.agent import Agent
from agno.models.openai import OpenResponses

agent = Agent(
    model=OpenResponses(
        id="your-model-id",
        base_url="https://your-provider.com/v1",
        api_key="your-api-key",
    ),
)

agent.print_response("Share a 2 sentence horror story.")
```

The Responses API is stateless by default. Each request is independent with no `previous_response_id` chaining.

For specific providers, use the dedicated classes:

* [OllamaResponses](https://agno-v2.mintlify.site/reference/models/ollama-responses.md) for Ollama (v0.13.3+)
* [OpenRouterResponses](https://agno-v2.mintlify.site/reference/models/openrouter-responses.md) for OpenRouter

See [OpenResponses reference](https://agno-v2.mintlify.site/reference/models/open-responses.md) for full parameters.


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