gate: Claude Code behind it — OAuth bearer, anthropic-beta, token counting, the gate's own watch
A coding agent's traffic differs from a hand-made request: with a subscription Claude Code authenticates with an OAuth bearer and sends anthropic-beta; it counts tokens at /v1/messages/count_tokens; it makes a request per tool call; its tool-only turns have no text; its context runs to megabytes. So: with the courtyard key in X-Bikoret-Key, the caller's Authorization: Bearer is forwarded to Anthropic as its credential, and anthropic-beta with it; count_tokens is carried through unexamined and uncharged; the watch counts the gate at its own windows (120/min, 2,000/h per key — tier :gate); a reply with no text is delivered as it came with bikoret.verdict "none" and no fringe block (stream and non-stream); the sources keep the newest user turns whole and drop the oldest past 1 MiB. Ingress body 32 MiB; ConfigMap manna amounts raised to 5000/5000 (the kohen's lever). Tamid §1.1, KOHEN "Claude Code behind the gate". Doorpost re-pinned. Elixir 617/0 read before this commit; gate_test 25. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
a16617fffe
commit
f19a5ea007
13 files changed
+207
-43
No files matched your search
+17
-7
@@ -443,9 +443,14 @@ POST /gate/openai/v1/chat/completions body: the OpenAI Chat Completions reques
|
||||
Headers:
|
||||
Authorization: Bearer <courtyard key> (or X-Bikoret-Key: <courtyard key>)
|
||||
x-api-key: <your Anthropic key> forwarded; never stored, never logged
|
||||
Authorization: Bearer <your Anthropic OAuth token> with the courtyard key in X-Bikoret-Key
|
||||
(what Claude Code sends with a subscription)
|
||||
Authorization: Bearer <your OpenAI key> with the courtyard key in X-Bikoret-Key
|
||||
anthropic-version: 2023-06-01 forwarded (default when absent)
|
||||
X-Bikoret-Rebuke: once optional — hocheach tochiach
|
||||
anthropic-version, anthropic-beta forwarded as sent (version defaults to 2023-06-01)
|
||||
X-Bikoret-Rebuke: once optional — hocheach tochiach
|
||||
|
||||
POST /gate/anthropic/v1/messages/count_tokens carried through under the caller's
|
||||
credential; not a reply: not examined, no manna
|
||||
|
||||
Response (200): the upstream's reply, with
|
||||
- the fringe appended to its last text block:
|
||||
@@ -482,11 +487,16 @@ reply is examined like the first (its record carries rebukes: <first
|
||||
ref>) and is the one delivered, marked with both. Never a third.
|
||||
|
||||
Manna: one api_calls_external per upstream call, one compute unit per
|
||||
examination; spent → 503 MANNA_DEPLETED before any call. Errors: 401/403
|
||||
(courtyard key), 422 (no upstream key, no messages, stream), 502
|
||||
UPSTREAM_UNAVAILABLE (the gate made no verdict and delivered nothing),
|
||||
503 KORBAN/TALMUDIC_UNAVAILABLE (a 200 from the model is never delivered
|
||||
unexamined).
|
||||
examination; spent → 503 MANNA_DEPLETED before any call. The watch counts
|
||||
the gate at its own windows — 120 a minute, 2,000 an hour per key — a
|
||||
coding agent behind it makes a request per tool call. A reply with no
|
||||
text (tool use only) is not a reply to a reader: delivered as it came,
|
||||
no fringe, `bikoret.verdict: "none", reason: "no text"`. The sources
|
||||
keep the newest user turns whole and drop the oldest past 1 MiB. Errors:
|
||||
401/403 (courtyard key), 422 (no upstream credential, no messages,
|
||||
stream with rebuke), 502 UPSTREAM_UNAVAILABLE (the gate made no verdict
|
||||
and delivered nothing), 503 KORBAN/TALMUDIC_UNAVAILABLE (a 200 from the
|
||||
model is never delivered unexamined).
|
||||
```
|
||||
|
||||
**Anchoring is deterministic and lexical** (`korban_processor/bedikah.py`):
|
||||
|
||||
Reference in new issue
Block a user