Skip to content

Fix: inference-parser misses /chat/completions requests from OpenAI-compatible proxies (opencode, litellm) #822

Description

@msteinder

Problem

The inference-parser plugin dispatches on the request path in OnRequest with:

case "/v1/chat/completions", "/v1/completions":

OpenAI-compatible proxies such as litellm (used by opencode) strip the /v1 prefix and post to /chat/completions directly. This falls through to the default arm, so pctx.Extensions.Inference is never populated — resulting in missing model, token counts, and method fields in abctl session views.

Observed in abctl output when running opencode through authbridge-proxy in demo mode:

9     14:13:56.91   out   │┌ req   —         —                   ete-litellm.ai-mode…
9     14:13:59.27   out   │└ resp  —         —         200  2.36s ete-litellm.ai-mode…

Compare with Claude Code (which posts to /v1/messages — matched by the Anthropic path), where all fields are populated correctly.

Root cause

authbridge/authlib/plugins/inferenceparser/plugin.go — the OnRequest switch only covers /v1/chat/completions and /v1/completions. The /v1-less variants /chat/completions and /completions are not listed.

The response path (OnResponseFrame) is unaffected — its default branch already routes to the OpenAI parsers, so response parsing works once the request side is fixed.

Fix

Extend the OnRequest switch case to include the /v1-less variants:

// Before
case "/v1/chat/completions", "/v1/completions":

// After
case "/v1/chat/completions", "/v1/completions", "/chat/completions", "/completions":

No other changes needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions