76ba500417
CI / docker (push) Successful in 2m4s
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress, ingress key governance, monitoring, and security controls. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
774 B
Go
34 lines
774 B
Go
package provider
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
)
|
|
|
|
type ModelInfo struct {
|
|
ID string `json:"id"`
|
|
DisplayName string `json:"display_name,omitempty"`
|
|
}
|
|
|
|
type ChatRequest struct {
|
|
Model string `json:"model"`
|
|
Messages json.RawMessage `json:"messages"`
|
|
Stream bool `json:"stream"`
|
|
Raw json.RawMessage `json:"-"`
|
|
}
|
|
|
|
type ChatResponse struct {
|
|
StatusCode int
|
|
Body []byte
|
|
Headers map[string]string
|
|
TokensIn int
|
|
TokensOut int
|
|
}
|
|
|
|
type Client interface {
|
|
Type() string
|
|
ListModels(ctx context.Context, apiKey, baseURL string) ([]ModelInfo, error)
|
|
ChatCompletion(ctx context.Context, apiKey, baseURL string, req *ChatRequest) (*ChatResponse, error)
|
|
HealthCheck(ctx context.Context, apiKey, baseURL string) error
|
|
}
|