Der Endpunkt-Block trägt genau eine Kontextzahl; ein Anbieter bedient damit aber mehrere Modelle mit eigenen Grenzen. deepseek-v4.1-flash hat 1.000.000 Kontext und 384.000 Ausgabe — mit der geratenen Endpunktzahl 200000 wurden Anfragen deshalb faelschlich als "context" uebersprungen, und der Client bekam 503 no_endpoint. Jetzt holt junction beim Start je Endpunkt GET <base>/models und liest pro Modell limit.context und limit.output (models.c). Die Grenze des Modells schlaegt die Zahl des Endpunkts; die Konfiguration bleibt Rueckfall. Ist beides unbekannt, wird ein Ziel nicht wegen Kontext abgelehnt — unbekannt ist nicht "passt nicht". Der Abruf laeuft im Hintergrund: synchron haette ein Endpunkt mit 6 s Antwortzeit den Start um 6 s verzoegert (im Test gemessen). Ein "as" schreibt den Modellnamen um, also gilt der Name, den der Endpunkt sieht. kind opencode und Endpunkte mit base_cmd werden uebersprungen — dort gibt es keine OpenAI-Modellliste. Test: tests/stub veroeffentlicht limit.* (STUB_CTX/STUB_OUT); zwei neue Pruefungen zeigen, dass die Modellzahl die Endpunktzahl schlaegt und dass ohne Veroeffentlichung weiter die Endpunktzahl gilt. make test: 115 gruen, keine Fehler.
111 lines
3.8 KiB
Plaintext
111 lines
3.8 KiB
Plaintext
# junction.conf — pf.conf-style. keyword, arguments, braces. '#' starts a comment.
|
|
# Double quotes group words. Unknown keywords are a hard error with a line number.
|
|
|
|
# Plain listener:
|
|
listen 0.0.0.0:8090
|
|
# ... or TLS (https clients without a proxy in front):
|
|
# listen 0.0.0.0:8443 tls /etc/junction/tls/cert.pem /etc/junction/tls/key.pem
|
|
|
|
connect_timeout_ms 1500
|
|
offline_hold_s 20
|
|
max_body_bytes 67108864
|
|
|
|
# How many upstream requests may run at once; the rest wait in line. A waiting
|
|
# streaming caller gets SSE comments explaining the wait, a plain one waits silently.
|
|
max_inflight 4
|
|
queue_timeout 300
|
|
|
|
# Response cache (memory only). ttl 0 disables it. Only complete, non-streamed 200
|
|
# answers are stored, keyed on method + path + model + body.
|
|
cache_ttl 300
|
|
cache_entries 128
|
|
cache_bytes 33554432
|
|
|
|
# --------------------------------------------------------------------- endpoints
|
|
endpoint peer1 {
|
|
base http://192.0.2.10:8081/v1
|
|
kind remote
|
|
context 64000
|
|
priority 20
|
|
timeout 600
|
|
idle_timeout 60
|
|
cooldown 120
|
|
hook /opt/junction/hooks/check-http.sh
|
|
}
|
|
|
|
endpoint peer2 {
|
|
base http://192.0.2.10:8082/v1
|
|
kind remote
|
|
context 64000
|
|
priority 20
|
|
timeout 600
|
|
idle_timeout 60
|
|
cooldown 120
|
|
hook /opt/junction/hooks/check-http.sh
|
|
}
|
|
|
|
endpoint workstation {
|
|
base http://192.0.2.20:8080/v1
|
|
kind local
|
|
context 128000
|
|
priority 10
|
|
timeout 1800
|
|
idle_timeout 30
|
|
cooldown 60
|
|
hook_retry 180
|
|
hook_backoff 5
|
|
wake /opt/junction/hooks/wake-wol.sh
|
|
hook /opt/junction/hooks/check-http.sh
|
|
hook /opt/junction/hooks/check-budget.sh
|
|
}
|
|
|
|
endpoint cloud {
|
|
base https://api.example.com/v1
|
|
kind cloud
|
|
# Rückfall, keine Wahrheit: die Grenzen der Modelle holt junction beim Start aus
|
|
# der Modellliste des Endpunkts (GET /models → limit.context / limit.output).
|
|
# Diese Zahl gilt nur, wenn der Abruf scheitert oder das Modell dort fehlt.
|
|
context 200000
|
|
priority 90
|
|
timeout 900
|
|
idle_timeout 120
|
|
cache off # never store cloud answers
|
|
api_key_env EXAMPLE_API_KEY
|
|
tls_verify on # off only for a self-signed internal endpoint
|
|
# tls_ca /etc/junction/tls/internal-ca.pem
|
|
header "X-Title: olivia" # static header sent with every request here
|
|
}
|
|
|
|
# --------------------------------------------------------------------------- mcp
|
|
#
|
|
# junction wird dadurch selbst zum MCP-Server: ein Agent verbindet sich mit
|
|
# http://127.0.0.1:8090/mcp und sieht die Werkzeuge aller hier eingetragenen
|
|
# Server, mit dem Servernamen als Präfix ("tasksd__task_create"). Ein toter
|
|
# Server wird übersprungen, die übrigen Werkzeuge kommen trotzdem.
|
|
#
|
|
# mcp tasksd url http://127.0.0.1:8781/mcp
|
|
# mcp skilld url http://127.0.0.1:8790/mcp header "Authorization: Bearer CHANGE_ME"
|
|
# mcp_cache_ttl 60
|
|
|
|
# ------------------------------------------------------------------------- rules
|
|
# First matching rule wins. Rules may use:
|
|
# for <model-glob> need >N | <N | N path <glob>
|
|
# check hooks|none retry <seconds>
|
|
# pass <endpoint>[,<endpoint>...] [as <model>] | block
|
|
|
|
# A client that DECLARES more output than the peers can hold goes to the big box.
|
|
# 'need' reads max_tokens from the request; there is no character counting and no
|
|
# default, so a request that states nothing is not sized by guesswork.
|
|
req need >64000 pass workstation, cloud
|
|
|
|
# Coding work: prefer the workstation, wake it, wait up to 5 minutes for the hooks,
|
|
# and hand it the model name it actually serves.
|
|
req for "*coder*" check hooks retry 300 pass workstation as "Qwen3.8-Flash-Next-GSQ-RCO-IQ1_M"
|
|
req for "Qwen3.8-Flash-Next*" check hooks retry 60 pass workstation, peer1, peer2
|
|
|
|
# Cheap metadata calls never need a model at all.
|
|
req path "/v1/models" check none pass peer1, peer2, cloud
|
|
|
|
# Anything unseen is refused rather than silently sent to the cloud.
|
|
req for "*" block
|