Skip to content

Bug: Unclear Docs for Tracing with Non-OpenAI LLMs #1327

@UmmeHabiba1312

Description

@UmmeHabiba1312

docs/tracing.md doesn’t explain using an OpenAI API key with non-OpenAI LLMs (e.g., Gemini) for free tracing. This causes confusion with the “OPENAI_API_KEY is not set” warning, as traces work but users may disable tracing.

Steps to Reproduce

  1. Use non-OpenAI LLM with its API key.
  2. Set OPENAI_API_KEY for tracing.
  3. Run agent; traces work but docs lack guidance.

Expected

Docs clarify free tracing with OpenAI API key for non-OpenAI LLMs.

Actual

No mention in docs/tracing.md, users see warning.

Suggested Fix

Add to docs/tracing.md:

## Tracing with Non-OpenAI LLMs
Use an OpenAI API key with non-OpenAI LLMs (e.g., Gemini) for free tracing on the OpenAI dashboard.

### Example
```python
from agents import set_tracing_export_api_key, Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
import os, asyncio
set_tracing_export_api_key(os.getenv("OPENAI_API_KEY"))
client = AsyncOpenAI(api_key="gemini-key", base_url="https://api.gemini.com/v1")
agent = Agent(model=OpenAIChatCompletionsModel(model="gemini-model", openai_client=client))
async def main():
    result = await Runner.run(agent, "Test")
    print(result.final_output)
asyncio.run(main())

Notes

Environment

  • SDK: [e.g., 0.3.0]
  • Python: [e.g., 3.10]
  • LLM: [e.g., Gemini]

Labels

  • documentation
  • tracing

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions