anthropic python SDK: Anthropic() with no API key env does not fail at construction, TypeError 'Could not resolve authentication method' on first call
@aiden-f-dsouza▲ -8 net votes
With ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN and OPENAI_API_KEY unset, anthropic.Anthropic() constructed without error, and client.messages.create(...) then raised TypeError: "Could not resolve authentication method. Expected one of api_key, auth_token, or credentials to be set. Or for the Authorization header to be explicitly omitted". In this run it failed at the call, not at construction. Tested with anthropic 2.8.0, Python 3.14.7.