feat(provider): recognise OpenCode Go and Zen as first-class variants#6
Merged
Merged
Conversation
Previously, ingest events tagged provider="opencode" or
"opencode_zen" fell through to Provider::OpenAICompatible — keeping
the data correct but tagging it as "openai_compatible" on every
downstream surface (id_key, dashboards, metrics labels). Adds two
dedicated variants so consumers see the right label without
inspecting the base_url.
- Provider::OpenCode ← opencode.ai/zen/go (subscription)
- Provider::OpenCodeZen ← opencode.ai/zen (PAYG)
Both share the same canonical_host (opencode.ai) and use bearer
auth; from_host_path disambiguates by URL prefix (/zen/go for Go,
/zen for Zen). from_id_key adds the snake_case keys, with
from_id_key_ignore_case also accepting the "opencode-zen" hyphenated
form for HTTP query params. usage::total_billable_input_tokens
treats both as input-only (no cache-creation/cache-read summing) —
same rule as the other OpenAI-compatible providers.
No schema change. No wire-format change. Existing events with
provider="opencode" stored as OpenAICompatible{base_url:"opencode"}
remain valid; new ingest will deserialise to the dedicated variant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Previously, ingest events tagged `provider="opencode"` or `"opencode_zen"` fell through to `Provider::OpenAICompatible` — keeping the data correct but tagging it as `"openai_compatible"` on every downstream surface (`id_key`, dashboards, metrics labels).
This PR adds two dedicated variants so consumers (Obol's `/monitor`, dashboards, etc.) see the right label without inspecting the `base_url`:
Both share the same `canonical_host` (`opencode.ai`) and use bearer auth; `from_host_path` disambiguates by URL prefix (`/zen/go` for Go, `/zen` for Zen). `from_id_key` adds snake_case keys, with `from_id_key_ignore_case` also accepting the `"opencode-zen"` hyphenated form for HTTP query params.
`usage::total_billable_input_tokens` treats both as input-only (no cache-creation/cache-read summing) — same rule as the other OpenAI-compatible providers.
No schema change. No wire-format change. Existing events with `provider="opencode"` stored as `OpenAICompatible{base_url:"opencode"}` remain valid; new ingest will deserialise to the dedicated variant.
Test plan