Documentation
¶
Overview ¶
Package opencodego reads OpenCode Go subscription usage over HTTP.
Index ¶
Constants ¶
View Source
const ( // DefaultBaseURL is the Go inference root. Usage is GET {base}/v1/usage. DefaultBaseURL = "https://opencode.ai/inference/go" // PathUsage is the usage meter path on DefaultBaseURL. PathUsage = "/v1/usage" // DefaultTokenFile is the plaintext API key llm-proxy also reads. DefaultTokenFile = "~/tmp/llm-token-opencode-go.txt" // UserAgent identifies this client; OpenCode rejects generic SDK names. UserAgent = "agent-pro-opencode-go/1.0" )
Variables ¶
This section is empty.
Functions ¶
func ResolveTokenFile ¶
ResolveTokenFile expands ~ and empty to DefaultTokenFile.
Types ¶
type FetchOpts ¶
type FetchOpts struct {
// TokenFile is a plaintext file holding the Go API key. Empty uses
// DefaultTokenFile. A nonempty Token skips the file.
TokenFile string
// Token is the Go API key. When set, TokenFile is not read.
Token string
// BaseURL overrides DefaultBaseURL (tests). Trailing slashes are stripped.
BaseURL string
// HTTP is the client; nil uses a 30s timeout client.
HTTP *http.Client
}
FetchOpts configures one usage GET.
type Meter ¶
type Meter struct {
Status string `json:"status"`
Percent int `json:"percent"`
ResetsAt string `json:"resetsAt"`
}
Meter is one Go limit window.
Click to show internal directories.
Click to hide internal directories.