You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(auth): support Bearer token alongside X-API-Key
Add an optional ``auth_method`` keyword on the ``SharpAPI`` and
``AsyncSharpAPI`` constructors. Defaults to ``"x-api-key"`` (existing
behaviour — fully back-compat; no caller changes required). When set to
``"bearer"`` the SDK sends ``Authorization: Bearer <key>`` instead of
the ``X-API-Key`` header, matching the Go server's three accepted REST
auth modes (header, Bearer, query).
Why: customers running behind IAM layers, SSO gateways, or corporate
proxies often have non-standard headers stripped or rewritten. Standard
``Authorization: Bearer`` survives those hops and integrates cleanly
with off-the-shelf auth middleware.
SSE streams are intentionally unchanged — they always authenticate via
the ``?api_key=`` query param because the EventSource spec does not
allow custom request headers.
Bumps version 0.2.4 -> 0.2.5 (new public API surface). Adds 2 tests
(sync + async) verifying the Bearer header is sent and X-API-Key is
omitted in bearer mode.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments