diff --git a/.env.example b/.env.example index b9aab986..657356f3 100644 --- a/.env.example +++ b/.env.example @@ -26,6 +26,14 @@ ANTHROPIC_API_KEY=your-api-key-here # OPENROUTER_API_KEY=sk-or-your-openrouter-key # ROUTER_DEFAULT=openrouter,google/gemini-3-flash-preview +# ============================================================================= +# OPTION 3: Custom Anthropic Endpoint with Custom Model +# ============================================================================= +# Use a custom Anthropic-compatible API endpoint with a specific model name. +# ANTHROPIC_API_KEY=your-custom-api-key +# ANTHROPIC_BASE_URL=https://your-custom-endpoint.com +# ANTHROPIC_MODEL=claude-sonnet-4-5-20250929 # or any model your endpoint supports + # ============================================================================= # Available Models # ============================================================================= diff --git a/README.md b/README.md index 1ec4552c..12857c28 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Shannon is available in two editions: - [Usage Examples](#usage-examples) - [Configuration (Optional)](#configuration-optional) - [[EXPERIMENTAL - UNSUPPORTED] Router Mode (Alternative Providers)](#experimental---unsupported-router-mode-alternative-providers) + - [Custom Anthropic Endpoint](#custom-anthropic-endpoint) - [Output and Results](#output-and-results) - [Sample Reports](#-sample-reports) - [Architecture](#️-architecture) @@ -295,6 +296,26 @@ ROUTER_DEFAULT=openai,gpt-5.2 # provider,model format This feature is experimental and unsupported. Output quality depends heavily on the model. Shannon is built on top of the Anthropic Agent SDK and is optimized and primarily tested with Anthropic Claude models. Alternative providers may produce inconsistent results (including failing early phases like Recon) depending on the model and routing setup. +### Custom Anthropic Endpoint + +Shannon supports custom Anthropic-compatible API endpoints with configurable model names. This is useful for: + +* **Proxied Anthropic access** — route through corporate proxies or API gateways +* **Custom deployments** — use self-hosted or alternative Anthropic-compatible endpoints +* **Model selection** — specify a different Claude model than the default + +#### Configuration + +Add to your `.env` file: + +```bash +ANTHROPIC_API_KEY=your-api-key +ANTHROPIC_BASE_URL=https://your-custom-endpoint.com # Optional: custom endpoint +ANTHROPIC_MODEL=claude-sonnet-4-5-20250929 # Optional: custom model name +``` + +The `ANTHROPIC_MODEL` environment variable overrides the default model (`claude-sonnet-4-5-20250929`). Your endpoint must support the specified model. + ### Output and Results All results are saved to `./audit-logs/{hostname}_{sessionId}/` by default. Use `--output ` to specify a custom directory. diff --git a/docker-compose.yml b/docker-compose.yml index 26cbdfa9..870a379a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,7 @@ services: - ANTHROPIC_BASE_URL=${ANTHROPIC_BASE_URL:-} # Optional: route through claude-code-router - ANTHROPIC_AUTH_TOKEN=${ANTHROPIC_AUTH_TOKEN:-} # Auth token for router - ROUTER_DEFAULT=${ROUTER_DEFAULT:-} # Model name when using router (e.g., "gemini,gemini-2.5-pro") + - ANTHROPIC_MODEL=${ANTHROPIC_MODEL:-} # Custom model name (default: claude-sonnet-4-5-20250929) - CLAUDE_CODE_OAUTH_TOKEN=${CLAUDE_CODE_OAUTH_TOKEN:-} - CLAUDE_CODE_MAX_OUTPUT_TOKENS=${CLAUDE_CODE_MAX_OUTPUT_TOKENS:-64000} depends_on: diff --git a/src/ai/claude-executor.ts b/src/ai/claude-executor.ts index bd194e2d..3e430b32 100644 --- a/src/ai/claude-executor.ts +++ b/src/ai/claude-executor.ts @@ -219,7 +219,7 @@ export async function runClaudePrompt( const mcpServers = buildMcpServers(sourceDir, agentName); const options = { - model: 'claude-sonnet-4-5-20250929', + model: process.env.ANTHROPIC_MODEL || 'claude-sonnet-4-5-20250929', maxTurns: 10_000, cwd: sourceDir, permissionMode: 'bypassPermissions' as const,