Skip to main content
AgentOps seamlessly integrates with OpenAI’s Python SDK, allowing you to track and analyze all your OpenAI API calls automatically.

Installation

Setting Up API Keys

Before using OpenAI with AgentOps, you need to set up your API keys. You can obtain: Then to set them up, you can either export them as environment variables or set them in a .env file.
Then load the environment variables in your Python code:

Usage

Initialize AgentOps at the beginning of your application to automatically track all OpenAI API calls:

Examples

More Examples

Multi-Tool Orchestration

Advanced multi-tool RAG example

Async OpenAI Example

Demonstrates asynchronous calls with the OpenAI SDK.

Sync OpenAI Example

Shows synchronous calls with the OpenAI SDK.

Web Search Example

Example of integrating web search capabilities.