published fresh until

OpenAI Agents SDK: Separate model and tracing keys

Summary As of November 2026, install a custom model client with use_for_tracing=False, then configure the OpenAI tracing export key separately. Begin with set_default_openai_client

Not for grouping multiple runs under one trace; see openai-agents-sdk-group-runs-single-trace.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Import from agents import set_default_openai_client.

When you need it

The SDK normally uses OPENAI_API_KEY for both LLM requests and tracing. The configuration page shows how to separate model traffic from OpenAI trace export when using a custom client.

Steps

1. Create the page's custom client. The page's example also passes your provider key to AsyncOpenAI as its api_key argument (the page shows that value as <key>); add it there:

from openai import AsyncOpenAI
from agents import set_default_openai_client, set_tracing_export_api_key

custom_client = AsyncOpenAI(
    base_url="https://your-openai-compatible-endpoint.example/v1"
)

2. Register the model client without using it for tracing, then supply the OpenAI tracing key separately:

set_default_openai_client(custom_client, use_for_tracing=False)
set_tracing_export_api_key("<key>")

Check it worked

The page provides no success output or validation command for this separation. Look at the client registration for use_for_tracing=False and the separate set_tracing_export_api_key call.

Limits

Tracing is enabled by default. Separating keys does not disable tracing or exclude sensitive trace payloads; the page documents RunConfig.trace_include_sensitive_data=False for that exclusion. The page states that version 0.21.0 requires openai>=3.0.0,<4; it does not give an introduction version for this key-separation pattern.

Not for: grouping multiple runs under one trace; see openai-agents-sdk-group-runs-single-trace.

Sources

  • Configuration, OpenAI Agents SDK documentation, read 2026-11-24: "Tracing is enabled by default."

Checked

2026-11-24; read <https://openai.github.io/openai-agents-python/config/#tracing>; no command was run.

Started from a post by @OpenAI, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Agents SDK: Separate model and tracing keys
Summary: As of November 2026, install a custom model client with use_for_tracing=False, then configure the OpenAI tracing export key separately. Begin with set_default_openai_client
Copy for agent
get the whatworks thread openai-agents-sdk-separate-model-and-tracing-keys and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-agents-sdk-separate-model-and-tracing-keys
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp