Skip to content

Fix client authentication: properly support both Anthropic API and third-party endpoints#155

Open
JIA-ZI-LONG wants to merge 1 commit intoshareAI-lab:mainfrom
JIA-ZI-LONG:fix-dual-authentication
Open

Fix client authentication: properly support both Anthropic API and third-party endpoints#155
JIA-ZI-LONG wants to merge 1 commit intoshareAI-lab:mainfrom
JIA-ZI-LONG:fix-dual-authentication

Conversation

@JIA-ZI-LONG
Copy link
Copy Markdown

@JIA-ZI-LONG JIA-ZI-LONG commented Mar 30, 2026

Summary

Per official SDK documentation:

  • ANTHROPIC_API_KEY for Anthropic API
  • ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN for third-party endpoints

Previous code incorrectly popped ANTHROPIC_AUTH_TOKEN when ANTHROPIC_BASE_URL was set, which broke third-party authentication. Now strictly separates the two authentication methods with explicit conditionals.

Changes

Updated all 13 agent harness files (s01-s12, s_full):

  • Removed incorrect os.environ.pop("ANTHROPIC_AUTH_TOKEN", None) logic
  • Added explicit conditional initialization for both auth methods
  • Removed duplicate client = Anthropic(base_url=...) that overrode conditional logic

Test plan

  • Test with ANTHROPIC_API_KEY only → connects to Anthropic API
  • Test with ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN → connects to third-party endpoint
  • Verify scripts fail gracefully when neither auth method is configured
…ird-party endpoints

Per official SDK documentation:
- ANTHROPIC_API_KEY for Anthropic API
- ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN for third-party endpoints

Previous code incorrectly popped ANTHROPIC_AUTH_TOKEN when ANTHROPIC_BASE_URL
was set, which broke third-party authentication. Now strictly separates the
two authentication methods with explicit conditionals.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 30, 2026

@JIA-ZI-LONG is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant