From 3c45394f4e63e193ba551c753834cff063cf7dee Mon Sep 17 00:00:00 2001 From: sabhatinas Date: Tue, 7 Jul 2026 20:14:46 +0000 Subject: [PATCH 1/2] docs(configure): require api key in route-bundle setup --- README.md | 7 ++++++- docs/cli_reference.md | 10 +++++++--- docs/getting_started.md | 27 +++++++++++++++++++++------ docs/index.md | 7 ++++++- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2b898401..db3ba97d 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,14 @@ routes: ```bash switchyard --routing-profiles routes.yaml -- launch claude -switchyard --routing-profiles routes.yaml -- configure +switchyard --routing-profiles routes.yaml -- configure --target provider \ + --provider openrouter --api-key "$OPENROUTER_API_KEY" \ + --base-url https://openrouter.ai/api/v1 --no-tui --no-model-discovery ``` +Non-interactive `configure` does not read provider credentials from the routing +bundle; pass `--api-key` explicitly when persisting the bundle for CI. + For profile selection and full configuration examples, start with [Routing Overview](docs/routing_algorithms/overview.md), then open the strategy-specific page: diff --git a/docs/cli_reference.md b/docs/cli_reference.md index 61137b3f..84012562 100644 --- a/docs/cli_reference.md +++ b/docs/cli_reference.md @@ -252,8 +252,10 @@ curl localhost:4000/v1/chat/completions \ # Legacy route bundle on port 4000 switchyard --routing-profiles routes.yaml -- serve --port 4000 -# Use the bundle previously persisted by `switchyard --routing-profiles ... -- configure` -switchyard --routing-profiles routes.yaml -- configure +# Persist a bundle for later runs; no-TTY configure requires explicit provider credentials +switchyard --routing-profiles routes.yaml -- configure --target provider \ + --provider openrouter --api-key "$OPENROUTER_API_KEY" \ + --base-url https://openrouter.ai/api/v1 --no-tui --no-model-discovery switchyard serve --port 4000 # Multi-worker uvicorn (route-bundle path) @@ -467,7 +469,9 @@ The top-level key is omitted when skill distillation is not configured. `namespa switchyard configure # Save a routing bundle as the default for serve + launchers -switchyard --routing-profiles routes.yaml -- configure +switchyard --routing-profiles routes.yaml -- configure --target provider \ + --provider openrouter --api-key "$OPENROUTER_API_KEY" \ + --base-url https://openrouter.ai/api/v1 --no-tui --no-model-discovery # Inspect what's stored, plus resolved provider / key source / harness paths switchyard configure --show diff --git a/docs/getting_started.md b/docs/getting_started.md index 94665a07..d0b645f3 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -45,9 +45,16 @@ routes: fallback_target_on_evict: strong EOF -switchyard --routing-profiles routes.yaml -- configure +switchyard --routing-profiles routes.yaml -- configure --target provider \ + --provider openrouter --api-key "$OPENROUTER_API_KEY" \ + --base-url https://openrouter.ai/api/v1 --no-tui --no-model-discovery ``` +`api_key` inside the route bundle is used when Switchyard serves or launches the +bundle. `configure --no-tui` still requires provider credentials as explicit +flags, so CI setup should pass `--api-key` even when the YAML contains +`${OPENROUTER_API_KEY}`. + > **Format default and caching.** Omitting `format:` from a tier silently defaults to `OPENAI` (Chat Completions) — not `AUTO`. For Claude/Anthropic/Bedrock tiers this is wrong: set `format: anthropic` explicitly. The native `/v1/messages` path preserves `cache_control`, which is what enables prompt caching. `format: openai` routes Claude through OpenAI-format translation that strips `cache_control`: the request still succeeds, but caching silently never engages and you pay full input price. Always use `format: openai` for NIM/non-Claude models and `format: anthropic` for Claude and Bedrock models. Use `format: auto` only when the upstream is genuinely unknown. Inspect what was saved: @@ -76,9 +83,17 @@ curl http://localhost:4000/v1/chat/completions \ -d '{"model": "smart", "messages": [{"role": "user", "content": "hello"}]}' ``` -**CI pattern:** run `switchyard --routing-profiles routes.yaml -- configure` in -your environment setup, then `switchyard serve` in your service start step. No -flags needed at serve time. +**CI pattern:** run configure in your environment setup with explicit provider +credentials: + +```bash +switchyard --routing-profiles routes.yaml -- configure --target provider \ + --provider openrouter --api-key "$OPENROUTER_API_KEY" \ + --base-url https://openrouter.ai/api/v1 --no-tui --no-model-discovery +``` + +Then run `switchyard serve` in your service start step. No flags needed at serve +time. > **Override (dev / one-off work):** pass `--routing-profiles` to use a different > bundle for a session without overwriting your saved config: @@ -117,8 +132,8 @@ aliasing. ## Routing profiles All route types work with both [Path A](#path-a-server-mode) and -[Path B](#path-b-agent-launcher). Declare a type in your YAML, run -`switchyard --routing-profiles routes.yaml -- configure`, then `serve` or `launch` as above. +[Path B](#path-b-agent-launcher). Declare a type in your YAML, run the +non-interactive configure command above, then `serve` or `launch` as above. ### Choose a route type diff --git a/docs/index.md b/docs/index.md index c15f5a4e..fd07e221 100644 --- a/docs/index.md +++ b/docs/index.md @@ -120,9 +120,14 @@ legacy bundles and saved bundle paths: ```bash switchyard --routing-profiles routes.yaml -- launch claude -switchyard --routing-profiles routes.yaml -- configure +switchyard --routing-profiles routes.yaml -- configure --target provider \ + --provider openrouter --api-key "$OPENROUTER_API_KEY" \ + --base-url https://openrouter.ai/api/v1 --no-tui --no-model-discovery ``` +Non-interactive `configure` does not read provider credentials from the routing +bundle; pass `--api-key` explicitly when persisting the bundle for CI. + Profile ids, direct targets, legacy launcher compatibility, and persistence are covered in [Routing Overview](routing_algorithms/overview.md). From b18110de6f1a3ef14a1d82196bce47e09459d1be Mon Sep 17 00:00:00 2001 From: sabhatinas Date: Tue, 7 Jul 2026 21:22:54 +0000 Subject: [PATCH 2/2] chore(ci): refresh secret baseline --- .secrets.baseline | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 8c63cb15..a242009c 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -98,10 +98,6 @@ "path": "detect_secrets.filters.common.is_baseline_file", "filename": ".secrets.baseline" }, - { - "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", - "min_level": 2 - }, { "path": "detect_secrets.filters.heuristic.is_indirect_reference" }, @@ -265,7 +261,7 @@ "filename": "README.md", "hashed_secret": "ec3810e10fb78db55ce38b9c18d1c3eb1db739e0", "is_verified": false, - "line_number": 165 + "line_number": 170 } ], "crates/switchyard-components-v2/src/profiles/stage_router.rs": [ @@ -308,7 +304,7 @@ "filename": "docs/cli_reference.md", "hashed_secret": "414cb2d928610e260b1b00de84c809d2adef2480", "is_verified": false, - "line_number": 561 + "line_number": 565 } ], "examples/minimal.py": [ @@ -1193,5 +1189,5 @@ } ] }, - "generated_at": "2026-07-06T23:24:20Z" + "generated_at": "2026-07-07T21:22:06Z" }