feat: add ANTHROPIC_HOST configuration for Anthropic in cli and UI (#1776)

This commit is contained in:
Denis Buzmakov
2025-04-02 22:36:47 +02:00
committed by GitHub
parent a923d24f27
commit fc230ded9b
6 changed files with 11 additions and 4 deletions

View File

@@ -9,7 +9,7 @@
"name": "Anthropic", "name": "Anthropic",
"description": "Use Claude and other Anthropic models", "description": "Use Claude and other Anthropic models",
"models": ["claude-3.5-sonnet-2"], "models": ["claude-3.5-sonnet-2"],
"required_keys": ["ANTHROPIC_API_KEY"] "required_keys": ["ANTHROPIC_API_KEY", "ANTHROPIC_HOST"]
}, },
"databricks": { "databricks": {
"name": "Databricks", "name": "Databricks",

View File

@@ -133,7 +133,7 @@ impl Provider for AnthropicProvider {
ConfigKey::new("ANTHROPIC_API_KEY", true, true, None), ConfigKey::new("ANTHROPIC_API_KEY", true, true, None),
ConfigKey::new( ConfigKey::new(
"ANTHROPIC_HOST", "ANTHROPIC_HOST",
false, true,
false, false,
Some("https://api.anthropic.com"), Some("https://api.anthropic.com"),
), ),

View File

@@ -20,7 +20,7 @@ Goose relies heavily on tool calling capabilities and currently works best with
| Provider | Description | Parameters | | Provider | Description | Parameters |
|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Amazon Bedrock](https://aws.amazon.com/bedrock/) | Offers a variety of foundation models, including Claude, Jurassic-2, and others. **AWS environment variables must be set in advance, not configured through `goose configure`** | `AWS_PROFILE`, or `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`, ... | | [Amazon Bedrock](https://aws.amazon.com/bedrock/) | Offers a variety of foundation models, including Claude, Jurassic-2, and others. **AWS environment variables must be set in advance, not configured through `goose configure`** | `AWS_PROFILE`, or `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`, ... |
| [Anthropic](https://www.anthropic.com/) | Offers Claude, an advanced AI model for natural language tasks. | `ANTHROPIC_API_KEY` | | [Anthropic](https://www.anthropic.com/) | Offers Claude, an advanced AI model for natural language tasks. | `ANTHROPIC_API_KEY`, `ANTHROPIC_HOST` (optional) |
| [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/) | Access Azure-hosted OpenAI models, including GPT-4 and GPT-3.5. | `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_DEPLOYMENT_NAME` | | [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/) | Access Azure-hosted OpenAI models, including GPT-4 and GPT-3.5. | `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_DEPLOYMENT_NAME` |
| [Databricks](https://www.databricks.com/) | Unified data analytics and AI platform for building and deploying models. | `DATABRICKS_HOST`, `DATABRICKS_TOKEN` | | [Databricks](https://www.databricks.com/) | Unified data analytics and AI platform for building and deploying models. | `DATABRICKS_HOST`, `DATABRICKS_TOKEN` |
| [Gemini](https://ai.google.dev/gemini-api/docs) | Advanced LLMs by Google with multimodal capabilities (text, images). | `GOOGLE_API_KEY` | | [Gemini](https://ai.google.dev/gemini-api/docs) | Advanced LLMs by Google with multimodal capabilities (text, images). | `GOOGLE_API_KEY` |

View File

@@ -5,6 +5,7 @@ import { default_key_value, required_keys } from '../models/hardcoded_stuff'; //
export function isSecretKey(keyName: string): boolean { export function isSecretKey(keyName: string): boolean {
// Endpoints and hosts should not be stored as secrets // Endpoints and hosts should not be stored as secrets
const nonSecretKeys = [ const nonSecretKeys = [
'ANTHROPIC_HOST',
'DATABRICKS_HOST', 'DATABRICKS_HOST',
'OLLAMA_HOST', 'OLLAMA_HOST',
'OPENAI_HOST', 'OPENAI_HOST',

View File

@@ -58,7 +58,7 @@ export const short_list = ['gpt-4o', 'claude-3-5-sonnet-latest'];
export const required_keys = { export const required_keys = {
OpenAI: ['OPENAI_API_KEY', 'OPENAI_HOST', 'OPENAI_BASE_PATH'], OpenAI: ['OPENAI_API_KEY', 'OPENAI_HOST', 'OPENAI_BASE_PATH'],
Anthropic: ['ANTHROPIC_API_KEY'], Anthropic: ['ANTHROPIC_API_KEY', 'ANTHROPIC_HOST'],
Databricks: ['DATABRICKS_HOST'], Databricks: ['DATABRICKS_HOST'],
Groq: ['GROQ_API_KEY'], Groq: ['GROQ_API_KEY'],
Ollama: ['OLLAMA_HOST'], Ollama: ['OLLAMA_HOST'],
@@ -75,6 +75,7 @@ export const required_keys = {
}; };
export const default_key_value = { export const default_key_value = {
ANTHROPIC_HOST: 'https://api.anthropic.com',
OPENAI_HOST: 'https://api.openai.com', OPENAI_HOST: 'https://api.openai.com',
OPENAI_BASE_PATH: 'v1/chat/completions', OPENAI_BASE_PATH: 'v1/chat/completions',
OLLAMA_HOST: 'localhost', OLLAMA_HOST: 'localhost',

View File

@@ -91,6 +91,11 @@ export const PROVIDER_REGISTRY: ProviderRegistry[] = [
name: 'ANTHROPIC_API_KEY', name: 'ANTHROPIC_API_KEY',
is_secret: true, is_secret: true,
}, },
{
name: 'ANTHROPIC_HOST',
is_secret: false,
default: 'https://api.anthropic.com',
},
], ],
}, },
}, },