Skip to content
masterclass Buddy

LangSmith · Function

wrap_openai

Wrap an OpenAI client to trace calls to OpenAI-compatible providers in LangSmith. Set the provider base URL, then use the wrapped client for API requests.

Last updated

Since
v0.5

Syntax

wrap_openai(client: C, *, tracing_extra: Optional[TracingExtra] = None, chat_name: str = 'ChatOpenAI', completions_name: str = 'OpenAI') -> C

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • wrapOpenAI
  • traceable
  • @traceable
  • LANGSMITH_TRACING
  • LANGSMITH_API_KEY
  • AgentAddress
  • agent_address

Source: wrap_openai | langsmith | LangChain Reference. Checked 2026-11-03.