- Set the Toqan Router OTLP endpoint and authenticate with an API key
- Configure the OpenTelemetry SDK in an existing application
- See every LLM call, agent step, and tool use in Traces
- For framework-specific setup, see the framework integration guides
Create a Toqan Router account
Sign up for a free Toqan Router account and set up a workspace.
Set up Toqan Router
Open Settings > API Keys in the AI Studio. Click Create API Key, give it a name, and copy it.Then open a terminal and run the command below, replacing
your-api-key-here with the copied key. The code samples in the next steps read it from this environment variable.Instrument with OpenTelemetry
Install the OpenTelemetry SDK and the OTLP HTTP exporter:Set the environment variables that point the OpenTelemetry SDK at the Toqan Router collector:Initialize the tracer provider once at application startup. The exporter reads the endpoint, headers, and resource from the environment variables above:
The exporter accepts both
https://router.toqan.ai/eu/v2/otel and the full path https://router.toqan.ai/eu/v2/otel/v1/traces. Spans from any OpenTelemetry-instrumented code are exported automatically.OTLP is served over HTTP, with either http/protobuf or http/json. Traces are received at /v2/otel/v1/traces, logs at /v2/otel/v1/logs, and metrics at /v2/otel/v1/metrics.For São Paulo, replace /eu with /br. See Regions.Connect a framework
Using a framework? Instrument the framework with its own setup instead of manual span creation. Each framework guide shows the exact installation, environment variables, and instrumentation call:
LangGraph
One
setup() call instruments the graph, tools, and every LLM step.Vercel AI SDK
Python and TypeScript SDKs with experimental OpenTelemetry telemetry.
Pydantic AI
Logfire-based instrumentation for agents, tools, and streaming.
OpenAI Agents
Automatic tracing via
OpenAIAgentsInstrumentor.Agno
OpenInference instrumentation for agents and tools.
Google ADK
Trace agent workflows, tool calls, and Gemini model interactions.
Mastra
TypeScript agents and workflows with OpenTelemetry tracing.
Claude Agent SDK
Hooks-based instrumentation for agent turns and tool use.
See all frameworks
Full list of supported frameworks and setup guides.
View traces
Run the agent and open Traces in the AI Studio. Every request appears with model, latency, token counts, and cost. For agentic frameworks, individual tool calls and steps appear as child spans.
Troubleshooting
Traces not appearing in the Studio
Traces not appearing in the Studio
-
Confirm the OTLP endpoint is set to
https://router.toqan.ai/eu/v2/otel(or/v2/otel/v1/tracesfor exporters that require the full path) - Check that the workspace in the API key matches the AI Studio workspace being viewed
- Traces can take a few seconds to appear, wait 10 seconds and refresh
-
Flush the tracer provider before a short script exits. The batch processor holds spans for up to 5 seconds, and a process that exits first loses them:
-
Confirm the sampler is not discarding everything, for example
OTEL_TRACES_SAMPLER=always_offor a ratio of0 -
A
415withunsupported content type: expected application/x-protobuf or application/jsonmeans theContent-Typeheader is neitherapplication/x-protobufnorapplication/json. Use an HTTP OTLP exporter, which sets the header to match the body encoding
Annotate traces
Label and review spans to build high-quality evaluation datasets from real production traffic.
Set up analytics
Track cost, latency, error rates, and token usage across models and deployments over time.

