LangDB is an AI Gateway for seamless access to 350+ LLMs. Secure, govern, and optimize AI Traffic across LLMs using OpenAI-Compatible APIs. For detailed integration instructions, see the LangDB Agno documentation.

Authentication

Set your LANGDB_API_KEY environment variable. Get your key from here.
export LANGDB_API_KEY=***
export LANGDB_PROJECT_ID=***

Example

Use LangDB with your Agent:
from agno.agent import Agent, RunResponse
from agno.models.langdb import LangDB

agent = Agent(
    model=LangDB(id="gpt-4o"),
    markdown=True
)

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

Params

ParameterTypeDefaultDescription
idstr"gpt-4o"The model ID used for generating responses.
namestr"LangDB"The name identifier for the LangDB agent.
providerstr"LangDB:" + idThe provider of the model, combining "LangDB" with the model ID.
api_keyOptional[str]getenv("LANGDB_API_KEY")The API key for authenticating requests to LangDB, retrieved from the LANGDB_API_KEY environment variable.
project_idOptional[str]getenv("LANGDB_PROJECT_ID")The project ID for LangDB, retrieved from the LANGDB_PROJECT_ID environment variable. If not set, a warning is logged.
base_urlstr"https://api.us-east-1.langdb.ai/{project_id}/v1"The base URL for making API requests to LangDB. The {project_id} is dynamically included.
default_headersOptional[dict]NoneOptional custom headers for API requests.
LangDB also supports the params of OpenAI.