Skip to content

feat(upstream): follow the OpenCode 2.1 client's version and /inference routes - #141

Merged
jasonxu114514 merged 1 commit into
jasonxu114514:mainfrom
AiFLYF:pr-a-211
Oct 23, 2026
Merged

jasonxu114514 merged 1 commit into
jasonxu114514:mainfrom
AiFLYF:pr-a-211

Conversation

@AiFLYF

@AiFLYF AiFLYF commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What

A captured 2.1.1 CLI request differs from the 2.0.32 capture in exactly two
places: the version in the User-Agent, and the route.

Version

-opencode/latest/2.0.32/cli
+opencode/latest/2.1.1/cli

Route — 2.1 groups /inference routes by provider family:

protocol 2.0.32 2.1.1
chat /inference/v1/chat/completions /inference/openai/v1/chat/completions
responses /inference/v1/responses /inference/openai/v1/responses
messages /inference/v1/messages /inference/anthropic/v1/messages

The old route still answers, so this is fidelity rather than a fix — but a
2.1 client never sends it.

Scope of the route change

The family segment is only inserted when the base URL path ends in
/inference. A custom base URL and the /zen/go lane keep the flat route,
because the grouping belongs to /inference alone.

How it was verified

  • Captured with a plugin hook on the official 2.1.1 binary (serve + /api/session),
    the same setup that produced the 2.0.32 capture.
  • Body is byte-identical between the two releases apart from the date and the
    working directory, so nothing else in this area moved.
  • /inference/anthropic/v1/messages and /inference/openai/v1/responses both
    exist (they answer with a gate error rather than 404).
  • go build ./..., go vet ./..., gofmt clean.

…ce routes

Captured a 2.1.1 CLI request with the plugin hook that produced the 2.0.32
capture. The body is byte-identical; what moved is the version string and the
route.

The 2.1 client groups /inference routes by provider family, so a chat request
goes to /inference/openai/v1/chat/completions, responses to
/inference/openai/v1/responses and messages to /inference/anthropic/v1/messages.
A 2.0.32 client posted the protocol path directly and that route still answers,
so this is fidelity rather than a fix.

The family segment is only inserted for the /inference origin: a custom base
URL and the /zen/go lane keep the flat route, because the grouping belongs to
/inference alone.
@jasonxu114514
jasonxu114514 merged commit f9ef569 into jasonxu114514:main Oct 23, 2026
5 checks passed
TiaraBasori added a commit to TiaraBasori/opencode2api-1 that referenced this pull request Oct 25, 2026
…breaker)

Pick up origin/main (19 commits since v1.4.3):

- 2.1.1 client shape: version bump, /inference/openai|anthropic family
  routes, max_completion_tokens 32000, strict:false tools, client key
  order, no HTML escaping, runtime-owned Accept/Content-Length (jasonxu114514#141-jasonxu114514#143)
- anonymous-lane abuse handling: IP-block detection, per-exit block TTL,
  circuit breaker (models.anonymous_backoff), max_anonymous_exits cap,
  deterministic 4xx stops the walk instead of replaying every exit
- placeholder key dropping, probe failure classification (jasonxu114514#111),
  WebUI Cache-Control (jasonxu114514#112), reasoning disable preserved end to end
  (jasonxu114514#150), Italian README/WebUI

Conflict resolutions:
- internal/config/config.go, README.md, README.zh-CN.md: kept both sides —
  the alias fields (aliases/strip_free_suffix) and the new
  anonymous_backoff block sit side by side in ModelsConfig and the README
  tables.

Local adaptation for this deployment's #pool exit (not upstream):
- a #pool transport dials a fresh upstream address on every attempt, so an
  IP-scoped abuse block cannot be parked on the transport: blocked() and
  markBlocked() ignore pool transports and the anonymous walk keeps
  rotating instead of freezing every exit behind one flagged address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants