Skip to content

When debug logging is enabled, api-key header is also printed #1082

Closed
@danigian

Description

@danigian

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

When debug logging is enabled, FinalRequestOptions is entirely dumped because of the following code:

if log.isEnabledFor(logging.DEBUG):
log.debug("Request options: %s", model_dump(options, exclude_unset=True))

This includes the api-key header that would be great to avoid logging

To Reproduce

  1. Enable debug logging
  2. Get a AsyncAzureOpenAI client and execute any kind of request against the service
  3. See the api-key getting logged as part of the headers

Code snippets

No response

OS

WSL

Python version

Python v3.9.18

Library version

openai v1.7.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions