---
title: "OpenAI Agents SDK"
url: "/docs/projects/openai-agents"
canonical_url: "https://docs.litellm.ai/docs/projects/openai-agents"
type: "docs"
last_updated: "2026-10-04"
summary: "Use OpenAI Agents SDK with any LLM provider through LiteLLM Proxy."
related:
  - "/docs/projects/mini-swe-agent"
  - "/docs/projects/Google ADK"
---
# OpenAI Agents SDK

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


Use OpenAI Agents SDK with any LLM provider through LiteLLM Proxy.

The [OpenAI Agents SDK](https://github.com/openai/openai-agents-python) is a lightweight framework for building multi-agent workflows. It includes an official LiteLLM extension that lets you use any of the 100+ supported providers.

## Quick Start

### 1. Install Dependencies

```bash
uv add "openai-agents[litellm]"
```

### 2. Add Model to Config

```yaml title="config.yaml"
model_list:
  - model_name: gpt-5.6-terra
    litellm_params:
      model: "openai/gpt-5.6-terra"
      api_key: "os.environ/OPENAI_API_KEY"

  - model_name: claude-sonnet
    litellm_params:
      model: "anthropic/claude-sonnet-5"
      api_key: "os.environ/ANTHROPIC_API_KEY"

  - model_name: gemini-3.1-pro-preview
    litellm_params:
      model: "gemini/gemini-3.1-pro-preview"
      api_key: "os.environ/GEMINI_API_KEY"
```

### 3. Start LiteLLM Proxy

```bash
litellm --config config.yaml
```

### 4. Use with Proxy

**Via Proxy**

```python
from agents import Agent, Runner
from agents.extensions.models.litellm_model import LitellmModel

# Point to LiteLLM proxy
agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
    model=LitellmModel(
        model="claude-sonnet",  # Model from config.yaml
        api_key="sk-<your-litellm-api-key>",      # LiteLLM API key
        base_url="http://localhost:4000"
    )
)

result = await Runner.run(agent, "What is LiteLLM?")
print(result.final_output)
```

**Direct (No Proxy)**

```python
from agents import Agent, Runner
from agents.extensions.models.litellm_model import LitellmModel

# Use any provider directly
agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
    model=LitellmModel(
        model="anthropic/claude-sonnet-5",
        api_key="your-anthropic-key"
    )
)

result = await Runner.run(agent, "What is LiteLLM?")
print(result.final_output)
```

## Track Usage

Enable usage tracking to monitor token consumption:

```python
from agents import Agent, ModelSettings
from agents.extensions.models.litellm_model import LitellmModel

agent = Agent(
    name="Assistant",
    model=LitellmModel(model="claude-sonnet", api_key="sk-<your-litellm-api-key>"),
    model_settings=ModelSettings(include_usage=True)
)

result = await Runner.run(agent, "Hello")
print(result.context_wrapper.usage)  # Token counts
```

## Environment Variables

| Variable | Value | Description |
|----------|-------|-------------|
| `LITELLM_BASE_URL` | `http://localhost:4000` | LiteLLM proxy URL |
| `LITELLM_API_KEY` | `sk-<your-litellm-api-key>` | Your LiteLLM API key |

## Related Resources

- [OpenAI Agents SDK Documentation](https://openai.github.io/openai-agents-python/)
- [LiteLLM Extension Docs](https://openai.github.io/openai-agents-python/models/litellm/)
- [LiteLLM Proxy Quick Start](../proxy/quick_start)

## Related pages

- [mini-swe-agent](https://docs.litellm.ai/docs/projects/mini-swe-agent.md)
- [Google ADK (Agent Development Kit)](https://docs.litellm.ai/docs/projects/Google ADK.md)
