opencode

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package opencode routes OpenCode Zen and OpenCode Go models to the Sigma adapter matching each model's OpenCode API family.

Index

Constants

View Source
const (
	// ZenBaseURL is the OpenCode Zen API base URL.
	ZenBaseURL = "https://opencode.ai/zen/v1"
	// GoBaseURL is the OpenCode Go API base URL.
	GoBaseURL = "https://opencode.ai/zen/go/v1"
)

Variables

This section is empty.

Functions

func OpenCodeAPI

func OpenCodeAPI(model sigma.Model) sigma.API

OpenCodeAPI returns the real API family for model.

func Register

func Register(registry *sigma.Registry, providerID sigma.ProviderID, opts ...ProviderOption) error

Register registers an OpenCode provider with a caller-selected provider ID.

func RegisterDefault

func RegisterDefault(registry *sigma.Registry, opts ...ProviderOption) error

RegisterDefault registers both OpenCode Zen and OpenCode Go providers.

func RegisterGo

func RegisterGo(registry *sigma.Registry, opts ...ProviderOption) error

RegisterGo registers the OpenCode Go provider.

func RegisterGoDefault

func RegisterGoDefault(opts ...ProviderOption) error

RegisterGoDefault registers OpenCode Go on sigma's default registry.

func RegisterZen

func RegisterZen(registry *sigma.Registry, opts ...ProviderOption) error

RegisterZen registers the OpenCode Zen provider.

func RegisterZenDefault

func RegisterZenDefault(opts ...ProviderOption) error

RegisterZenDefault registers OpenCode Zen on sigma's default registry.

Types

type Provider

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

Provider dispatches OpenCode models to their real API-compatible route.

func NewProvider

func NewProvider(opts ...ProviderOption) *Provider

NewProvider constructs an OpenCode provider.

func (*Provider) API

func (p *Provider) API() sigma.API

API reports the registry-facing API surface. The real wire API is selected per model at request time.

func (*Provider) Stream

func (p *Provider) Stream(ctx context.Context, model sigma.Model, req sigma.Request, opts sigma.Options) *sigma.Stream

Stream dispatches the request to the adapter matching the model metadata.

type ProviderOption

type ProviderOption func(*providerConfig)

ProviderOption configures an OpenCode provider.

func WithBaseURL

func WithBaseURL(baseURL string) ProviderOption

WithBaseURL configures the OpenCode route base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ProviderOption

WithHTTPClient configures the HTTP client for wrapped providers.

func WithHeader

func WithHeader(key, value string) ProviderOption

WithHeader configures a provider default request header.

func WithHeaders

func WithHeaders(headers map[string]string) ProviderOption

WithHeaders configures provider default request headers.

Jump to

Keyboard shortcuts

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