models.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package models
  2. import "maps"
  3. type (
  4. ModelID string
  5. ModelProvider string
  6. )
  7. type Model struct {
  8. ID ModelID `json:"id"`
  9. Name string `json:"name"`
  10. Provider ModelProvider `json:"provider"`
  11. APIModel string `json:"api_model"`
  12. CostPer1MIn float64 `json:"cost_per_1m_in"`
  13. CostPer1MOut float64 `json:"cost_per_1m_out"`
  14. CostPer1MInCached float64 `json:"cost_per_1m_in_cached"`
  15. CostPer1MOutCached float64 `json:"cost_per_1m_out_cached"`
  16. ContextWindow int64 `json:"context_window"`
  17. DefaultMaxTokens int64 `json:"default_max_tokens"`
  18. CanReason bool `json:"can_reason"`
  19. SupportsAttachments bool `json:"supports_attachments"`
  20. }
  21. const (
  22. // ForTests
  23. ProviderMock ModelProvider = "__mock"
  24. )
  25. // Providers in order of popularity
  26. var ProviderPopularity = map[ModelProvider]int{
  27. ProviderAnthropic: 1,
  28. ProviderOpenAI: 2,
  29. ProviderGemini: 3,
  30. ProviderGROQ: 4,
  31. ProviderOpenRouter: 5,
  32. ProviderBedrock: 6,
  33. ProviderAzure: 7,
  34. ProviderVertexAI: 8,
  35. }
  36. var SupportedModels = map[ModelID]Model{}
  37. func init() {
  38. maps.Copy(SupportedModels, AnthropicModels)
  39. maps.Copy(SupportedModels, BedrockModels)
  40. maps.Copy(SupportedModels, OpenAIModels)
  41. maps.Copy(SupportedModels, GeminiModels)
  42. maps.Copy(SupportedModels, GroqModels)
  43. maps.Copy(SupportedModels, AzureModels)
  44. maps.Copy(SupportedModels, OpenRouterModels)
  45. maps.Copy(SupportedModels, XAIModels)
  46. maps.Copy(SupportedModels, VertexAIGeminiModels)
  47. }