Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): read OpenCode Go limits key from OpenCode 2's credential database #16605

ClosedJustMarkDev(GitHub profile, opens in a new tab)wants to merge 14 commits intomain fromrefs/pull/16605/headopened View on GitHub

Showing 3 changed files with 106 additions and 15 deletions.

x
0 of 3 viewed, 3 left
3 additions and 3 deletionsdocs/user/usage.mdModified
View file
@@ -113,9 +113,9 @@
​
OpenCode Go reports its session, weekly, and monthly allowance when OpenCode runs locally in
the environment. T3 cannot report limits for external OpenCode servers because their credentials
-belong to the remote server. Limits need an OpenCode Go API key. A Console sign-in alone
-does not report them. Add your Go API key as `OPENCODE_API_KEY` in the OpenCode instance's
-**Environment variables**, then refresh provider status. Cursor reports
+belong to the remote server. Limits need an OpenCode Go API key. Use the one saved in OpenCode, or
+add it as `OPENCODE_API_KEY` in the OpenCode instance's **Environment variables** and refresh
+provider status. A Console sign-in alone does not report them. Cursor reports
its monthly allowance, including separate Auto and API usage, using the CLI login or
`CURSOR_AUTH_TOKEN`. On macOS, this includes the default Keychain login after you enable Cursor
usage. Keychain login is used for limits only with Cursor's default API endpoint. If you configure
55 additions and 0 deletionspackages/provider-opencode/src/server/status.test.tsModified
View file
@@ -1,4 +1,5 @@
import * as NodeAssert from "node:assert/strict";
+import * as NodeSqlite from "node:sqlite";
​
import * as NodeServices from "@effect/platform-node/NodeServices";
import { it } from "@effect/vitest";
@@ -98,6 +99,60 @@
}),
​
+it.effect("reads a Go API key from OpenCode 2's credential database", () =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;