The Python SDK supports both the Chat Completions API and the Responses API. The TypeScript SDK currently only supports the Chat Completions API.
Python Galileo OpenAI SDK reference
The Python Galileo OpenAI SDK reference.
TypeScript Galileo OpenAI SDK reference
The TypeScript Galileo OpenAI SDK reference.
Installation
First, make sure you have the Galileo SDK installed. If you are using Python, ensure you install the OpenAI optional dependency.Basic usage
If you are using Python, import thegalileo.openai module, instead of the OpenAI openai module and use that to create your client. If you are using TypeScript, use the wrapper to wrap your OpenAI client.
- The input prompt
- The model used
- The response
- Timing information
- Token usage
- Other relevant metadata
Responses API (Python only)
The Python SDK also supports OpenAI’s Responses API, which provides a simplified interface for single-turn interactions and additional features like built-in tools.Responses API basic example
Python
Tool calls
The Responses API supports function calling. Here’s an example that demonstrates tool definitions, executing tool calls, and providing results back to the model:Python
The Responses API also supports advanced features like:
- Reasoning items with the
reasoningparameter for chain-of-thought outputs - Built-in tools including web search, code interpreter, and file search
- Streaming with
stream=True
Sessions and traces
If you use the OpenAI wrapper by itself, it will automatically create a session and start a new trace for you, adding the call as an LLM span. Subsequent calls will be added as an LLM span to a new trace in the same session. The session will have an autogenerated name based off the content.


Streaming support
The OpenAI wrapper also supports streaming responses. When streaming, the wrapper will log the response as it streams in:Combining with the log decorator
You can combine the OpenAI wrapper with thelog decorator to create more complex traces:
Benefits of using the OpenAI integration
- Zero-config logging: No need to add logging code throughout your application
- Complete visibility: All prompts and responses are automatically captured
- Minimal code changes: Change your import statement in Python, or create a wrapper in TypeScript. No other code changes are required.
- Automatic tracing: Creates spans and traces without manual setup
- Streaming support: Works with both regular and streaming responses
Asynchronous OpenAI calls with Galileo
The Galileo OpenAI wrapper currently supports only synchronous calls for both the Chat Completions API and the Responses API. It does not include built-in support for theAsyncOpenAI class from the official OpenAI Python library. As a result, asynchronous calls made via the galileo.openai wrapper won’t automatically generate LLM spans or upload telemetry to Galileo.You can still track async interactions by manually using the low-level GalileoLogger API. This requires importing and awaiting the OpenAI AsyncOpenAI client, wrapping each call with a call to add an LLM span, and flushing the logger to send your traces.Next steps
Galileo logger
Log with full control over sessions, traces, and spans using the Galileo logger.
Log decorator
Quickly add logging to your code with the log decorator and wrapper.
Galileo context
Manage logging using the Galileo context manager.