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 at a routing group, which can fail over to another provider or distribute requests across several providers.
-
If your organization has not enabled the gateway, follow Enable the gateway. You need to be an organization admin.
-
In Logfire, open your organization, then select AI Engineering > Gateway > API Keys.
-
Create or copy a gateway API key, then set it in the terminal where you will run the example:
Terminal export LOGFIRE_GATEWAY_API_KEY="..." -
On the Gateway Connect tab, select a provider 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 routing group 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, routing groups, spending limits, and telemetry work together.