Versions in this module Expand all Collapse all v0 v0.1.0 Apr 28, 2026 Changes in this version + const MaxTimeoutSeconds + const PlatformFeePercent + const SolanaNetwork + const USDCMint + const X402Version + func CacheKey(model string, messages []ChatMessage) uint64 + func DeriveSessionID(messages []ChatMessage) string + type AmountExceedsMaxError struct + Amount uint64 + MaxAmount uint64 + func (e *AmountExceedsMaxError) Error() string + type BalanceMonitor struct + func NewBalanceMonitor(fetchBalance func() (float64, error), pollInterval time.Duration, ...) *BalanceMonitor + func (m *BalanceMonitor) LastKnownBalance() *float64 + func (m *BalanceMonitor) Start() + func (m *BalanceMonitor) Stop() + type ChatChoice struct + FinishReason *string + Index int + Message ChatMessage + type ChatChunk struct + Choices []ChatChunkChoice + Created int64 + ID string + Model string + Object string + type ChatChunkChoice struct + Delta ChatDelta + FinishReason *string + Index int + type ChatChunkOrError struct + Chunk *ChatChunk + Err error + type ChatDelta struct + Content *string + Role *Role + ToolCalls []ToolCallDelta + type ChatMessage struct + Content string + Name *string + Role Role + ToolCallID *string + ToolCalls []ToolCall + type ChatRequest struct + MaxTokens *int + Messages []ChatMessage + Model string + Stream bool + Temperature *float64 + ToolChoice interface{} + Tools []ToolDefinition + TopP *float64 + type ChatResponse struct + Choices []ChatChoice + Created int64 + ID string + Model string + Object string + Usage *Usage + type ClientConfig struct + EnableCache bool + EnableQualityCheck bool + EnableSessions bool + ExpectedRecipient string + FreeFallbackModel string + GatewayURL string + MaxPaymentAmount *uint64 + MaxQualityRetries int + PreferEscrow bool + RPCURL string + SessionTTL time.Duration + Timeout time.Duration + func DefaultConfig() ClientConfig + type ClientError struct + Message string + func (e *ClientError) Error() string + type CostBreakdown struct + Currency string + FeePercent int + PlatformFee string + ProviderCost string + Total string + type DegradedReason string + const DegradedEmptyContent + const DegradedKnownErrorPhrase + const DegradedRepetitiveLoop + const DegradedTruncatedMidWord + func CheckDegraded(content string) DegradedReason + type EscrowPayload struct + AgentPubkey string + DepositTx string + ServiceID string + type FunctionCall struct + Arguments string + Name string + type FunctionCallDelta struct + Arguments *string + Name *string + type FunctionDefinitionInner struct + Description *string + Name string + Parameters interface{} + type GatewayError struct + Message string + Status int + func (e *GatewayError) Error() string + type InsufficientBalanceError struct + Have uint64 + Need uint64 + func (e *InsufficientBalanceError) Error() string + type KeypairSigner struct + func NewKeypairSigner(wallet *Wallet, rpcURL string) *KeypairSigner + func (s *KeypairSigner) SignPayment(_ context.Context, _ uint64, _ string, _ Resource, _ PaymentAccept) (*PaymentPayload, error) + type ModelInfo struct + ContextWindow int + DisplayName string + ID string + InputCostPerMillion float64 + MaxOutputTokens *int + ModelID string + OutputCostPerMillion float64 + Provider string + Reasoning bool + SupportsBatch bool + SupportsStreaming bool + SupportsStructuredOutput bool + SupportsTools bool + SupportsVision bool + type Option func(*ClientConfig) + func WithCache(enable bool) Option + func WithExpectedRecipient(r string) Option + func WithFreeFallbackModel(model string) Option + func WithGatewayURL(url string) Option + func WithMaxPaymentAmount(max uint64) Option + func WithMaxQualityRetries(n int) Option + func WithQualityCheck(enable bool) Option + func WithRPCURL(url string) Option + func WithSessionTTL(d time.Duration) Option + func WithSessions(enable bool) Option + func WithTimeout(d time.Duration) Option + type PaymentAccept struct + Amount string + Asset string + EscrowProgramID *string + MaxTimeoutSeconds int + Network string + PayTo string + Scheme string + type PaymentPayload struct + Accepted PaymentAccept + Payload interface{} + Resource Resource + X402Version int + type PaymentRejectedError struct + Reason string + func (e *PaymentRejectedError) Error() string + type PaymentRequired struct + Accepts []PaymentAccept + CostBreakdown CostBreakdown + Error string + Resource Resource + X402Version int + type PaymentRequiredError struct + PaymentRequired PaymentRequired + func (e *PaymentRequiredError) Error() string + type RecipientMismatchError struct + Actual string + Expected string + func (e *RecipientMismatchError) Error() string + type Resource struct + Method string + URL string + type ResponseCache struct + func NewResponseCache() *ResponseCache + func NewResponseCacheWithConfig(maxEntries int, ttl, dedupWindow time.Duration) *ResponseCache + func (c *ResponseCache) Get(key uint64) (ChatResponse, bool) + func (c *ResponseCache) Put(key uint64, response ChatResponse) + type Role string + const RoleAssistant + const RoleDeveloper + const RoleSystem + const RoleTool + const RoleUser + type SendChatResult struct + PaymentRequired *PaymentRequired + Response *ChatResponse + type SessionInfo struct + Escalated bool + Model string + type SessionStore struct + func NewSessionStore(ttl time.Duration) *SessionStore + func (s *SessionStore) CleanupExpired() + func (s *SessionStore) GetOrCreate(sessionID, defaultModel string) SessionInfo + func (s *SessionStore) RecordRequest(sessionID string, requestHash uint64) + type Signer interface + SignPayment func(ctx context.Context, amountAtomic uint64, recipient string, resource Resource, ...) (*PaymentPayload, error) + type SignerError struct + Message string + func (e *SignerError) Error() string + type SolanaPayload struct + Transaction string + type SolvelaClient struct + func NewClient(wallet *Wallet, signer Signer, opts ...Option) *SolvelaClient + func (c *SolvelaClient) Chat(ctx context.Context, request *ChatRequest) (*ChatResponse, error) + func (c *SolvelaClient) ChatStream(ctx context.Context, request *ChatRequest) (<-chan ChatChunkOrError, error) + func (c *SolvelaClient) LastKnownBalance() *float64 + func (c *SolvelaClient) Models(ctx context.Context) ([]ModelInfo, error) + func (c *SolvelaClient) String() string + type TimeoutError struct + TimeoutSecs float64 + func (e *TimeoutError) Error() string + type ToolCall struct + Function FunctionCall + ID string + Type string + type ToolCallDelta struct + Function *FunctionCallDelta + ID *string + Index int + Type *string + type ToolDefinition struct + Function FunctionDefinitionInner + Type string + type Transport struct + func NewTransport(baseURL string, timeout time.Duration) *Transport + func (t *Transport) FetchModels(ctx context.Context) ([]ModelInfo, error) + func (t *Transport) SendChat(ctx context.Context, request *ChatRequest, paymentSignature string, ...) (*SendChatResult, error) + func (t *Transport) SendChatStream(ctx context.Context, request *ChatRequest, paymentSignature string, ...) (<-chan ChatChunkOrError, error) + type Usage struct + CompletionTokens int + PromptTokens int + TotalTokens int + type Wallet struct + func CreateWallet() (*Wallet, string, error) + func WalletFromEnv(varName string) (*Wallet, error) + func WalletFromKeypairB58(b58 string) (*Wallet, error) + func WalletFromKeypairBytes(raw []byte) (*Wallet, error) + func (w *Wallet) Address() string + func (w *Wallet) PrivateKey() ed25519.PrivateKey + func (w *Wallet) PublicKey() ed25519.PublicKey + func (w *Wallet) String() string + func (w *Wallet) ToKeypairB58() string + func (w *Wallet) ToKeypairBytes() []byte + type WalletError struct + Message string + func (e *WalletError) Error() string