Skip to main content
LangSmith is LangChain’s observability platform that helps you debug, test, evaluate, and monitor your LLM applications. When combined with the AI Gateway, you get the best of both worlds: LangSmith’s detailed observability and the AI Gateway’s advanced AI gateway features. This integration allows you to:
  • Track all LLM requests in LangSmith while routing through the AI Gateway
  • Use the AI Gateway’s 3,000+ LLMs with LangSmith observability
  • Implement advanced features like caching, fallbacks, and load balancing
  • Maintain detailed traces and analytics in both platforms

Quick Start Integration

Since the AI Gateway provides an OpenAI-compatible API, integrating with LangSmith is straightforward using LangSmith’s OpenAI wrapper.

Installation

Basic Setup

This integration automatically logs requests to both LangSmith and the AI Gateway, giving you observability data in both platforms.

Using AI Gateway Features with LangSmith

1. LLM Integrations

LLM Integrations in the AI Gateway allow you to securely manage API keys and set usage limits. Use them with LangSmith for better security:

2. Multiple Providers

Switch between 3,000+ LLMs while maintaining LangSmith observability:

3. Advanced Routing with Configs

Use the AI Gateway’s config system for advanced features while tracking in LangSmith: Example config for fallback between providers:

4. Caching for Cost Optimization

Enable caching to reduce costs while maintaining full observability:

5. Custom Metadata and Tracing

Add custom metadata visible in both LangSmith and the AI Gateway:

Fallbacks

Automatically switch to backup targets if the primary target fails.

Conditional Routing

Route requests to different targets based on specified conditions.

Load Balancing

Distribute requests across multiple targets based on defined weights.

Caching

Enable caching of responses to improve performance and reduce costs.

Smart Retries

Automatic retry handling with exponential backoff for failed requests

Budget Limits

Set and manage budget limits across teams and departments. Control costs with granular budget limits and usage tracking.

Observability Features

With this integration, you get:

In LangSmith:

  • Request/response logging
  • Latency tracking
  • Token usage analytics
  • Cost calculation
  • Trace visualization

In the AI Gateway:

  • Request logs with provider details
  • Advanced analytics across providers
  • Cost tracking and budgets
  • Performance metrics
  • Custom dashboards
  • Token usage analytics

Migration Guide

If you’re already using LangSmith with OpenAI, migrating to use the AI Gateway is simple:

Next Steps

Resources

Last modified on September 15, 2026