Files
magpie/docs
yetone 6f264030af gateway: OpenRouter's agentic-harness 403 rests nothing, and a test says why
Wade111999 on X tested OpenRouter's thinkingmachines/inkling-2-small:free
in magpie and got "403 · … is only available on agentic harnesses".
OpenRouter serves that free endpoint only to agent apps it lists at
openrouter.ai/apps, judged by the app a request is attributed to (its
HTTP-Referer; the 403's routing step is "Gate Free Endpoints by Agentic
Harness"). Its docs and other clients' real-key reports (Skales #325,
OpenTrading #204) say attribution headers of an unlisted app don't pass
it, and the paid thinkingmachines/inkling-2-small has no gate. A model
test is magpie's own request, so it is refused; magpie never names an
app it isn't.

Two things magpie did wrong with it:
- restAfterMarked read the 403 as the key's: it rested the whole
  OpenRouter key (Key "openrouter", by backoff), so one agent request for
  the gated model set every other OpenRouter model aside. It now rests
  nothing and counts no failure, as a region refusal; a group's next
  member is still asked (retryable). A key's own 403 still rests the key.
- the test showed a bare 403. APIError now puts HarnessOnlyHint after
  OpenRouter's words: served only to listed agent apps, a magpie test
  isn't one, the model without :free is served to any request.

Not changed: magpie passes the agent's User-Agent to OpenRouter as
before, but agents send OpenRouter's attribution headers (HTTP-Referer,
X-OpenRouter-Title) only to openrouter.ai itself, so whether OpenRouter
serves an agent's request through magpie is not known.

Run (mica, mote over its load):
- TestHarnessOnlyTestSaysWhy, TestOpenRouterHarnessOnlyRestsNothing:
  red on origin/main's routing.go and test.go (the key rested
  {Key:openrouter By:backoff}; the error had no hint), green after.
- go test -timeout 45m -count=1 ./internal/provider ./internal/gateway:
  ok internal/provider 170.7s, ok internal/gateway 1012.0s (mica, at e513cba54 + this diff)
  Rebased on 51eb1ae4b (main's gemini audio change in both packages): go vet
  of both packages, and the two tests above with -run Gemini|Audio, ok
  on mica at the pushed head.
- go vet, GOOS=linux and GOOS=windows go vet of both packages, gofmt -l:
  clean.
Not tried: a real OpenRouter request; every OpenRouter key on this
machine, mote and mica answers 401 "User not found".
2026-11-15 01:32:07 +08:00
..