Skip to content

docs(cli): connect OpenCode on your own model provider, from the command line - #2345

Merged
lilyshen0722 merged 3 commits into
mainfrom
docs/cli-opencode-outsider
Oct 19, 2026
Merged

lilyshen0722 merged 3 commits into
mainfrom
docs/cli-opencode-outsider

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What happened

Two of the last three outside signups asked for a non-Claude model. One of them asked for DeepSeek's own CLI and left when told no. DeepSeek models can join today through OpenCode, but nothing written told anyone how. The Bring your own page sets up Claude Code or Codex only, and a key from that page refuses OpenCode.

What this adds

docs/cli/opencode.md is a short outsider guide. It covers:

  • install
  • commonly login
  • the key file rules: mode 0600, not a symlink, outside the workspace
  • the environment file, with provider.id, baseURL, keyFile, model and workspace.path
  • agent attach opencode
  • agent run
  • the untested-version warning, and that it only stops public agents
  • detach

The guide is limited to macOS. It marks the DeepSeek example as walked through an OpenAI-compatible endpoint, not by calling api.deepseek.com directly. docs/cli/README.md gains one pointer line.

How it was checked

Walked on 2026-10-19 at 19:19Z on macOS:

  • an ordinary (non-admin) account
  • CLI 0.1.108 from npm, with OpenCode 1.19.3, today's npm latest
  • the same environment-file shape the guide shows
  • agent attach opencode into a private pod, then agent run

An @mention got the right answer in about 7 s. The reply was posted through the Commonly tool. The run printed the exact warning line the guide quotes. Afterwards the agent was detached and its local files removed.

One step differed from the guide: the walk signed in with an existing account token instead of running commonly login.

The field rules quoted come from the CLI's own checks:

  • the provider keys allowed and the safe-id pattern (environment.js);
  • the 0600 / not-a-symlink / outside-workspace key file (provider-proxy.js);
  • the untested-version behaviour (adapters/opencode.js).

Gemini, walked the same day

The guide says Gemini doesn't work through this route yet. A new Google AI Studio key (free tier) and the same steps produced two failures:

  • gemini-2.5-flash and gemini-2.5-flash-lite return 404 "no longer available to new users".
  • gemini-3.8-flash answered, but its tool call failed with 400 INVALID_ARGUMENT: "Function call is missing a thought_signature". The OpenAI-compatible provider the adapter configures doesn't send Gemini 3's thought signature back.

The key was read into a 0600 file and deleted afterwards. The agent was detached.

Docs only. Nothing deploys.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Wkz5axAzCvoLEFkZ5KtkKG

lilyshen0722 and others added 2 commits October 19, 2026 12:30
…and line

The Bring your own page sets up Claude Code or Codex only, and a key from it
refuses OpenCode. People asking for DeepSeek had no written path to the one
that works today: attach OpenCode with an environment file naming the provider
and the model. This guide covers install, sign-in, the key file rules, the
environment file, attach, run, and the untested-version warning, and it marks
what was walked (macOS, CLI 0.1.108, OpenCode 1.19.3, DeepSeek V4 Flash through
an OpenAI-compatible endpoint).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wkz5axAzCvoLEFkZ5KtkKG
Walked 2026-10-19 with a new Google AI Studio key: the 2.5 models answer
404 for new users, and gemini-3.8-flash refuses tool calls on the
OpenAI-compatible route for a missing thought_signature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wkz5axAzCvoLEFkZ5KtkKG

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs gate on #2345 at 547a39f5b4005f9eb17166b19ea522dab97da3ea. main is an ancestor; CI 13 pass / 2 skipping at this head.

What I verified against the sources you named, at main (cli 0.1.108).

  • Key-file rules — all four exact. resolveProviderKeyFile requires an absolute path, refuses a symlink or non-regular file, requires mode exactly 0600, and refuses a key inside the workspace — the last via realpath on both sides, so a symlink out of the workspace doesn't evade it. "Read from a file, never from the environment file itself" also holds: findInlineProviderCredentialField rejects an inline credential in provider.models.*.
  • The quoted warning line is verbatim. describeOpenCodeVersionMismatch composes installed OpenCode 1.19.3 is newer than smoke-tested versions 1.18.35, 1.19.0, the caller prefixes [opencode] and appends ; trusted seat continues. TESTED_OPENCODE_VERSIONS is ['1.18.35','1.19.0'] in that order. Character-for-character the guide's line.
  • "Only public agents stop on it" is right. if (isPublic && !allowOverride) throw — a trusted seat warns and continues. (The guide omits the COMMONLY_OPENCODE_ALLOW_UNTESTED_VERSION=1 host override; correct to omit from an outsider guide.)
  • "A key copied from that page can't run OpenCode" is right, at both ends. BOOTSTRAP_ADAPTER_DETECT_ORDER is ['claude','codex','pi'], so auto-detect never selects opencode; and an explicit --adapter opencode on the BYO path is refused by serverAdapterBindingRefusal, whose own message tells the reader to run commonly agent attach opencode --pod … --name … — the guide's instruction. I checked the override path because the default path alone wouldn't have settled it.
  • Node ≥ 20 matches engines; commonly login prints a code and press o to open the browser; agent detach <name> exists; names match the server's ^[a-z0-9-]+$ with unique: true, so "shared across the whole instance and stay taken" is accurate; opencode-ai on npm is at 1.19.3 today, the version the guide says it walked.
  • I ran the doc's own environment.json through validateEnvironmentSpec: OK as written.

GATE: HOLD — two text defects a reader following this guide can hit, then three minor ones.

D1. The community-pod sentence states the wrong reason, and the real refusal is escapable. The guide says "a community pod refuses agents from members." What the CLI does: attaching to a publicRead or communityListed pod is refused only when the environment declares no sandbox, and the error names the fix — add "sandbox": { "trust": "public" } — after which the attach proceeds. So the refusal is about the missing declaration, not about membership or the pod being community, and it is not final. As written, a reader who tries their community pod reads the error, believes community pods don't take member agents, and stops — when one line of JSON would have worked. The guide's example has no sandbox block, so this is the error they'd meet. Remedy: say that a publicly readable or community-listed pod needs "sandbox": { "trust": "public" } in the environment file, and that without it the attach refuses.

D2. The example hands the reader the one route the guide says was not walked. The environment.json block sets "baseURL": "https://api.deepseek.com/v1", and the bold note below it says the walk went through an OpenAI-compatible endpoint serving DeepSeek V4 Flash, not api.deepseek.com directly. The copy-paste path is therefore the unverified one, and the caveat arrives after the block. Tonight's emails point people at this file to follow today. Remedy: put the walked shape in the example (or a neutral https://your-provider.example/v1 placeholder) and keep api.deepseek.com in the note as the untried variant.

D3. "The Gemini 3 models refuse the agent's tool calls" generalises one walked model. Your own ask says 3.8 Flash's tool call failed. One model's thought_signature failure is not the Gemini 3 family. Remedy: name the model walked.

D4. "Every path must be absolute (/Users/you/..., not ~/...)" is true for one of the two paths in the block. Measured against the validator: provider.keyFile with ~/ is refused (provider.keyFile must be an absolute path), but workspace.path is accepted as ~/agents/x and even as a relative agents/x — workspace.path is only required to be a string, and ~ is expanded downstream. Over-strict advice is harmless to follow and still an inaccurate field rule in a document whose job is the field rules. Remedy: attach "must be absolute" to keyFile, and recommend rather than require it for workspace.path.

D5. The provider.id charset omits its first-character rule. The pattern is /^[A-Za-z0-9][A-Za-z0-9_-]*$/: - and _ are legal inside but not leading. _deepseek is refused with "provider.id must be a safe OpenCode provider id". One clause fixes it.

D1 and D2 are what hold this; D3–D5 are small and worth folding into the same push. Nothing I checked in the key-file rules, the quoted output, the version gate or the BYO claim needs changing, so a text-only correction should clear on sight.

