Skip to main content
Back

Anthropic Kills Static API Keys With Keyless Identity Federation

Anthropic's Python SDK now supports keyless authentication via Workload Identity Federation, letting CI and production workloads drop static API keys entirely

Repo, Full Access
  • Anthropic's Python SDK (v0.98+) now supports Workload Identity Federation, replacing static API keys with short-lived OIDC tokens.
  • Supported identity providers include GitHub Actions, AWS IAM, Google Cloud, Azure Entra ID, Kubernetes service accounts, SPIFFE, and Okta.
  • The SDK handles the JWT-to-Anthropic-token exchange and automatic refresh transparently -- no application code changes needed at call time.
  • Three Console resources must be configured: a federation issuer, a service account, and a federation rule; a guided wizard sets all three up end-to-end.
  • Watch out: ANTHROPIC_API_KEY silently takes precedence over federation credentials if left in the environment during migration.
  • The feature is available on PyPI now (MIT, Python 3.9+) and shipped simultaneously across TypeScript, Go, Java, C#, PHP, and Ruby SDKs.

Static API keys have always been the awkward part of shipping Claude-powered applications. You mint one, paste it into a CI secret or a container environment variable, and then spend the next year hoping nobody leaks it, forgets to rotate it, or accidentally commits it to a public repo. Anthropic's Python SDK has now shipped a direct answer to that problem: native Workload Identity Federation (WIF) support, landing in the v0.98 release series.

WIF is a keyless authentication pattern borrowed from cloud IAM systems. Instead of a long-lived credential, your workload presents a short-lived signed token issued by an identity provider (IdP) it already trusts -- GitHub Actions, AWS IAM, Google Cloud, Kubernetes service accounts, Azure Entra ID, SPIFFE, or Okta. The SDK exchanges that token for a short-lived Anthropic access token and handles refresh automatically. Your application code never sees a static secret.

How the exchange actually works

The flow follows a standard called RFC 7523 (the "JWT bearer" grant). Here is what happens at runtime:

  1. Your platform issues a signed JWT to the workload automatically -- this is ambient on most clouds (Kubernetes projected tokens, the GCP metadata server, the GitHub Actions OIDC endpoint, etc.).
  2. The SDK posts the JWT to POST /v1/oauth/token using the RFC 7523 jwt-bearer grant. Anthropic verifies the JWT against the issuer's JWKS and the federation rule's match conditions, then returns a short-lived sk-ant-oat01-... token that acts on behalf of the rule's target service account.