Documentation
¶
Index ¶
- Constants
- Variables
- func APIKeyAAD(provider string) []byte
- func DecryptAPIKey(ctx context.Context, encryptor crypto.Encryptor, provider string, ...) (string, error)
- func DecryptManagementKey(ctx context.Context, encryptor crypto.Encryptor, provider string, ...) (string, error)
- func EncryptAPIKey(ctx context.Context, encryptor crypto.Encryptor, provider, apiKey string) ([]byte, error)
- func EncryptManagementKey(ctx context.Context, encryptor crypto.Encryptor, ...) ([]byte, error)
- func ManagementKeyAAD(provider string) []byte
- func SeedDevHostedOpenRouter(ctx context.Context, tx *gorm.DB, encryptor crypto.Encryptor, ...) error
- func SeedDevHostedOpenRouterFromEnv(ctx context.Context, tx *gorm.DB, encryptor crypto.Encryptor) error
- func ValidateBaseURL(raw string) error
- type CatalogPrice
- type Client
- type CompleteRequest
- type CompleteResponse
- type Credentials
- type Model
- type StreamEvent
- type Usage
Constants ¶
const ( ProviderAnthropic = "anthropic" ProviderOpenAI = "openai" ProviderOpenRouter = "openrouter" )
Variables ¶
var ErrNoCatalogPrices = errors.New("provider does not publish catalog prices")
ErrNoCatalogPrices means the provider list-models API has no rate fields.
Functions ¶
func DecryptAPIKey ¶
func DecryptManagementKey ¶
func EncryptAPIKey ¶
func EncryptManagementKey ¶
func ManagementKeyAAD ¶
func SeedDevHostedOpenRouter ¶
func SeedDevHostedOpenRouter(ctx context.Context, tx *gorm.DB, encryptor crypto.Encryptor, cfg config.DevHostedOpenRouterConfig) error
SeedDevHostedOpenRouter replaces the OpenRouter hosted-provider row and optionally sets the installation default model.
func SeedDevHostedOpenRouterFromEnv ¶
func SeedDevHostedOpenRouterFromEnv(ctx context.Context, tx *gorm.DB, encryptor crypto.Encryptor) error
SeedDevHostedOpenRouterFromEnv writes the SuperPlane-hosted OpenRouter provider when the local development seed is complete. It is a no-op when the seed is unset. A half-filled flag returns an error.
func ValidateBaseURL ¶
Types ¶
type CatalogPrice ¶
CatalogPrice is one model id with cents-per-million rates from a provider catalog.
func ListCatalogPrices ¶
func ListCatalogPrices(ctx context.Context, httpClient core.HTTPContext, provider string, creds Credentials) ([]CatalogPrice, error)
ListCatalogPrices fetches priced models for providers that publish catalog rates.
type Client ¶
type Client interface {
Provider() string
ListModels(ctx context.Context) ([]Model, error)
Complete(ctx context.Context, req CompleteRequest) (*CompleteResponse, error)
Stream(ctx context.Context, req CompleteRequest, emit func(StreamEvent) error) error
}
Client is the shared provider surface for list, complete, and stream.
func New ¶
func New(httpClient core.HTTPContext, provider string, creds Credentials) (Client, error)
New builds a client for one of the in-scope billing providers.
type CompleteRequest ¶
CompleteRequest is a text completion. Prompt text is not stored on the ledger.
type CompleteResponse ¶
CompleteResponse is the model text plus normalized usage.
type Credentials ¶
Credentials are provider API credentials. Hosted catalog and later BYOK both supply this shape so the HTTP client stays funding-source agnostic.
type StreamEvent ¶
StreamEvent is one streamed text delta or the terminal usage snapshot.