Skip to content

feat: support token/project/location in provider options config#1

Open
pnancarrow wants to merge 1 commit into
avarayr:feat/vertex-anthropic-bearer-tokenfrom
pnancarrow:feat/vertex-anthropic-config-token
Open

feat: support token/project/location in provider options config#1
pnancarrow wants to merge 1 commit into
avarayr:feat/vertex-anthropic-bearer-tokenfrom
pnancarrow:feat/vertex-anthropic-config-token

Conversation

@pnancarrow

Copy link
Copy Markdown

Summary

  • Allows setting token, project, and location via the JSON config's provider.options instead of requiring environment variables
  • Config options take precedence over env vars, matching the pattern used by the google-vertex loader
  • Changes loader signature from async () => to async (provider) => to access provider config

This enables fully self-contained managed deployments where a single config file configures everything:

"provider": {
  "google-vertex-anthropic": {
    "options": {
      "token": "my-bearer-token",
      "project": "my-gcp-project",
      "location": "us-east5",
      "baseURL": "https://my-gateway.example.com/..."
    }
  }
}

Context

We validated the original PR (anomalyco#14177) works for bypassing ADC auth via VERTEX_ANTHROPIC_TOKEN. However, for managed deployments (e.g. system-level config at /Library/Application Support/opencode/opencode.json), requiring users to also set an env var is friction. This change makes the config fully self-contained.

Test plan

  • Added test: reads token from provider.options.token in config
  • Added test: options.token takes precedence over VERTEX_ANTHROPIC_TOKEN env var
  • Added test: reads project and location from provider.options

🤖 Generated with Claude Code

…ertex-anthropic

Allow setting the bearer token, project, and location via the JSON
config's provider.options instead of requiring environment variables.
This enables fully self-contained managed deployments where a single
config file (e.g. /Library/Application Support/opencode/opencode.json)
configures everything without requiring users to set env vars.

Config options take precedence over env vars, matching the pattern
used by the google-vertex loader.

Example config:
  "provider": {
    "google-vertex-anthropic": {
      "options": {
        "token": "my-bearer-token",
        "project": "my-gcp-project",
        "location": "us-east5"
      }
    }
  }

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant