E2E testing
Authenticate both providers:
# Subscription (opens browser for OAuth flow):
cargo run -p agentkit-switchboard -- --config crates/agentkit-switchboard/e2e.toml auth login chatgpt_sub
# API key (stores raw key in system keychain):
cargo run -p agentkit-switchboard -- --config crates/agentkit-switchboard/e2e.toml auth add openai_payg sk-...
Start proxy:
cargo run -p agentkit-switchboard -- --config crates/agentkit-switchboard/e2e.toml
Scenario A: Subscription routing
curl -i http://127.0.0.1:3812/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.4-mini","messages":[{"role":"user","content":"hi"}],"stream":false}'
Expected: HTTP 200, x-switchboard-provider: chatgpt_sub, x-switchboard-billing: subscription.
Scenario B: Session affinity
curl -i http://127.0.0.1:3812/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-Session-Id: sess-e2e-1" \
-d '{"model":"gpt-5.4-mini","messages":[{"role":"user","content":"hi"}],"stream":false}'
Run twice. Assert x-switchboard-provider is the same both times.
Cleanup
cargo run -p agentkit-switchboard -- --config crates/agentkit-switchboard/e2e.toml auth logout chatgpt_sub
cargo run -p agentkit-switchboard -- --config crates/agentkit-switchboard/e2e.toml auth logout openai_payg