-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelay.example.yaml
More file actions
132 lines (126 loc) · 4.71 KB
/
Copy pathrelay.example.yaml
File metadata and controls
132 lines (126 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Switchback relay config for the `sb` CLI — turnkey example.
#
# install.sh seeds this to ~/.config/switchback/switchback.yaml (only if absent)
# and substitutes __HOME__ → your home dir. Then run the relay and `sb doctor`.
#
# switchback serve --config ~/.config/switchback/switchback.yaml
# sb doctor
#
# Secrets stay in env vars (api_key_env) — this file holds NO keys. The taps need
# NO keys at all (they forward the client's own auth). Only the scout pool / free
# lanes (opencode, pi, scout/*) need OPENROUTER_API_KEY (and optionally the others).
server:
bind: "127.0.0.1:18765"
privacy_mode: metadata_only
# In-memory ledger/traces work regardless; these files let `sb watch` / `sb status`
# show traffic. state_store is best-effort (required:false) so startup never fails.
state_store:
path: "__SWITCHBACK_ROOT__/.switchback/state/scout.sqlite"
required: false
trace_log: "__SWITCHBACK_ROOT__/.switchback/state/traces.jsonl"
usage_log: "__SWITCHBACK_ROOT__/.switchback/state/usage.jsonl"
trace_ring_size: 2000
# Mode B — transparent tap listeners. Forward the native client's OWN request +
# auth verbatim to the real backend and observe only; the vendor sees native
# traffic. capture_bodies:false = metadata only (flip to true to log full
# prompts+replies locally to tap-bodies.jsonl). `sb codex`/`sb claude` point here.
taps:
- id: claude-tap
bind: "127.0.0.1:18770"
upstream: "https://api.anthropic.com"
capture_bodies: false
- id: codex-tap
bind: "127.0.0.1:18771"
upstream: "https://chatgpt.com/backend-api/codex"
capture_bodies: false
providers:
# OpenAI-compatible free/cheap pools for the scout lanes (opencode/pi/scout/*).
# A fresh user only needs OPENROUTER_API_KEY to get going; the others are optional.
- id: openrouter
type: openai_compatible
base_url: "https://openrouter.ai/api/v1"
api_key_env: OPENROUTER_API_KEY
- id: deepseek
type: openai_compatible
base_url: "https://api.deepseek.com"
api_key_env: DEEPSEEK_API_KEY
- id: nvidia
type: openai_compatible
base_url: "https://integrate.api.nvidia.com/v1"
api_key_env: NVIDIA_API_KEY
- id: zai
type: openai_compatible
base_url: "https://api.z.ai/api/paas/v4"
api_key_env: ZAI_API_KEY
# Mode C (codex-relay): leases ~/.codex/auth.json to call the first-party Codex
# backend through the canonical engine. No API key — uses your Codex login.
- id: codex-relay
type: codex_native_relay
accounts:
- id: codex-native
auth: { kind: codex_oauth }
client_profiles:
- id: codex-native
kind: codex
mode: native_relay
models: ["codex/native"]
accounts: ["codex-relay/codex-native"]
description: "Codex subscription-native relay profile; no silent fallback to scout/free lanes."
- id: codex-scout
kind: codex
mode: scout_api
models: ["scout/code"]
accounts: ["openrouter/default"]
description: "Cheap/free scout profile; explicitly not subscription-native relay."
plugins:
- type: model_blocklist
models: ["codex-native"]
# Free streaming pools, newest/cheapest first; a model that 4xx/5xx falls through.
combos:
nonstop-chat:
strategy: fallback
require: { streaming: true }
models:
- "openrouter/openrouter/free"
- "openrouter/z-ai/glm-4.5-air:free"
- "openrouter/qwen/qwen3-coder:free"
- "openrouter/openai/gpt-oss-120b:free"
- "openrouter/openai/gpt-oss-20b:free"
continuous-free:
strategy: fallback
models:
- "openrouter/qwen/qwen3-coder:free"
- "openrouter/openrouter/free"
- "openrouter/openai/gpt-oss-120b:free"
- "openrouter/openai/gpt-oss-20b:free"
routes:
# scout/code + scout/chat are the slash-free aliases the sb gateway lane uses.
- name: scout-code
match: { model: "scout/code" }
require: { streaming: true }
targets:
- "openrouter/qwen/qwen3-coder:free"
- "openrouter/openrouter/free"
- "openrouter/openai/gpt-oss-120b:free"
- "openrouter/openai/gpt-oss-20b:free"
- name: scout-chat
match: { model: "scout/chat" }
require: { streaming: true }
targets:
- "openrouter/openrouter/free"
- "openrouter/z-ai/glm-4.5-air:free"
- "openrouter/qwen/qwen3-coder:free"
- "openrouter/openai/gpt-oss-120b:free"
# codex-relay (Mode C) lane.
- name: codex-native-relay
match: { model: "codex/native" }
targets:
- "codex-relay/gpt-5.5"
# Everything else (incl. `model: openrouter` used by opencode/pi) → free pool.
- name: default
match: { model: "*" }
targets:
- "openrouter/qwen/qwen3-coder:free"
- "openrouter/openrouter/free"
- "openrouter/openai/gpt-oss-120b:free"
- "openrouter/openai/gpt-oss-20b:free"