Skip to main content

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

SmolAgents is a lightweight Python agent framework by Hugging Face. Using OpenAIServerModel with a custom api_base, you can route all LLM calls through Toqan Router’s AI Gateway for access to 500+ models, cost tracking, and reliability features.

Prerequisites

  • A Toqan Router account and API Key
  • Python 3.9 or higher
To setup your API key, see API keys & Endpoints.

Installation

Configuration

Python
api_base: https://router.toqan.ai/eu/v3/router

Basic Agent Example

Python

Model Selection

With Toqan Router, you can use any supported model from 30+ providers:
Python

Observability

Overview

SmolAgents uses the openinference-instrumentation-smolagents library to automatically instrument agent runs and export traces via OpenTelemetry.

Prerequisites

  • A Toqan Router account and API Key
  • Python 3.9 or higher

Installation

Configuring Toqan Router Observability

Set up the tracer provider and instrument SmolAgents before creating any agents:
SmolagentsInstrumentor must be called before any agent is instantiated. Once instrumented, all CodeAgent and ToolCallingAgent runs are automatically traced.

Basic Example