File size: 5,264 Bytes
15a5288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// Core provider data structure based on provider-api-spec.md
export interface ProviderEntry {
  provider: string;
  status?: "live" | "offline" | "deprecated";
  context_length?: number;
  pricing?: {
    input: number;   // $ per 1M tokens
    output: number;  // $ per 1M tokens
  };
  quantization?: string;
  max_completion_tokens?: number;
  supported_parameters?: string[];
  
  // Model identification
  model_id?: string;
  created?: number;
  
  // Capability flags
  supports_tools?: boolean;
  supports_function_calling?: boolean;
  supports_structured_output?: boolean;
  supports_response_format?: boolean;
  supports_streaming?: boolean;
  supports_logprobs?: boolean;
  supports_stop_sequences?: boolean;
  supports_seed?: boolean;
  supports_temperature?: boolean;
  supports_top_p?: boolean;
  supports_frequency_penalty?: boolean;
  supports_presence_penalty?: boolean;
  supports_repetition_penalty?: boolean;
  supports_top_k?: boolean;
  supports_min_p?: boolean;
  supports_max_tokens?: boolean;
  supports_logit_bias?: boolean;
  supports_top_logprobs?: boolean;
  supports_image_input?: boolean;
  
  // Performance metrics
  latency_s?: number;
  throughput_tps?: number;
  performance_error?: string;
  performance_tested_at?: string;
  
  // Additional metadata
  owned_by?: string;
  model_type?: string;
  description?: string;
  deprecated_at?: string;
  model_class?: string;
  is_gated?: boolean;
}

// Provider-specific response types
export interface GroqModel {
  id: string;
  object: string;
  created: number;
  owned_by: string;
  active: boolean;
  context_window: number;
  public_apps: any;
  max_completion_tokens: number;
}

export interface CohereModel {
  name: string;
  endpoints: string[];
  finetuned: boolean;
  context_length: number;
  tokenizer_url: string;
  supports_vision: boolean;
  features: string[];
  default_endpoints: string[];
  is_deprecated?: boolean;
}

export interface FireworksModel {
  id: string;
  object: string;
  owned_by: string;
  created: number;
  kind: string;
  supports_chat: boolean;
  supports_image_input: boolean;
  supports_tools: boolean;
  context_length: number;
}

export interface FireworksDetailedModel {
  name: string;
  displayName: string;
  description: string;
  contextLength: number;
  baseModelDetails: {
    checkpointFormat: string;
    defaultPrecision: string;
    modelType: string;
    moe: boolean;
    parameterCount: string;
    supportsFireattention: boolean;
    tunable: boolean;
    worldSize: number;
  };
  defaultSamplingParams: {
    temperature?: number;
    top_p?: number;
    max_tokens?: number;
    [key: string]: any;
  };
  supportsImageInput: boolean;
  supportsLora: boolean;
  supportsTools: boolean;
  state: string;
  deprecationDate: string | null;
  huggingFaceUrl: string;
  supportedPrecisions: string[];
  deployedModelRefs: any[];
}

export interface TogetherModel {
  id: string;
  object: string;
  created: number;
  type: string;
  display_name: string;
  organization: string;
  context_length: number;
  pricing: {
    input: number;    // $ per million tokens
    output: number;   // $ per million tokens
    hourly: number;
    base: number;
    finetune: number;
  };
  config: {
    chat_template: string;
    stop: string[];
    bos_token: string;
    eos_token: string;
  };
}

export interface SambaNovaModel {
  id: string;
  object: string;
  owned_by: string;
  context_length: number;
  max_completion_tokens: number;
  pricing: {
    prompt: string;      // $ per token
    completion: string;  // $ per token
  };
  sn_metadata: any;
}

export interface NovitaModel {
  id: string;
  object: string;
  created: number;
  owned_by: string;
  input_token_price_per_m: number;     // Cents per million tokens
  output_token_price_per_m: number;    // Cents per million tokens
  title: string;
  description: string;
  context_size: number;
  max_output_tokens: number;
  model_type: string;
  features: string[];
  endpoints: string[];
  status: number;
  display_name: string;
}

export interface FeatherlessModel {
  id: string;
  is_gated: boolean;
  created: number;
  model_class: string;
  owned_by: string;
  context_length: number;
  max_completion_tokens: number;
  available_on_current_plan: boolean;
}

// Minimal response types
export interface CerebrasModel {
  id: string;
  object: string;
  created: number;
  owned_by: string;
}

export interface NebiusModel {
  id: string;
  created: number;
  object: string;
  owned_by: string;
}

export interface LambdaModel {
  id: string;
  object: string;
  created: number;
  owned_by: string;
}

// Base provider fetcher interface
export interface ProviderFetcher {
  name: string;
  fetchModels(): Promise<ProviderEntry[]>;
}

// Configuration for rate limiting
export interface RateLimitConfig {
  requestsPerMinute?: number;
  requestsPerHour?: number;
  retryAttempts?: number;
  initialBackoffMs?: number;
}

// Feature mapping types
export interface FeatureMapping {
  [key: string]: keyof ProviderEntry | string[] | null;
}

// Static pricing data structure
export interface StaticPricing {
  [provider: string]: {
    [modelId: string]: {
      input: number;   // $ per 1M tokens
      output: number;  // $ per 1M tokens
    };
  };
}