AI Gateway
Route your LLM calls through the AI Gateway with a single base URL change. Zero vendor lock-in: always run on the best model at the lowest cost for your use case.
Observability
Instrument your code with OpenTelemetry to capture traces, logs, and metrics for every LLM call, agent step, and tool use.
AI Gateway
Overview
LangGraph is a framework for building stateful, multi-actor AI applications with LLMs. It extends LangChain with graph-based agent orchestration, cycles, and controllability. By connecting LangGraph to Toqan Router’s AI Gateway, you get production-ready agentic workflows with access to 500+ models.Key Benefits
Toqan Router’s AI Gateway enhances your LangGraph applications with:Complete Observability
Track every agent step, tool use, and graph transition with detailed traces
Built-in Reliability
Automatic fallbacks, retries, and load balancing for production resilience
Cost Optimization
Real-time cost tracking and spend management across all your AI operations
Multi-Provider Access
Access 500+ LLMs and 30+ providers through a single, unified integration
Prerequisites
Before integrating LangGraph with Toqan Router, ensure you have:- A Toqan Router account and API Key
- Python 3.8 or higher
To setup your API key, see API keys & Endpoints.
Installation
Configuration
Configure LangGraph to use Toqan Router’s AI Gateway by passing aChatOpenAI instance with a custom base_url:
Python
base_url: https://router.toqan.ai/eu/v3/router
Basic Agent Example
Here’s a complete example usingcreate_agent with a tool:
Python
Agent with Multiple Tools
Python
Streaming
Stream agent steps as they happen:Python
Model Selection
With Toqan Router, you can use any supported model from 30+ providers:Python
Observability
Model calls through the AI Gateway appear in Traces. To capture the surrounding application workflow, use OpenTelemetry with a framework instrumentor and the regional OTLP endpoint. For Python, installopeninference-instrumentation-langchain and follow the OpenInference LangChain setup. It supports LangChain and LangGraph. For Node.js, use OpenInference LangChain.js.
Configure the exporter using the Observability quickstart:

