moonshot

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package moonshot implements the LLMProvider interface using the Moonshot AI platform. Moonshot's API is OpenAI-compatible, so we reuse the openai-go SDK with a custom base URL.

Index

Constants

This section is empty.

Variables

View Source
var APIKeyMeta = provider.ProviderMeta{
	Provider:    provider.ProviderMoonshot,
	AuthMethod:  provider.AuthAPIKey,
	EnvVars:     []string{"MOONSHOT_API_KEY"},
	DisplayName: "Direct API",
}

APIKeyMeta is the metadata for Moonshot via API Key

Functions

func NewAPIKeyClient

func NewAPIKeyClient(ctx context.Context) (provider.LLMProvider, error)

NewAPIKeyClient creates a new Moonshot client using API Key authentication. The Moonshot API is OpenAI-compatible, so we use the OpenAI SDK with a custom base URL.

Types

type Client

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

Client implements the LLMProvider interface for Moonshot AI using the OpenAI SDK.

func NewClient

func NewClient(client openai.Client, name string) *Client

NewClient creates a new Moonshot client with the given OpenAI SDK client.

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) ([]provider.ModelInfo, error)

ListModels returns the available models for Moonshot AI using the API.

func (*Client) Name

func (c *Client) Name() string

Name returns the provider name.

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, opts provider.CompletionOptions) <-chan provider.StreamChunk

Stream sends a completion request and returns a channel of streaming chunks.

Jump to

Keyboard shortcuts

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