Connect frameworks to the AI Gateway
Connect the framework, prompts, tools, and agent workflow you already use to the Logfire AI Gateway.
Each guide shows the two client settings you need to change: the API key and gateway URL. You can point them at one model provider or a gateway endpoint, which can fail over to another provider or distribute requests across several providers.
-
Follow Send your first Gateway request to enable Gateway, choose a provider or endpoint, and get a project-scoped Gateway API key. An organization admin must enable Gateway and configure a provider.
-
Set the Gateway API key in the terminal where you will run the example. Keep it out of source control:
Terminal export LOGFIRE_GATEWAY_API_KEY="..." -
On the Gateway Connect tab, select a route and model. Copy the gateway URL and model name into the example.
The examples use the OpenAI-compatible route for the US region, https://gateway-us.pydantic.dev/proxy/openai. For the EU region, use gateway-eu instead. For a self-hosted organization, copy the URL from the Connect tab.
Most examples use an OpenAI-compatible client. The provider or gateway endpoint you select must support the OpenAI request format and the model name in the example. Provider-native APIs, such as Anthropic Messages, require that provider’s client. See Connect an SDK for both patterns.
| Framework or SDK | Languages |
|---|---|
| Agno | Python |
| Genkit | Go, TypeScript |
| Google ADK | Go, Python |
| Haystack | Python |
| Instructor | Python |
| LangChain | TypeScript, Python |
| LlamaIndex | Python |
| Mastra | TypeScript |
| Microsoft Agent Framework | .NET, Python |
| OpenAI Agents SDK | TypeScript, Python |
| OpenAI SDK | .NET, Go, TypeScript, Python |
| Semantic Kernel | .NET, Python |
| Smolagents | Python |
| Strands Agents | TypeScript, Python |
| Vercel AI SDK | TypeScript |
| VoltAgent | TypeScript |
Read the AI Gateway overview to learn how providers, gateway endpoints, spending limits, and telemetry work together.