@bman654/clodex 2.5.2 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ # OpenCode Go provider
2
+
3
+ Clodex can expose OpenCode Go models alongside Claude and OpenAI/Codex models in the same Claude Code session.
4
+
5
+ ## Setup
6
+
7
+ Run:
8
+
9
+ ```bash
10
+ clodex providers add
11
+ ```
12
+
13
+ Choose **OpenCode Go API key**, paste an API key from OpenCode, then use `clodex models` to add the desired models to favorites. The pasted key is checked against the authenticated chat-completions endpoint before it is saved — `/models` alone cannot validate a credential (see below). The pre-save probe rejects only definite, recognized authentication failures; timeout, network, and unrecognized responses are inconclusive, so a bad key may still be saved and surface an authentication failure on first inference. Favorites can be assigned short aliases and patched into Claude Code in the same way as OpenAI models.
14
+
15
+ The provider uses one credential with two upstream wire protocols:
16
+
17
+ - Anthropic Messages models are passed through to `https://opencode.ai/zen/go/v1/messages`.
18
+ - OpenAI Chat Completions models are translated through the OpenAI-compatible SDK at `https://opencode.ai/zen/go/v1/chat/completions`.
19
+
20
+ The selective proxy diverts only explicit `clodex:opencode-go:...` model ids or saved aliases. Ordinary Claude model traffic remains on Claude Code's native Anthropic connection.
21
+
22
+ ## Supported transport scope
23
+
24
+ The upstream OpenCode Go catalog also contains Responses-API models. Clodex intentionally excludes those entries from this provider (currently Grok and mainline GPT; other unmapped ids are reported by the updater until their transport is verified). The supported catalog contains only Anthropic Messages and Chat Completions models.
25
+
26
+ Live `/models` results are treated as availability data. Clodex layers its committed catalog over those results to supply the correct protocol, endpoint, context window, modalities, pricing, and compatibility behavior per model. Models absent from the committed allowlist are hidden even when the live endpoint advertises them.
27
+
28
+ ## Updating the catalog
29
+
30
+ The committed catalog is generated directly from OpenCode's own catalog service (`models.dev/api.json`, provider `opencode-go`):
31
+
32
+ ```bash
33
+ pnpm update:opencode-go
34
+ ```
35
+
36
+ The updater takes per-model metadata (name, context window, cost, modalities) from models.dev and merges it with the transport map and compatibility patches maintained in `scripts/update-opencode-go-models.mjs` — models.dev does not publish wire transports, and per-model routing is live-validated clodex knowledge. Only transport-mapped ids enter the catalog; new models on models.dev are reported as unmapped so their transport can be verified against the live endpoint before they ship. The script records the fetch time in `OPENCODE_GO_SOURCE_FETCHED_AT`.
37
+
38
+ Review catalog, pricing, endpoint, and compatibility changes before committing generated output. In particular, a model changing between Anthropic Messages, Chat Completions, and Responses is a routing change rather than a cosmetic catalog refresh.
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@bman654/clodex",
3
- "version": "2.5.2",
3
+ "version": "2.6.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "description": "Bridge Claude Code to OpenAI models — OpenAI API key or ChatGPT/Codex-plan OAuth, with prompt caching, auto-compaction, model switching, and a Claude Code binary patcher",
7
+ "description": "Bridge Claude Code to OpenAI and OpenCode Go models — API keys or ChatGPT/Codex-plan OAuth, with prompt caching, auto-compaction, model switching, and a Claude Code binary patcher",
8
8
  "author": "Brandon Wallace",
9
9
  "license": "MIT",
10
10
  "keywords": [
11
11
  "claude",
12
12
  "claude-code",
13
13
  "openai",
14
+ "opencode",
14
15
  "chatgpt",
15
16
  "codex",
16
17
  "ai",
@@ -40,7 +41,8 @@
40
41
  "test:watch": "vitest",
41
42
  "typecheck": "tsc --noEmit",
42
43
  "prepare": "husky",
43
- "prepublishOnly": "pnpm build"
44
+ "prepublishOnly": "pnpm build",
45
+ "update:opencode-go": "node scripts/update-opencode-go-models.mjs"
44
46
  },
45
47
  "dependencies": {
46
48
  "@ai-sdk/anthropic": "4.0.12",