opencode

package
v0.5.17 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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