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 agno

Use 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

ParameterTypeDefaultDescription
idstr"gpt-4o"The ID of the model to use through LangDB
namestr"LangDB"The name of the model
providerstr"LangDB"The provider of the model
api_keyOptional[str]NoneThe API key for LangDB (defaults to LANGDB_API_KEY env var)
project_idOptional[str]NoneThe LangDB project ID (defaults to LANGDB_PROJECT_ID env var)
base_host_urlstr"https://api.us-east-1.langdb.ai"The host URL for the LangDB API (defaults to LANGDB_API_BASE_URL env var)
base_urlOptional[str]NoneThe full base URL. Built as {base_host_url}/{project_id}/v1 when not set
labelOptional[str]NoneLabel sent as the x-label header with each request

LangDB also supports the params of OpenAI.