opencode

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package opencode provides a client for interacting with the OpenCode server API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	SystemRole  string `json:"systemRole,omitempty"`
}

Agent represents an agent available in OpenCode.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides methods to interact with the OpenCode server.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new OpenCode client.

func (*Client) GetModels

func (c *Client) GetModels(ctx context.Context) ([]string, error)

GetModels returns a list of model IDs formatted for the /v1/models endpoint. It combines agents and providers into opencode:* model identifiers.

func (*Client) IsHealthy

func (c *Client) IsHealthy(ctx context.Context) (bool, error)

IsHealthy checks if the OpenCode server is running and healthy.

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context) ([]Agent, error)

ListAgents fetches all available agents from OpenCode.

func (*Client) ListProviders

func (c *Client) ListProviders(ctx context.Context) ([]Provider, error)

ListProviders fetches all available providers from OpenCode.

type HealthStatus

type HealthStatus struct {
	Status  string `json:"status"`
	Version string `json:"version,omitempty"`
}

HealthStatus represents the health check response.

type Provider

type Provider struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

Provider represents an AI provider available in OpenCode.

Jump to

Keyboard shortcuts

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