Authentication
Create an API key in LangDB API key settings, then export the gateway credentials and API base URL.Example
Install theopenai package:
LangDB with your Agent:
Params
LangDB also supports the params of OpenAI.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use the LangDB AI Gateway with Agno agents.
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"
$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"
openai package:
uv pip install -U openai agno
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.")
| 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.Was this page helpful?