LangDB
Use the LangDB AI Gateway with Agno agents.
LangDB routes model requests through an OpenAI-compatible AI gateway. See LangDB's Agno integration guide for gateway configuration.
Authentication
Create an API key in LangDB API key settings, then export the gateway credentials and API base URL.
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"Example
Install the openai package:
uv pip install -U openai agnoUse LangDB with your Agent:
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.
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.