Skip to main content
Many LLM providers accept requests in the same format as the OpenAI API. To trace calls from these providers to LangSmith, construct an OpenAI client pointed at the provider’s base URL, then wrap it with wrap_openai / wrapOpenAI. Use wrap_openai / wrapOpenAI for direct API calls. Use @traceable when you need to trace application logic around the call or set metadata per invocation.
To trace OpenAI directly, refer to Trace OpenAI applications.

Setup

Trace API calls

Add metadata

Pass tracing_extra when wrapping the client. The metadata applies to all calls made with that client.
Some providers have dedicated setup guides that use @traceable or a native callback. These approaches trace at the function level rather than wrapping the client directly, or integrate with the provider’s own SDK and routing layer.
  • DeepSeek: OpenAI-compatible API; guide uses @traceable with custom provider metadata
  • LiteLLM: proxy that exposes an OpenAI-compatible endpoint; guide covers @traceable and LiteLLM’s built-in LangSmith callback