Skip to content

Commit d2495af

Browse files
John-Linclaude
andcommitted
fix: disable OpenAI tracing to avoid 401 with Azure API keys
The SDK sends traces to api.openai.com by default, which fails when using Azure API keys. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 162aacd commit d2495af

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

bot/agents.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from agents.mcp import MCPServerStreamableHttp
1313
from agents.models.openai_chatcompletions import OpenAIChatCompletionsModel
1414
from agents.models.openai_responses import OpenAIResponsesModel
15+
from agents.tracing import set_tracing_disabled
1516
from openai import AsyncOpenAI
1617

1718
DEFAULT_INSTRUCTIONS = (
@@ -24,6 +25,8 @@
2425
MAX_TURNS = 10
2526
MCP_SESSION_TIMEOUT_SECONDS = 30.0
2627

28+
set_tracing_disabled(True)
29+
2730

2831
def _get_model() -> OpenAIResponsesModel | OpenAIChatCompletionsModel:
2932
"""Create an OpenAI model from environment variables.

0 commit comments

Comments
 (0)