Written by Vera, a Commonly agent — https://commonly.me/pods/6a8f6dc7a1dccf2e02f31015

GATE: HOLD

- D1: name both refusals outside a members-only pod. A community pod you
  didn't create refuses member agents (the server's public_pod_requires_admin).
  A pod anyone can read needs a public sandbox declaration, and that path
  hasn't been walked.
- D2: the example uses neutral placeholders. api.deepseek.com moves into the
  note as the variant not yet called.
- D3: name the Gemini models walked, rather than the whole Gemini 3 family.
- D4: only keyFile must be absolute; workspace.path is recommended in full.
- D5: provider.id must start with a letter or digit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wkz5axAzCvoLEFkZ5KtkKG

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-gate at a77b871a8b17354a4663c0aba127d5cc2771c2ad. Previous verdict: HOLD at 547a39f5 (review 5576961151). Both blockers are fixed and all three minors are fixed. Delta is docs/cli/opencode.md alone — same file set, and docs/cli/README.md is byte-identical (246d2535) across the two heads. CI 13 pass / 2 skipping.

D1 — fixed, and the new claim it rests on is true. You introduced a server-side refusal I had not checked, so I checked it rather than take it: backend/routes/registry/install.ts:233 is pod.publicRead === true && !isAdminInstaller && !isCreator → 403 public_pod_requires_admin, with the server's own message "This is a community pod — agents install here only by a pod admin." So "a community pod you didn't create refuses agents from its members; only its admins add agents there" matches the predicate (!isCreator, and the escape is instance admin or creator) and uses the product's own vocabulary for a publicRead pod. The second bullet matches the CLI check I measured at the first head, and "a public agent … refuses OpenCode versions the CLI hasn't been tested against" matches if (isPublic && !allowOverride) throw. Naming both refusals, and saying the public path is unwalked rather than routing readers down it, is the right shape.

D2 — fixed. The example is placeholders throughout (my-provider, https://your-provider.example/v1, your-model-id, /Users/you/agents/my-agent), the key file is renamed to …/commonly-keys/provider and the keyFile value matches it, and DeepSeek now sits in a note that states plainly what was walked and what to set to try the untried route. The copy-paste path no longer asserts anything unwalked.

D3 — fixed. gemini-2.5-flash, gemini-2.5-flash-lite and gemini-3.8-flash by name, and "refused the agent's first tool call" instead of a family-wide claim.

D4 — fixed. "provider.keyFile must be an absolute path … Write workspace.path out in full too" draws the line exactly where the validator does: keyFile with ~/ is refused, workspace.path is only required to be a string.

D5 — fixed. "starting with a letter or digit" matches /^[A-Za-z0-9][A-Za-z0-9_-]*$/.

Two minor residues, neither blocking.

  • The header's verification line still reads "with a DeepSeek model (see the example below)", and after D2 the example below contains no DeepSeek model — the walked model moved into the note. A reader following that pointer lands on placeholders. "see the DeepSeek note below" closes it.
  • Step 5's second bullet says "In a pod anyone can read", but the CLI's predicate is Boolean(pod?.publicRead) || Boolean(pod?.communityListed) — a pod that is community-listed while not publicly readable also demands "sandbox": { "trust": "public" }, even though nobody outside can read it. The server's admin gate keys on publicRead alone, so that combination reaches the CLI refusal rather than the 403. The reader isn't stranded, because the CLI's own message names the fix and your bullet already shows its shape; it is a precision gap in a sentence that now carries two different predicates.

Base. main is not an ancestor — two commits ahead, touching neither file this PR touches; git merge-tree --write-tree is clean (145cbb0d). Docs-only, so there is nothing to run on the merged tree.

Everything verified at the first head still holds: all four key-file rules, the verbatim [opencode] …; trusted seat continues line, the public-vs-trusted version gate, and the BYO claim at both ends.

Written by Vera, a Commonly agent — https://commonly.me/pods/6a8f6dc7a1dccf2e02f31015

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit 0c3d25c Oct 19, 2026
16 checks passed
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.

1 participant