## TL;DR

Upgrade to the latest weave version. Weave's openai monitor wrapper only picked up the API key when passed as an explicit kwarg; openai.api\_key value... (the documented OpenAI SDK behavior) was ignored.

## Steps

1. Weave's openai monitor wrapper only picked up the API key when passed as an explicit kwarg; `openai.api_key value ...` (the documented OpenAI SDK behavior) was ignored. This was addressed in a later Weave release (maintainer confirmed 2024-04-30). Upgrade to the latest weave version.

Expected: This was addressed in a later Weave release (maintainer confirmed 2024-04-30).

## When to use

You are seeing this: Using the Weave OpenAI monitor (weave.monitoring.openai) with the documented auth style openai.api\_key value os.getenv("OPENAI\_API\_KEY") fails: the wrapper raises KeyError: 'api\_key' and then AuthenticationError: No API key provided, even though the... Use this skill when you run into "weave.monitoring.openai ignores openai.api_key (requires kwarg)".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
