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

# LangDB

> Use the LangDB AI Gateway with Agno agents.

[LangDB](https://langdb.ai/) routes model requests through an OpenAI-compatible AI gateway. See [LangDB's Agno integration guide](https://docs.langdb.ai/getting-started/working-with-agent-frameworks/working-with-agno) for gateway configuration.

## Authentication

Create an API key in [LangDB API key settings](https://app.langdb.ai/settings/api_keys), then export the gateway credentials and API base URL.

```bash macOS / Linux theme={null}
export LANGDB_API_KEY="your_langdb_api_key"
export LANGDB_PROJECT_ID="your_langdb_project_id"
export LANGDB_API_BASE_URL="https://api.langdb.ai"
```

```powershell Windows theme={null}
$Env:LANGDB_API_KEY="your_langdb_api_key"
$Env:LANGDB_PROJECT_ID="your_langdb_project_id"
$Env:LANGDB_API_BASE_URL="https://api.langdb.ai"
```

## Example

Install the `openai` package:

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

Use `LangDB` with your `Agent`:

```python agent.py theme={null}
from agno.agent import Agent
from agno.models.langdb import LangDB

agent = Agent(
    model=LangDB(id="gpt-5-mini"),
    markdown=True
)

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

```

See the [LangDB usage examples](https://agno-v2.mintlify.site/models/providers/gateways/langdb/usage/basic.md).

## Params

| Parameter | Type | Default | Description |
| - | - | - | - |
| `id` | `str` | `"gpt-4o"` | The ID of the model to use through LangDB |
| `name` | `str` | `"LangDB"` | The name of the model |
| `provider` | `str` | `"LangDB"` | The provider of the model |
| `api_key` | `Optional[str]` | `None` | The API key for LangDB (defaults to LANGDB\_API\_KEY env var) |
| `project_id` | `Optional[str]` | `None` | The LangDB project ID (defaults to LANGDB\_PROJECT\_ID env var) |
| `base_host_url` | `str` | `"https://api.us-east-1.langdb.ai"` | The host URL for the LangDB API (defaults to LANGDB\_API\_BASE\_URL env var) |
| `base_url` | `Optional[str]` | `None` | The full base URL. Built as `{base_host_url}/{project_id}/v1` when not set |
| `label` | `Optional[str]` | `None` | Label sent as the `x-label` header with each request |

`LangDB` also supports the params of [OpenAI](https://agno-v2.mintlify.site/reference/models/openai.md).


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