diff --git a/docs/models/index.md b/docs/models/index.md index fc7e62c..889a8fe 100644 --- a/docs/models/index.md +++ b/docs/models/index.md @@ -21,7 +21,7 @@ Model specifications in fast-agent follow this precedence order (highest to lowe Model strings follow this format: `provider.model_name[?reasoning=value][&query=value...]` -- **provider**: The LLM provider (e.g., `anthropic`, `openai`, `azure`, `deepseek`, `generic`,`openrouter`, `tensorzero`) +- **provider**: The LLM provider (for example `anthropic`, `anthropic-vertex`, `openai`, `azure`, `deepseek`, `generic`, `openrouter`, `tensorzero`) - **model_name**: The specific model to use in API calls (for Azure, this is your deployment name) - **query parameters** (optional): provider/model-specific runtime overrides such as `reasoning`, `structured`, `context`, `transport`, `temperature` (`temp` alias), @@ -32,6 +32,7 @@ Model strings follow this format: `provider.model_name[?reasoning=value][&query= Examples: - `anthropic.claude-4-5-sonnet-latest` +- `anthropic-vertex.claude-sonnet-4-6` - `openai.gpt-5.2` - `openai.o3-mini?reasoning=high` - `sonnet?reasoning=4096` diff --git a/docs/models/llm_providers.md b/docs/models/llm_providers.md index 5baf9f9..7ab99ef 100644 --- a/docs/models/llm_providers.md +++ b/docs/models/llm_providers.md @@ -54,6 +54,81 @@ anthropic: - `ANTHROPIC_API_KEY`: Your Anthropic API key - `ANTHROPIC_BASE_URL`: Override the API endpoint +### Anthropic on Vertex AI + +Anthropic-on-Vertex is now exposed as a dedicated provider: `anthropic-vertex`. + +Use provider-prefixed model strings such as: + +- `anthropic-vertex.claude-sonnet-4-6` +- `anthropic-vertex.claude-haiku-4-5` +- `anthropic-vertex.claude-opus-4-6` + +Do not use the old query-string routing forms such as `?via=vertex` or `?source=vertex`. + +When you select `anthropic-vertex`: + +- fast-agent uses the dedicated Anthropic Vertex client path +- **Google Application Default Credentials (ADC)** are required +- an Anthropic direct API key is **not** required +- the provider appears separately in model selection and diagnostics as **Anthropic (Vertex)** + +**YAML Configuration:** + +```yaml +anthropic: + vertex_ai: + enabled: true + project_id: "my-gcp-project" # Optional if resolved from env/ADC + location: "global" # Optional, defaults to global + # base_url: "https://example-vertex-endpoint" +``` + +The `anthropic-vertex` provider reads its Vertex connection settings from +`anthropic.vertex_ai`. + +**Environment Variables:** + +Project ID can be provided by any of: + +- `ANTHROPIC_VERTEX_PROJECT_ID` +- `GOOGLE_CLOUD_PROJECT` +- `GOOGLE_PROJECT_ID` +- `GCLOUD_PROJECT` +- `GCP_PROJECT` + +Location can be provided by any of: + +- `ANTHROPIC_VERTEX_LOCATION` +- `GOOGLE_CLOUD_LOCATION` +- `GOOGLE_CLOUD_REGION` +- `CLOUD_ML_REGION` +- `VERTEX_REGION` + +If location is not set, fast-agent defaults to `global`. + +**Authentication:** + +Anthropic-on-Vertex requires Google ADC, for example: + +```bash +gcloud auth application-default login +``` + +or a service account exposed through the usual Google credential environment. + +**Example:** + +```yaml +default_model: "anthropic-vertex.claude-sonnet-4-6" + +anthropic: + vertex_ai: + enabled: true + project_id: "my-gcp-project" + location: "global" +``` + **Caching Options:** The `cache_mode` setting controls how prompt caching is applied: @@ -528,6 +603,30 @@ google: - `GOOGLE_API_KEY`: Your Google API key +### Vertex AI mode + +For Vertex AI, configure `google.vertex_ai` and authenticate with Google ADC/IAM instead of a +Gemini API key: + +```yaml +google: + vertex_ai: + enabled: true + project_id: "your-gcp-project" + location: "global" # or a supported regional location +``` + +In this mode, `fast-agent` uses the Google native provider without requiring `GOOGLE_API_KEY`. + +Vertex partner model ids such as Anthropic Claude are passed through unchanged, so with Vertex +enabled you can use either: + +- `google.claude-sonnet-4-6` +- `google.publishers/anthropic/models/claude-sonnet-4-6` + +If you want the dedicated Anthropic-flavoured route instead, use the separate +`anthropic-vertex` provider described above. + **Model Name Aliases:** --8<-- "_generated/model_aliases_google.md" diff --git a/docs/models/models_reference.md b/docs/models/models_reference.md index f36a426..155a6cf 100644 --- a/docs/models/models_reference.md +++ b/docs/models/models_reference.md @@ -12,4 +12,11 @@ provider prefix when required). The provider column reflects the default provider used by fast-agent (models may become available with multiple providers in the future). +Anthropic-on-Vertex is exposed as a separate provider using model strings such +as `anthropic-vertex.claude-sonnet-4-6`. With `google.vertex_ai.enabled`, the +native Google provider can also pass Vertex partner model ids such as +`google.claude-sonnet-4-6` through unchanged. The table below still shows the +default provider for each base model id; Vertex-specific routes are documented +on [LLM Providers](llm_providers.md#anthropic-on-vertex-ai). + --8<-- "_generated/models_reference.md" diff --git a/docs/ref/config_file.md b/docs/ref/config_file.md index 4d343ca..cfae618 100644 --- a/docs/ref/config_file.md +++ b/docs/ref/config_file.md @@ -145,6 +145,11 @@ anthropic: base_url: "https://api.anthropic.com/v1" # Optional, only include to override reasoning: auto # Adaptive models: auto/low/medium/high/max. Budget models: integer tokens or off. structured_output_mode: auto # auto (default), json, or tool_use + vertex_ai: + enabled: false # Optional; enables Anthropic-on-Vertex configuration intent + project_id: "my-gcp-project" # Optional if resolved from env/ADC + location: "global" # Optional; defaults to global + # base_url: "https://example-vertex-endpoint" web_search: enabled: false max_uses: 3 # Optional, must be > 0 @@ -193,6 +198,38 @@ Anthropic built-in web tools can also be toggled per run in the model string: Allowed values: `on`/`off` (also accepts `true`/`false`, `1`/`0`). +Anthropic-on-Vertex now uses a dedicated provider namespace instead of model query routing. + +Use: + +- `anthropic-vertex.claude-sonnet-4-6` +- `anthropic-vertex.claude-haiku-4-5` +- `anthropic-vertex.claude-opus-4-6` + +Do not use the legacy `?via=vertex` / `?source=vertex` query parameters. + +The `anthropic-vertex` provider uses Google Application Default Credentials +(ADC) and reads its connection settings from `anthropic.vertex_ai`. It does not +require a direct Anthropic API key. + +Project ID can be sourced from: + +- `ANTHROPIC_VERTEX_PROJECT_ID` +- `GOOGLE_CLOUD_PROJECT` +- `GOOGLE_PROJECT_ID` +- `GCLOUD_PROJECT` +- `GCP_PROJECT` + +Location can be sourced from: + +- `ANTHROPIC_VERTEX_LOCATION` +- `GOOGLE_CLOUD_LOCATION` +- `GOOGLE_CLOUD_REGION` +- `CLOUD_ML_REGION` +- `VERTEX_REGION` + +If location is omitted, fast-agent defaults to `global`. + ### OpenAI ```yaml @@ -313,8 +350,19 @@ deepseek: google: api_key: "your_google_key" # Can also use GOOGLE_API_KEY env var base_url: "https://generativelanguage.googleapis.com/v1beta/openai" # Optional + vertex_ai: + enabled: true + project_id: "your-gcp-project" + location: "global" ``` +When `google.vertex_ai.enabled` is true, fast-agent uses ADC/IAM auth for the native Google +provider and does not require `GOOGLE_API_KEY`. + +With Vertex enabled, the Google native provider also accepts partner model ids such as +`google.claude-sonnet-4-6`. If you want the dedicated Anthropic-on-Vertex route instead, use the +separate `anthropic-vertex` provider. + ### xAI (Grok) ```yaml