| 1134 | } |
| 1135 | |
| 1136 | func formatHomeClaudeModel(entry homeModelEntry) map[string]any { |
| 1137 | displayName := entry.displayName |
| 1138 | if displayName == "" { |
| 1139 | displayName = entry.id |
| 1140 | } |
| 1141 | maxInput := entry.contextLength |
| 1142 | if maxInput <= 0 { |
| 1143 | maxInput = registry.DefaultClaudeMaxInputTokens |
| 1144 | } |
| 1145 | maxOutput := entry.maxCompletionTokens |
| 1146 | if maxOutput <= 0 { |
| 1147 | maxOutput = registry.DefaultClaudeMaxOutputTokens |
| 1148 | } |
| 1149 | model := map[string]any{ |
| 1150 | "id": entry.id, |
| 1151 | "object": "model", |
| 1152 | "owned_by": entry.ownedBy, |
| 1153 | "type": "model", |
| 1154 | "display_name": displayName, |
| 1155 | "max_input_tokens": maxInput, |
| 1156 | "max_tokens": maxOutput, |
| 1157 | } |
| 1158 | if entry.created > 0 { |
| 1159 | model["created_at"] = time.Unix(entry.created, 0).UTC().Format(time.RFC3339) |
| 1160 | } |
| 1161 | return model |
| 1162 | } |
| 1163 | |
| 1164 | func (s *Server) handleHomeGeminiModels(c *gin.Context) { |
| 1165 | entries, ok := s.loadHomeModelEntries(c) |