-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
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
- Use non-OpenAI LLM with its API key.
- Set OPENAI_API_KEY for tracing.
- 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
- Set OPENAI_API_KEY in .env.
- View free traces at https://platform.openai.com/traces.
Environment
- SDK: [e.g., 0.3.0]
- Python: [e.g., 3.10]
- LLM: [e.g., Gemini]
Labels
documentation
tracing
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation