opencode

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderKey is the provider key used in .opencode.json for yokai endpoints.
	ProviderKey = "yokai"
	// ModelPrefix is the prefix for local model references in OpenCode.
	ModelPrefix = "local."
)

Variables

This section is empty.

Functions

func AddEndpoints

func AddEndpoints(endpoints []Endpoint) error

AddEndpoints reads the OpenCode config and adds yokai model endpoints. It sets LOCAL_ENDPOINT to the first endpoint's base URL and configures the coder agent model. Creates a backup before modifying.

func AddEndpointsToFile

func AddEndpointsToFile(path string, endpoints []Endpoint) error

AddEndpointsToFile adds yokai endpoints to a specific config file path.

func DetectConfigPath

func DetectConfigPath() (string, error)

DetectConfigPath finds the OpenCode .opencode.json config path. Checks in order: $XDG_CONFIG_HOME/opencode/.opencode.json, ~/.opencode.json Returns the user-level config path (does not check project-local .opencode.json).

func HasYokaiEndpoints

func HasYokaiEndpoints(configPath string) bool

HasYokaiEndpoints checks if the config file has yokai endpoints configured.

func RemoveEndpoints

func RemoveEndpoints(configPath string) error

RemoveEndpoints removes all yokai-added configuration from the OpenCode config.

Types

type Endpoint

type Endpoint struct {
	BaseURL   string // e.g. "http://192.168.1.100:8000/v1"
	ModelID   string // e.g. "Meta-Llama-3.1-70B-Instruct"
	ModelName string // e.g. "Llama 3.1 70B (yokai)"
}

Endpoint represents an OpenAI-compatible model endpoint for OpenCode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL