@abliteration/sdk 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.openapi-generator/FILES +16 -0
  2. package/README.md +12 -0
  3. package/dist/apis/ModelsApi.d.ts +230 -0
  4. package/dist/apis/ModelsApi.js +231 -1
  5. package/dist/esm/apis/ModelsApi.d.ts +230 -0
  6. package/dist/esm/apis/ModelsApi.js +230 -0
  7. package/dist/esm/models/DownloadAnomaly.d.ts +66 -0
  8. package/dist/esm/models/DownloadAnomaly.js +62 -0
  9. package/dist/esm/models/DownloadPoint.d.ts +34 -0
  10. package/dist/esm/models/DownloadPoint.js +43 -0
  11. package/dist/esm/models/GetModelDownloadHistory200Response.d.ts +67 -0
  12. package/dist/esm/models/GetModelDownloadHistory200Response.js +79 -0
  13. package/dist/esm/models/GetModelReadmeAt200Response.d.ts +67 -0
  14. package/dist/esm/models/GetModelReadmeAt200Response.js +79 -0
  15. package/dist/esm/models/ListAnomalies200Response.d.ts +67 -0
  16. package/dist/esm/models/ListAnomalies200Response.js +79 -0
  17. package/dist/esm/models/ListModelReadmeDrifts200Response.d.ts +67 -0
  18. package/dist/esm/models/ListModelReadmeDrifts200Response.js +79 -0
  19. package/dist/esm/models/ReadmeAt.d.ts +38 -0
  20. package/dist/esm/models/ReadmeAt.js +45 -0
  21. package/dist/esm/models/ReadmeDrift.d.ts +46 -0
  22. package/dist/esm/models/ReadmeDrift.js +49 -0
  23. package/dist/esm/models/index.d.ts +8 -0
  24. package/dist/esm/models/index.js +8 -0
  25. package/dist/models/DownloadAnomaly.d.ts +66 -0
  26. package/dist/models/DownloadAnomaly.js +70 -0
  27. package/dist/models/DownloadPoint.d.ts +34 -0
  28. package/dist/models/DownloadPoint.js +50 -0
  29. package/dist/models/GetModelDownloadHistory200Response.d.ts +67 -0
  30. package/dist/models/GetModelDownloadHistory200Response.js +87 -0
  31. package/dist/models/GetModelReadmeAt200Response.d.ts +67 -0
  32. package/dist/models/GetModelReadmeAt200Response.js +87 -0
  33. package/dist/models/ListAnomalies200Response.d.ts +67 -0
  34. package/dist/models/ListAnomalies200Response.js +87 -0
  35. package/dist/models/ListModelReadmeDrifts200Response.d.ts +67 -0
  36. package/dist/models/ListModelReadmeDrifts200Response.js +87 -0
  37. package/dist/models/ReadmeAt.d.ts +38 -0
  38. package/dist/models/ReadmeAt.js +52 -0
  39. package/dist/models/ReadmeDrift.d.ts +46 -0
  40. package/dist/models/ReadmeDrift.js +56 -0
  41. package/dist/models/index.d.ts +8 -0
  42. package/dist/models/index.js +8 -0
  43. package/docs/DownloadAnomaly.md +49 -0
  44. package/docs/DownloadPoint.md +37 -0
  45. package/docs/GetModelDownloadHistory200Response.md +48 -0
  46. package/docs/GetModelReadmeAt200Response.md +48 -0
  47. package/docs/ListAnomalies200Response.md +48 -0
  48. package/docs/ListModelReadmeDrifts200Response.md +48 -0
  49. package/docs/ModelsApi.md +332 -0
  50. package/docs/ReadmeAt.md +39 -0
  51. package/docs/ReadmeDrift.md +43 -0
  52. package/package.json +1 -1
  53. package/src/apis/ModelsApi.ts +462 -0
  54. package/src/models/DownloadAnomaly.ts +116 -0
  55. package/src/models/DownloadPoint.ts +69 -0
  56. package/src/models/GetModelDownloadHistory200Response.ts +132 -0
  57. package/src/models/GetModelReadmeAt200Response.ts +132 -0
  58. package/src/models/ListAnomalies200Response.ts +132 -0
  59. package/src/models/ListModelReadmeDrifts200Response.ts +132 -0
  60. package/src/models/ReadmeAt.ts +75 -0
  61. package/src/models/ReadmeDrift.ts +87 -0
  62. package/src/models/index.ts +8 -0
@@ -23,6 +23,21 @@ import {
23
23
  GetModel200ResponseFromJSON,
24
24
  GetModel200ResponseToJSON,
25
25
  } from '../models/GetModel200Response';
26
+ import {
27
+ type GetModelDownloadHistory200Response,
28
+ GetModelDownloadHistory200ResponseFromJSON,
29
+ GetModelDownloadHistory200ResponseToJSON,
30
+ } from '../models/GetModelDownloadHistory200Response';
31
+ import {
32
+ type GetModelReadmeAt200Response,
33
+ GetModelReadmeAt200ResponseFromJSON,
34
+ GetModelReadmeAt200ResponseToJSON,
35
+ } from '../models/GetModelReadmeAt200Response';
36
+ import {
37
+ type ListAnomalies200Response,
38
+ ListAnomalies200ResponseFromJSON,
39
+ ListAnomalies200ResponseToJSON,
40
+ } from '../models/ListAnomalies200Response';
26
41
  import {
27
42
  type ListDelistedModels200Response,
28
43
  ListDelistedModels200ResponseFromJSON,
@@ -33,6 +48,11 @@ import {
33
48
  ListHistoricalDeletions200ResponseFromJSON,
34
49
  ListHistoricalDeletions200ResponseToJSON,
35
50
  } from '../models/ListHistoricalDeletions200Response';
51
+ import {
52
+ type ListModelReadmeDrifts200Response,
53
+ ListModelReadmeDrifts200ResponseFromJSON,
54
+ ListModelReadmeDrifts200ResponseToJSON,
55
+ } from '../models/ListModelReadmeDrifts200Response';
36
56
  import {
37
57
  type ListModels200Response,
38
58
  ListModels200ResponseFromJSON,
@@ -46,6 +66,51 @@ export interface GetModelRequest {
46
66
  id: string;
47
67
  }
48
68
 
69
+ export interface GetModelDownloadHistoryRequest {
70
+ /**
71
+ *
72
+ */
73
+ id: string;
74
+ /**
75
+ * Window in days (max 365). Pass 0 for full history.
76
+ */
77
+ days?: number;
78
+ }
79
+
80
+ export interface GetModelReadmeAtRequest {
81
+ /**
82
+ *
83
+ */
84
+ id: string;
85
+ /**
86
+ * HF commit sha for the README, from /drifts.
87
+ */
88
+ commit: string;
89
+ }
90
+
91
+ export interface ListAnomaliesRequest {
92
+ /**
93
+ * Baseline distance in days. Default 7, min 1, max 365.
94
+ */
95
+ windowDays?: number;
96
+ /**
97
+ * Only rows where baseline downloads >= this. Filters `0→10` noise. Default 1000.
98
+ */
99
+ minBaseline?: number;
100
+ /**
101
+ * Filter to one class. Omit for both.
102
+ */
103
+ kind?: ListAnomaliesKindEnum;
104
+ /**
105
+ * Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
106
+ */
107
+ limit?: number;
108
+ /**
109
+ * Rows to skip. Negative and non-numeric values are treated as 0.
110
+ */
111
+ offset?: number;
112
+ }
113
+
49
114
  export interface ListDelistedModelsRequest {
50
115
  /**
51
116
  * ISO-8601 date or timestamp. Rows with last_seen_at >= since only. Use your previous poll's newest last_seen_at to build an incremental feed.
@@ -88,6 +153,25 @@ export interface ListHistoricalDeletionsRequest {
88
153
  offset?: number;
89
154
  }
90
155
 
156
+ export interface ListModelReadmeDriftsRequest {
157
+ /**
158
+ *
159
+ */
160
+ id: string;
161
+ /**
162
+ * Unix epoch seconds. Rows with commit_ts >= it only.
163
+ */
164
+ sinceTs?: number;
165
+ /**
166
+ * Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
167
+ */
168
+ limit?: number;
169
+ /**
170
+ * Rows to skip. Negative and non-numeric values are treated as 0.
171
+ */
172
+ offset?: number;
173
+ }
174
+
91
175
  export interface ListModelsRequest {
92
176
  /**
93
177
  * M-code, case-insensitive. See GET /api/v1/methods.
@@ -192,6 +276,90 @@ export interface ModelsApiInterface {
192
276
  */
193
277
  getModel(requestParameters: GetModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModel200Response>;
194
278
 
279
+ /**
280
+ * Creates request options for getModelDownloadHistory without sending the request
281
+ * @param {string} id
282
+ * @param {number} [days] Window in days (max 365). Pass 0 for full history.
283
+ * @throws {RequiredError}
284
+ * @memberof ModelsApiInterface
285
+ */
286
+ getModelDownloadHistoryRequestOpts(requestParameters: GetModelDownloadHistoryRequest): Promise<runtime.RequestOpts>;
287
+
288
+ /**
289
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
290
+ * @summary Per-model download timeline
291
+ * @param {string} id
292
+ * @param {number} [days] Window in days (max 365). Pass 0 for full history.
293
+ * @param {*} [options] Override http request option.
294
+ * @throws {RequiredError}
295
+ * @memberof ModelsApiInterface
296
+ */
297
+ getModelDownloadHistoryRaw(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetModelDownloadHistory200Response>>;
298
+
299
+ /**
300
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
301
+ * Per-model download timeline
302
+ */
303
+ getModelDownloadHistory(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelDownloadHistory200Response>;
304
+
305
+ /**
306
+ * Creates request options for getModelReadmeAt without sending the request
307
+ * @param {string} id
308
+ * @param {string} commit HF commit sha for the README, from /drifts.
309
+ * @throws {RequiredError}
310
+ * @memberof ModelsApiInterface
311
+ */
312
+ getModelReadmeAtRequestOpts(requestParameters: GetModelReadmeAtRequest): Promise<runtime.RequestOpts>;
313
+
314
+ /**
315
+ * Cost: 10 credits, flat. The wayback-machine leg of the change-stream. Returns the exact README content for one model at one commit sha — used after spotting a suspicious drift on GET /api/v1/models/{id}/drifts.
316
+ * @summary README content at one commit (wayback)
317
+ * @param {string} id
318
+ * @param {string} commit HF commit sha for the README, from /drifts.
319
+ * @param {*} [options] Override http request option.
320
+ * @throws {RequiredError}
321
+ * @memberof ModelsApiInterface
322
+ */
323
+ getModelReadmeAtRaw(requestParameters: GetModelReadmeAtRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetModelReadmeAt200Response>>;
324
+
325
+ /**
326
+ * Cost: 10 credits, flat. The wayback-machine leg of the change-stream. Returns the exact README content for one model at one commit sha — used after spotting a suspicious drift on GET /api/v1/models/{id}/drifts.
327
+ * README content at one commit (wayback)
328
+ */
329
+ getModelReadmeAt(requestParameters: GetModelReadmeAtRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelReadmeAt200Response>;
330
+
331
+ /**
332
+ * Creates request options for listAnomalies without sending the request
333
+ * @param {number} [windowDays] Baseline distance in days. Default 7, min 1, max 365.
334
+ * @param {number} [minBaseline] Only rows where baseline downloads &gt;&#x3D; this. Filters &#x60;0→10&#x60; noise. Default 1000.
335
+ * @param {'spike' | 'drop'} [kind] Filter to one class. Omit for both.
336
+ * @param {number} [limit] Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
337
+ * @param {number} [offset] Rows to skip. Negative and non-numeric values are treated as 0.
338
+ * @throws {RequiredError}
339
+ * @memberof ModelsApiInterface
340
+ */
341
+ listAnomaliesRequestOpts(requestParameters: ListAnomaliesRequest): Promise<runtime.RequestOpts>;
342
+
343
+ /**
344
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
345
+ * @summary Anomalies in the download counter (change stream)
346
+ * @param {number} [windowDays] Baseline distance in days. Default 7, min 1, max 365.
347
+ * @param {number} [minBaseline] Only rows where baseline downloads &gt;&#x3D; this. Filters &#x60;0→10&#x60; noise. Default 1000.
348
+ * @param {'spike' | 'drop'} [kind] Filter to one class. Omit for both.
349
+ * @param {number} [limit] Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
350
+ * @param {number} [offset] Rows to skip. Negative and non-numeric values are treated as 0.
351
+ * @param {*} [options] Override http request option.
352
+ * @throws {RequiredError}
353
+ * @memberof ModelsApiInterface
354
+ */
355
+ listAnomaliesRaw(requestParameters: ListAnomaliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListAnomalies200Response>>;
356
+
357
+ /**
358
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
359
+ * Anomalies in the download counter (change stream)
360
+ */
361
+ listAnomalies(requestParameters: ListAnomaliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListAnomalies200Response>;
362
+
195
363
  /**
196
364
  * Creates request options for listDelistedModels without sending the request
197
365
  * @param {string} [since] ISO-8601 date or timestamp. Rows with last_seen_at &gt;&#x3D; since only. Use your previous poll\&#39;s newest last_seen_at to build an incremental feed.
@@ -254,6 +422,36 @@ export interface ModelsApiInterface {
254
422
  */
255
423
  listHistoricalDeletions(requestParameters: ListHistoricalDeletionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListHistoricalDeletions200Response>;
256
424
 
425
+ /**
426
+ * Creates request options for listModelReadmeDrifts without sending the request
427
+ * @param {string} id
428
+ * @param {number} [sinceTs] Unix epoch seconds. Rows with commit_ts &gt;&#x3D; it only.
429
+ * @param {number} [limit] Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
430
+ * @param {number} [offset] Rows to skip. Negative and non-numeric values are treated as 0.
431
+ * @throws {RequiredError}
432
+ * @memberof ModelsApiInterface
433
+ */
434
+ listModelReadmeDriftsRequestOpts(requestParameters: ListModelReadmeDriftsRequest): Promise<runtime.RequestOpts>;
435
+
436
+ /**
437
+ * Cost: 5 credits, flat. Every commit that changed the model\'s README on HF, with `size_delta` between commits so a consumer spots growth spurts and hard prunes without fetching each version. Poll with `since_ts=<max commit_ts of your previous run>` for an incremental drift feed.
438
+ * @summary README drift stream for one model
439
+ * @param {string} id
440
+ * @param {number} [sinceTs] Unix epoch seconds. Rows with commit_ts &gt;&#x3D; it only.
441
+ * @param {number} [limit] Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
442
+ * @param {number} [offset] Rows to skip. Negative and non-numeric values are treated as 0.
443
+ * @param {*} [options] Override http request option.
444
+ * @throws {RequiredError}
445
+ * @memberof ModelsApiInterface
446
+ */
447
+ listModelReadmeDriftsRaw(requestParameters: ListModelReadmeDriftsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListModelReadmeDrifts200Response>>;
448
+
449
+ /**
450
+ * Cost: 5 credits, flat. Every commit that changed the model\'s README on HF, with `size_delta` between commits so a consumer spots growth spurts and hard prunes without fetching each version. Poll with `since_ts=<max commit_ts of your previous run>` for an incremental drift feed.
451
+ * README drift stream for one model
452
+ */
453
+ listModelReadmeDrifts(requestParameters: ListModelReadmeDriftsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListModelReadmeDrifts200Response>;
454
+
257
455
  /**
258
456
  * Creates request options for listModels without sending the request
259
457
  * @param {string} [method] M-code, case-insensitive. See GET /api/v1/methods.
@@ -409,6 +607,195 @@ export class ModelsApi extends runtime.BaseAPI implements ModelsApiInterface {
409
607
  return await response.value();
410
608
  }
411
609
 
610
+ /**
611
+ * Creates request options for getModelDownloadHistory without sending the request
612
+ */
613
+ async getModelDownloadHistoryRequestOpts(requestParameters: GetModelDownloadHistoryRequest): Promise<runtime.RequestOpts> {
614
+ if (requestParameters['id'] == null) {
615
+ throw new runtime.RequiredError(
616
+ 'id',
617
+ 'Required parameter "id" was null or undefined when calling getModelDownloadHistory().'
618
+ );
619
+ }
620
+
621
+ const queryParameters: any = {};
622
+
623
+ if (requestParameters['days'] != null) {
624
+ queryParameters['days'] = requestParameters['days'];
625
+ }
626
+
627
+ const headerParameters: runtime.HTTPHeaders = {};
628
+
629
+ if (this.configuration && this.configuration.accessToken) {
630
+ const token = this.configuration.accessToken;
631
+ const tokenString = await token("bearerAuth", []);
632
+
633
+ if (tokenString) {
634
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
635
+ }
636
+ }
637
+
638
+ let urlPath = `/api/v1/models/{id}/download-history`;
639
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
640
+
641
+ return {
642
+ path: urlPath,
643
+ method: 'GET',
644
+ headers: headerParameters,
645
+ query: queryParameters,
646
+ };
647
+ }
648
+
649
+ /**
650
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
651
+ * Per-model download timeline
652
+ */
653
+ async getModelDownloadHistoryRaw(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetModelDownloadHistory200Response>> {
654
+ const requestOptions = await this.getModelDownloadHistoryRequestOpts(requestParameters);
655
+ const response = await this.request(requestOptions, initOverrides);
656
+
657
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetModelDownloadHistory200ResponseFromJSON(jsonValue));
658
+ }
659
+
660
+ /**
661
+ * Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
662
+ * Per-model download timeline
663
+ */
664
+ async getModelDownloadHistory(requestParameters: GetModelDownloadHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelDownloadHistory200Response> {
665
+ const response = await this.getModelDownloadHistoryRaw(requestParameters, initOverrides);
666
+ return await response.value();
667
+ }
668
+
669
+ /**
670
+ * Creates request options for getModelReadmeAt without sending the request
671
+ */
672
+ async getModelReadmeAtRequestOpts(requestParameters: GetModelReadmeAtRequest): Promise<runtime.RequestOpts> {
673
+ if (requestParameters['id'] == null) {
674
+ throw new runtime.RequiredError(
675
+ 'id',
676
+ 'Required parameter "id" was null or undefined when calling getModelReadmeAt().'
677
+ );
678
+ }
679
+
680
+ if (requestParameters['commit'] == null) {
681
+ throw new runtime.RequiredError(
682
+ 'commit',
683
+ 'Required parameter "commit" was null or undefined when calling getModelReadmeAt().'
684
+ );
685
+ }
686
+
687
+ const queryParameters: any = {};
688
+
689
+ const headerParameters: runtime.HTTPHeaders = {};
690
+
691
+ if (this.configuration && this.configuration.accessToken) {
692
+ const token = this.configuration.accessToken;
693
+ const tokenString = await token("bearerAuth", []);
694
+
695
+ if (tokenString) {
696
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
697
+ }
698
+ }
699
+
700
+ let urlPath = `/api/v1/models/{id}/readme-at/{commit}`;
701
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
702
+ urlPath = urlPath.replace('{commit}', encodeURIComponent(String(requestParameters['commit'])));
703
+
704
+ return {
705
+ path: urlPath,
706
+ method: 'GET',
707
+ headers: headerParameters,
708
+ query: queryParameters,
709
+ };
710
+ }
711
+
712
+ /**
713
+ * Cost: 10 credits, flat. The wayback-machine leg of the change-stream. Returns the exact README content for one model at one commit sha — used after spotting a suspicious drift on GET /api/v1/models/{id}/drifts.
714
+ * README content at one commit (wayback)
715
+ */
716
+ async getModelReadmeAtRaw(requestParameters: GetModelReadmeAtRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetModelReadmeAt200Response>> {
717
+ const requestOptions = await this.getModelReadmeAtRequestOpts(requestParameters);
718
+ const response = await this.request(requestOptions, initOverrides);
719
+
720
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetModelReadmeAt200ResponseFromJSON(jsonValue));
721
+ }
722
+
723
+ /**
724
+ * Cost: 10 credits, flat. The wayback-machine leg of the change-stream. Returns the exact README content for one model at one commit sha — used after spotting a suspicious drift on GET /api/v1/models/{id}/drifts.
725
+ * README content at one commit (wayback)
726
+ */
727
+ async getModelReadmeAt(requestParameters: GetModelReadmeAtRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetModelReadmeAt200Response> {
728
+ const response = await this.getModelReadmeAtRaw(requestParameters, initOverrides);
729
+ return await response.value();
730
+ }
731
+
732
+ /**
733
+ * Creates request options for listAnomalies without sending the request
734
+ */
735
+ async listAnomaliesRequestOpts(requestParameters: ListAnomaliesRequest): Promise<runtime.RequestOpts> {
736
+ const queryParameters: any = {};
737
+
738
+ if (requestParameters['windowDays'] != null) {
739
+ queryParameters['window_days'] = requestParameters['windowDays'];
740
+ }
741
+
742
+ if (requestParameters['minBaseline'] != null) {
743
+ queryParameters['min_baseline'] = requestParameters['minBaseline'];
744
+ }
745
+
746
+ if (requestParameters['kind'] != null) {
747
+ queryParameters['kind'] = requestParameters['kind'];
748
+ }
749
+
750
+ if (requestParameters['limit'] != null) {
751
+ queryParameters['limit'] = requestParameters['limit'];
752
+ }
753
+
754
+ if (requestParameters['offset'] != null) {
755
+ queryParameters['offset'] = requestParameters['offset'];
756
+ }
757
+
758
+ const headerParameters: runtime.HTTPHeaders = {};
759
+
760
+ if (this.configuration && this.configuration.accessToken) {
761
+ const token = this.configuration.accessToken;
762
+ const tokenString = await token("bearerAuth", []);
763
+
764
+ if (tokenString) {
765
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
766
+ }
767
+ }
768
+
769
+ let urlPath = `/api/v1/market/anomalies`;
770
+
771
+ return {
772
+ path: urlPath,
773
+ method: 'GET',
774
+ headers: headerParameters,
775
+ query: queryParameters,
776
+ };
777
+ }
778
+
779
+ /**
780
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
781
+ * Anomalies in the download counter (change stream)
782
+ */
783
+ async listAnomaliesRaw(requestParameters: ListAnomaliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListAnomalies200Response>> {
784
+ const requestOptions = await this.listAnomaliesRequestOpts(requestParameters);
785
+ const response = await this.request(requestOptions, initOverrides);
786
+
787
+ return new runtime.JSONApiResponse(response, (jsonValue) => ListAnomalies200ResponseFromJSON(jsonValue));
788
+ }
789
+
790
+ /**
791
+ * Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
792
+ * Anomalies in the download counter (change stream)
793
+ */
794
+ async listAnomalies(requestParameters: ListAnomaliesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListAnomalies200Response> {
795
+ const response = await this.listAnomaliesRaw(requestParameters, initOverrides);
796
+ return await response.value();
797
+ }
798
+
412
799
  /**
413
800
  * Creates request options for listDelistedModels without sending the request
414
801
  */
@@ -539,6 +926,73 @@ export class ModelsApi extends runtime.BaseAPI implements ModelsApiInterface {
539
926
  return await response.value();
540
927
  }
541
928
 
929
+ /**
930
+ * Creates request options for listModelReadmeDrifts without sending the request
931
+ */
932
+ async listModelReadmeDriftsRequestOpts(requestParameters: ListModelReadmeDriftsRequest): Promise<runtime.RequestOpts> {
933
+ if (requestParameters['id'] == null) {
934
+ throw new runtime.RequiredError(
935
+ 'id',
936
+ 'Required parameter "id" was null or undefined when calling listModelReadmeDrifts().'
937
+ );
938
+ }
939
+
940
+ const queryParameters: any = {};
941
+
942
+ if (requestParameters['sinceTs'] != null) {
943
+ queryParameters['since_ts'] = requestParameters['sinceTs'];
944
+ }
945
+
946
+ if (requestParameters['limit'] != null) {
947
+ queryParameters['limit'] = requestParameters['limit'];
948
+ }
949
+
950
+ if (requestParameters['offset'] != null) {
951
+ queryParameters['offset'] = requestParameters['offset'];
952
+ }
953
+
954
+ const headerParameters: runtime.HTTPHeaders = {};
955
+
956
+ if (this.configuration && this.configuration.accessToken) {
957
+ const token = this.configuration.accessToken;
958
+ const tokenString = await token("bearerAuth", []);
959
+
960
+ if (tokenString) {
961
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
962
+ }
963
+ }
964
+
965
+ let urlPath = `/api/v1/models/{id}/drifts`;
966
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
967
+
968
+ return {
969
+ path: urlPath,
970
+ method: 'GET',
971
+ headers: headerParameters,
972
+ query: queryParameters,
973
+ };
974
+ }
975
+
976
+ /**
977
+ * Cost: 5 credits, flat. Every commit that changed the model\'s README on HF, with `size_delta` between commits so a consumer spots growth spurts and hard prunes without fetching each version. Poll with `since_ts=<max commit_ts of your previous run>` for an incremental drift feed.
978
+ * README drift stream for one model
979
+ */
980
+ async listModelReadmeDriftsRaw(requestParameters: ListModelReadmeDriftsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListModelReadmeDrifts200Response>> {
981
+ const requestOptions = await this.listModelReadmeDriftsRequestOpts(requestParameters);
982
+ const response = await this.request(requestOptions, initOverrides);
983
+
984
+ return new runtime.JSONApiResponse(response, (jsonValue) => ListModelReadmeDrifts200ResponseFromJSON(jsonValue));
985
+ }
986
+
987
+ /**
988
+ * Cost: 5 credits, flat. Every commit that changed the model\'s README on HF, with `size_delta` between commits so a consumer spots growth spurts and hard prunes without fetching each version. Poll with `since_ts=<max commit_ts of your previous run>` for an incremental drift feed.
989
+ * README drift stream for one model
990
+ */
991
+ async listModelReadmeDrifts(requestParameters: ListModelReadmeDriftsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListModelReadmeDrifts200Response> {
992
+ const response = await this.listModelReadmeDriftsRaw(requestParameters, initOverrides);
993
+ return await response.value();
994
+ }
995
+
542
996
  /**
543
997
  * Creates request options for listModels without sending the request
544
998
  */
@@ -636,6 +1090,14 @@ export class ModelsApi extends runtime.BaseAPI implements ModelsApiInterface {
636
1090
 
637
1091
  }
638
1092
 
1093
+ /**
1094
+ * @export
1095
+ */
1096
+ export const ListAnomaliesKindEnum = {
1097
+ Spike: 'spike',
1098
+ Drop: 'drop',
1099
+ } as const;
1100
+ export type ListAnomaliesKindEnum = typeof ListAnomaliesKindEnum[keyof typeof ListAnomaliesKindEnum];
639
1101
  /**
640
1102
  * @export
641
1103
  */
@@ -0,0 +1,116 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * abliteration.org Public API
5
+ * Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * One model whose downloads-per-window crossed a threshold.
18
+ * @export
19
+ * @interface DownloadAnomaly
20
+ */
21
+ export interface DownloadAnomaly {
22
+ /**
23
+ *
24
+ */
25
+ model_id?: string;
26
+ /**
27
+ * ISO-8601 timestamp of the current snapshot.
28
+ */
29
+ current_at?: string;
30
+ /**
31
+ *
32
+ */
33
+ current_downloads?: number;
34
+ /**
35
+ * ISO-8601 timestamp of the baseline snapshot the delta is computed against.
36
+ */
37
+ baseline_at?: string;
38
+ /**
39
+ *
40
+ */
41
+ baseline_downloads?: number;
42
+ /**
43
+ * current_downloads / baseline_downloads.
44
+ */
45
+ ratio?: number;
46
+ /**
47
+ * current_downloads - baseline_downloads (signed).
48
+ */
49
+ delta?: number;
50
+ /**
51
+ * `spike` when ratio >= 2, `drop` when ratio <= 0.5.
52
+ */
53
+ kind?: DownloadAnomalyKindEnum;
54
+ }
55
+
56
+
57
+ /**
58
+ * @export
59
+ */
60
+ export const DownloadAnomalyKindEnum = {
61
+ Spike: 'spike',
62
+ Drop: 'drop',
63
+ } as const;
64
+ export type DownloadAnomalyKindEnum = typeof DownloadAnomalyKindEnum[keyof typeof DownloadAnomalyKindEnum];
65
+
66
+
67
+ /**
68
+ * Check if a given object implements the DownloadAnomaly interface.
69
+ */
70
+ export function instanceOfDownloadAnomaly(value: object): value is DownloadAnomaly {
71
+ return true;
72
+ }
73
+
74
+ export function DownloadAnomalyFromJSON(json: any): DownloadAnomaly {
75
+ return DownloadAnomalyFromJSONTyped(json, false);
76
+ }
77
+
78
+ export function DownloadAnomalyFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadAnomaly {
79
+ if (json == null) {
80
+ return json;
81
+ }
82
+ return {
83
+
84
+ 'model_id': json['model_id'] == null ? undefined : json['model_id'],
85
+ 'current_at': json['current_at'] == null ? undefined : json['current_at'],
86
+ 'current_downloads': json['current_downloads'] == null ? undefined : json['current_downloads'],
87
+ 'baseline_at': json['baseline_at'] == null ? undefined : json['baseline_at'],
88
+ 'baseline_downloads': json['baseline_downloads'] == null ? undefined : json['baseline_downloads'],
89
+ 'ratio': json['ratio'] == null ? undefined : json['ratio'],
90
+ 'delta': json['delta'] == null ? undefined : json['delta'],
91
+ 'kind': json['kind'] == null ? undefined : json['kind'],
92
+ };
93
+ }
94
+
95
+ export function DownloadAnomalyToJSON(json: any): DownloadAnomaly {
96
+ return DownloadAnomalyToJSONTyped(json, false);
97
+ }
98
+
99
+ export function DownloadAnomalyToJSONTyped(value?: DownloadAnomaly | null, ignoreDiscriminator: boolean = false): any {
100
+ if (value == null) {
101
+ return value;
102
+ }
103
+
104
+ return {
105
+
106
+ 'model_id': value['model_id'],
107
+ 'current_at': value['current_at'],
108
+ 'current_downloads': value['current_downloads'],
109
+ 'baseline_at': value['baseline_at'],
110
+ 'baseline_downloads': value['baseline_downloads'],
111
+ 'ratio': value['ratio'],
112
+ 'delta': value['delta'],
113
+ 'kind': value['kind'],
114
+ };
115
+ }
116
+