@aeye/models 0.3.8 → 0.4.0
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.
- package/aeye-models.md +272 -0
- package/dist/scripts/codegen.d.ts +4 -0
- package/dist/scripts/codegen.d.ts.map +1 -1
- package/dist/scripts/codegen.js +16 -1
- package/dist/scripts/codegen.js.map +1 -1
- package/dist/scripts/scrape.d.ts +2 -1
- package/dist/scripts/scrape.d.ts.map +1 -1
- package/dist/scripts/scrape.js +8 -4
- package/dist/scripts/scrape.js.map +1 -1
- package/dist/scripts/scrapers/aws.d.ts +5 -1
- package/dist/scripts/scrapers/aws.d.ts.map +1 -1
- package/dist/scripts/scrapers/aws.js +211 -57
- package/dist/scripts/scrapers/aws.js.map +1 -1
- package/dist/scripts/scrapers/docs.d.ts +43 -0
- package/dist/scripts/scrapers/docs.d.ts.map +1 -0
- package/dist/scripts/scrapers/docs.js +91 -0
- package/dist/scripts/scrapers/docs.js.map +1 -0
- package/dist/scripts/scrapers/openai.d.ts +4 -1
- package/dist/scripts/scrapers/openai.d.ts.map +1 -1
- package/dist/scripts/scrapers/openai.js +183 -445
- package/dist/scripts/scrapers/openai.js.map +1 -1
- package/dist/scripts/scrapers/openrouter.d.ts +1 -1
- package/dist/scripts/scrapers/openrouter.d.ts.map +1 -1
- package/dist/scripts/scrapers/openrouter.js +20 -79
- package/dist/scripts/scrapers/openrouter.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/aws.d.ts.map +1 -1
- package/dist/src/models/aws.js +2180 -1033
- package/dist/src/models/aws.js.map +1 -1
- package/dist/src/models/openai.d.ts.map +1 -1
- package/dist/src/models/openai.js +1925 -1370
- package/dist/src/models/openai.js.map +1 -1
- package/dist/src/models/openrouter.d.ts.map +1 -1
- package/dist/src/models/openrouter.js +16017 -6383
- package/dist/src/models/openrouter.js.map +1 -1
- package/dist/src/strict-support.d.ts +45 -0
- package/dist/src/strict-support.d.ts.map +1 -0
- package/dist/src/strict-support.js +129 -0
- package/dist/src/strict-support.js.map +1 -0
- package/dist/src/transformers/replicate/black-forest-labs-flux-1-1-pro.js +1 -1
- package/dist/src/transformers/replicate/black-forest-labs-flux-1-1-pro.js.map +1 -1
- package/dist/src/transformers/replicate/black-forest-labs-flux-pro.js +1 -1
- package/dist/src/transformers/replicate/black-forest-labs-flux-pro.js.map +1 -1
- package/dist/src/transformers/replicate/openai-gpt-image-1.js +1 -1
- package/dist/src/transformers/replicate/openai-gpt-image-1.js.map +1 -1
- package/package.json +78 -79
- package/scripts/codegen.ts +17 -2
- package/scripts/scrape.ts +13 -5
- package/scripts/scrapers/aws.ts +245 -76
- package/scripts/scrapers/docs.ts +101 -0
- package/scripts/scrapers/openai.ts +185 -552
- package/scripts/scrapers/openrouter.ts +20 -106
- package/src/index.ts +13 -12
- package/src/models/aws.ts +2569 -1422
- package/src/models/openai.ts +2764 -2209
- package/src/models/openrouter.ts +19708 -10074
- package/src/strict-support.ts +134 -0
- package/src/transformers/replicate/black-forest-labs-flux-1-1-pro.ts +1 -1
- package/src/transformers/replicate/black-forest-labs-flux-pro.ts +1 -1
- package/src/transformers/replicate/openai-gpt-image-1.ts +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curated strict-mode support table.
|
|
3
|
+
*
|
|
4
|
+
* HUMAN-CURATED. NOT auto-generated. Edit by hand as new models ship or
|
|
5
|
+
* provider docs change. The auto-generated model files (`openai.ts`,
|
|
6
|
+
* `aws.ts`, etc.) are scraped from provider listings and don't track
|
|
7
|
+
* strict-mode capability on their own — strict support is a separate axis
|
|
8
|
+
* sourced here.
|
|
9
|
+
*
|
|
10
|
+
* Splat into your `AI` config:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { models, strictSupport } from '@aeye/models';
|
|
14
|
+
*
|
|
15
|
+
* const ai = new AI({
|
|
16
|
+
* providers: { ... },
|
|
17
|
+
* models,
|
|
18
|
+
* modelOverrides: [...strictSupport, ...myOwnOverrides],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Setting `strictFormat: '<family>'` does two things:
|
|
23
|
+
* 1. Auto-derives the `'toolsStrict'` capability for selection.
|
|
24
|
+
* 2. Pins the JSON-Schema dialect that providers will emit.
|
|
25
|
+
*
|
|
26
|
+
* The dialect could often be left implicit and resolved via
|
|
27
|
+
* `resolveStrictFormat(model)`'s fallback chain (provider name → `[family]/`
|
|
28
|
+
* id prefix), but we set it explicitly here so the curated table is
|
|
29
|
+
* self-documenting and so the provider doesn't have to recompute it for
|
|
30
|
+
* every request.
|
|
31
|
+
*
|
|
32
|
+
* `strictFormat: 'none'` is a hard opt-out — used when an upstream source
|
|
33
|
+
* (a scraper, a future provider plug-in) has incorrectly marked a model
|
|
34
|
+
* strict-capable.
|
|
35
|
+
*
|
|
36
|
+
* References:
|
|
37
|
+
* - https://developers.openai.com/api/docs/guides/structured-outputs
|
|
38
|
+
* - https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use
|
|
39
|
+
* - https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
40
|
+
* - https://ai.google.dev/gemini-api/docs/structured-output
|
|
41
|
+
* - https://docs.x.ai/docs/guides/structured-outputs
|
|
42
|
+
*/
|
|
43
|
+
import type { ModelOverride } from '@aeye/ai';
|
|
44
|
+
export declare const strictSupport: ModelOverride[];
|
|
45
|
+
//# sourceMappingURL=strict-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strict-support.d.ts","sourceRoot":"","sources":["../../src/strict-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,eAAO,MAAM,aAAa,EAAE,aAAa,EAwFxC,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curated strict-mode support table.
|
|
3
|
+
*
|
|
4
|
+
* HUMAN-CURATED. NOT auto-generated. Edit by hand as new models ship or
|
|
5
|
+
* provider docs change. The auto-generated model files (`openai.ts`,
|
|
6
|
+
* `aws.ts`, etc.) are scraped from provider listings and don't track
|
|
7
|
+
* strict-mode capability on their own — strict support is a separate axis
|
|
8
|
+
* sourced here.
|
|
9
|
+
*
|
|
10
|
+
* Splat into your `AI` config:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { models, strictSupport } from '@aeye/models';
|
|
14
|
+
*
|
|
15
|
+
* const ai = new AI({
|
|
16
|
+
* providers: { ... },
|
|
17
|
+
* models,
|
|
18
|
+
* modelOverrides: [...strictSupport, ...myOwnOverrides],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Setting `strictFormat: '<family>'` does two things:
|
|
23
|
+
* 1. Auto-derives the `'toolsStrict'` capability for selection.
|
|
24
|
+
* 2. Pins the JSON-Schema dialect that providers will emit.
|
|
25
|
+
*
|
|
26
|
+
* The dialect could often be left implicit and resolved via
|
|
27
|
+
* `resolveStrictFormat(model)`'s fallback chain (provider name → `[family]/`
|
|
28
|
+
* id prefix), but we set it explicitly here so the curated table is
|
|
29
|
+
* self-documenting and so the provider doesn't have to recompute it for
|
|
30
|
+
* every request.
|
|
31
|
+
*
|
|
32
|
+
* `strictFormat: 'none'` is a hard opt-out — used when an upstream source
|
|
33
|
+
* (a scraper, a future provider plug-in) has incorrectly marked a model
|
|
34
|
+
* strict-capable.
|
|
35
|
+
*
|
|
36
|
+
* References:
|
|
37
|
+
* - https://developers.openai.com/api/docs/guides/structured-outputs
|
|
38
|
+
* - https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use
|
|
39
|
+
* - https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
40
|
+
* - https://ai.google.dev/gemini-api/docs/structured-output
|
|
41
|
+
* - https://docs.x.ai/docs/guides/structured-outputs
|
|
42
|
+
*/
|
|
43
|
+
export const strictSupport = [
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// OpenAI direct — gpt-4o, gpt-4.1, gpt-5 and later (gpt-5.x, gpt-6.x), and
|
|
46
|
+
// the o-series support strict tools + outputs. gpt-realtime supports
|
|
47
|
+
// function calling (no documented support for structured output, gated by
|
|
48
|
+
// the `'structured'` capability — which the scraper doesn't add for realtime
|
|
49
|
+
// models). Legacy gpt-4 / gpt-3.5 are not listed: they don't get the cap, so
|
|
50
|
+
// they stay lenient.
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
{
|
|
53
|
+
provider: 'openai',
|
|
54
|
+
modelPattern: /^gpt-4o(\b|[-_])/,
|
|
55
|
+
overrides: { strictFormat: 'openai' },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
provider: 'openai',
|
|
59
|
+
modelPattern: /^gpt-4\.1(\b|[-_])/,
|
|
60
|
+
overrides: { strictFormat: 'openai' },
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
provider: 'openai',
|
|
64
|
+
modelPattern: /^(gpt-([5-9]|\d{2,})(\b|[-_.])|chat-latest$)/,
|
|
65
|
+
overrides: { strictFormat: 'openai' },
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
provider: 'openai',
|
|
69
|
+
modelPattern: /^o[1-9](-mini|-preview|-pro)?(\b|[-_])/,
|
|
70
|
+
overrides: { strictFormat: 'openai' },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
provider: 'openai',
|
|
74
|
+
modelPattern: /^gpt-realtime/,
|
|
75
|
+
overrides: { strictFormat: 'openai' },
|
|
76
|
+
},
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// AWS Bedrock — Anthropic-family Claude 4.5+ only. provider='aws' doesn't
|
|
79
|
+
// resolve and the id uses '.' separators rather than '/', so the dialect
|
|
80
|
+
// must be set explicitly here. Claude 3.x, 4, and 4.1 don't support strict
|
|
81
|
+
// per Anthropic docs and are deliberately not matched.
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
{
|
|
84
|
+
provider: 'aws',
|
|
85
|
+
modelPattern: /anthropic\.claude-((opus|sonnet|haiku)-4-[5-9]|(opus|sonnet|haiku|fable|mythos)-[5-9])/,
|
|
86
|
+
overrides: { strictFormat: 'anthropic' },
|
|
87
|
+
},
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// OpenRouter — keyed off the `[family]/...` id prefix (and the `~` of
|
|
90
|
+
// floating `-latest` aliases). Listed here both to add the `'toolsStrict'`
|
|
91
|
+
// capability (which the OpenRouter scraper doesn't currently set) and to pin
|
|
92
|
+
// the dialect explicitly. xAI's prefix is `x-ai`, which no family resolves
|
|
93
|
+
// on its own. Floating aliases (`~openai/gpt-luna-latest`,
|
|
94
|
+
// `openai/gpt-chat-latest`) name the same models.
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
{
|
|
97
|
+
provider: 'openrouter',
|
|
98
|
+
modelPattern: /^~?openai\/(gpt-4o|gpt-4\.1|gpt-([5-9]|\d{2,}|[a-z]+-latest)|o[1-9])/,
|
|
99
|
+
overrides: { strictFormat: 'openai' },
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
provider: 'openrouter',
|
|
103
|
+
modelPattern: /^~?anthropic\/claude-((opus|sonnet|haiku)-4\.[5-9]|(opus|sonnet|haiku|fable|mythos)-([5-9]|latest))/,
|
|
104
|
+
overrides: { strictFormat: 'anthropic' },
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
provider: 'openrouter',
|
|
108
|
+
modelPattern: /^~?google\/gemini-([2-9]|flash|pro)/,
|
|
109
|
+
overrides: { strictFormat: 'google' },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
provider: 'openrouter',
|
|
113
|
+
modelPattern: /^~?x-ai\/grok-([4-9]|latest)/,
|
|
114
|
+
overrides: { strictFormat: 'xai' },
|
|
115
|
+
},
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
// Open-weight models under a vendor prefix. `openai/gpt-oss-*` and
|
|
118
|
+
// `google/gemma-*` would otherwise resolve to the OpenAI / Gemini dialect by
|
|
119
|
+
// id prefix, but OpenRouter serves them from third-party hosts (Groq,
|
|
120
|
+
// Cerebras, DeepInfra, ...) whose json_schema support is their own — see
|
|
121
|
+
// docs/plans/schema-dialects-2026.md § 6.
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
{
|
|
124
|
+
provider: 'openrouter',
|
|
125
|
+
modelPattern: /^~?(openai\/gpt-oss|google\/gemma)/,
|
|
126
|
+
overrides: { strictFormat: 'none' },
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
//# sourceMappingURL=strict-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strict-support.js","sourceRoot":"","sources":["../../src/strict-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAoB;IAC5C,8EAA8E;IAC9E,2EAA2E;IAC3E,qEAAqE;IACrE,0EAA0E;IAC1E,6EAA6E;IAC7E,6EAA6E;IAC7E,qBAAqB;IACrB,8EAA8E;IAC9E;QACE,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,kBAAkB;QAChC,SAAS,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE;KACtC;IACD;QACE,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,oBAAoB;QAClC,SAAS,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE;KACtC;IACD;QACE,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,8CAA8C;QAC5D,SAAS,EAAE,EAAE,YAAY,EAAE,QA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|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
if (request.quality) {
|
|
21
|
-
const qualityMap = { low: 60, medium: 80, high: 100 };
|
|
21
|
+
const qualityMap = { auto: 80, low: 60, medium: 80, high: 100, xhigh: 100, max: 100 };
|
|
22
22
|
input.output_quality = qualityMap[request.quality] || 80;
|
|
23
23
|
}
|
|
24
24
|
if (request.extra?.image_prompt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"black-forest-labs-flux-1-1-pro.js","sourceRoot":"","sources":["../../../../src/transformers/replicate/black-forest-labs-flux-1-1-pro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAqBnC,eAAe;IACb,gCAAgC,EAAE,CAAC,GAAG,EAAE;QACtC,MAAM,WAAW,GAAyB;YACxC,aAAa,EAAE;gBACb,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAA6B,EAAE;oBAChE,MAAM,KAAK,GAAqB;wBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;wBAClB,GAAG,OAAO,CAAC,KAAK;qBACjB,CAAC;oBAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;wBACjB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBAC5D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;4BACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;4BACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;4BACtB,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC;wBAChC,CAAC;oBACH,CAAC;oBAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;wBACpB,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"black-forest-labs-flux-1-1-pro.js","sourceRoot":"","sources":["../../../../src/transformers/replicate/black-forest-labs-flux-1-1-pro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAqBnC,eAAe;IACb,gCAAgC,EAAE,CAAC,GAAG,EAAE;QACtC,MAAM,WAAW,GAAyB;YACxC,aAAa,EAAE;gBACb,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAA6B,EAAE;oBAChE,MAAM,KAAK,GAAqB;wBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;wBAClB,GAAG,OAAO,CAAC,KAAK;qBACjB,CAAC;oBAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;wBACjB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBAC5D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;4BACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;4BACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;4BACtB,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC;wBAChC,CAAC;oBACH,CAAC;oBAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;wBACpB,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;wBACtF,KAAK,CAAC,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;oBAC3D,CAAC;oBAED,IAAI,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;wBAChC,KAAK,CAAC,YAAY,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;oBAC/D,CAAC;oBAED,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,aAAa,EAAE,KAAK,EAAE,QAA2B,EAAE,GAAG,EAAE,EAAE;oBACxD,OAAO;wBACL,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;qBAC5B,CAAC;gBACJ,CAAC;aACF;SACF,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,EAAE;CACL,CAAA"}
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
if (request.quality) {
|
|
23
|
-
const qualityMap = { low: 60, medium: 80, high: 100 };
|
|
23
|
+
const qualityMap = { auto: 80, low: 60, medium: 80, high: 100, xhigh: 100, max: 100 };
|
|
24
24
|
input.output_quality = qualityMap[request.quality] || 80;
|
|
25
25
|
}
|
|
26
26
|
return input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"black-forest-labs-flux-pro.js","sourceRoot":"","sources":["../../../../src/transformers/replicate/black-forest-labs-flux-pro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwBnC,eAAe;IACb,4BAA4B,EAAE,CAAC,GAAG,EAAE;QAClC,MAAM,WAAW,GAAyB;YACxC,aAAa,EAAE;gBACb,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAA6B,EAAE;oBAChE,MAAM,KAAK,GAAqB;wBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,GAAG,OAAO,CAAC,KAAK;qBACjB,CAAC;oBACF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBAC/B,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;oBAC5B,CAAC;oBACD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;wBACjB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBAClD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;4BAC/D,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;4BACvB,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;4BACxB,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC;wBAChC,CAAC;oBACH,CAAC;oBACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;wBACpB,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"black-forest-labs-flux-pro.js","sourceRoot":"","sources":["../../../../src/transformers/replicate/black-forest-labs-flux-pro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwBnC,eAAe;IACb,4BAA4B,EAAE,CAAC,GAAG,EAAE;QAClC,MAAM,WAAW,GAAyB;YACxC,aAAa,EAAE;gBACb,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAA6B,EAAE;oBAChE,MAAM,KAAK,GAAqB;wBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,GAAG,OAAO,CAAC,KAAK;qBACjB,CAAC;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OAAO,EAAE,GAAG,EAA6B,EAAE;oBAChE,MAAM,KAAK,GAAqB;wBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,YAAY,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;wBACxC,GAAG,OAAO,CAAC,KAAK;qBACjB,CAAC;oBACF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBAC/B,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;oBAC5B,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,aAAa,EAAE,KAAK,EAAE,QAA2B,EAAE,GAAG,EAAE,EAAE;oBACxD,OAAO;wBACL,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;qBACzC,CAAC;gBACJ,CAAC;aACF;SACF,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,EAAE;CACL,CAAA"}
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
convertRequest: async (request, ctx) => ({
|
|
7
7
|
prompt: request.prompt,
|
|
8
8
|
number_of_images: request.n,
|
|
9
|
-
quality: request.quality,
|
|
9
|
+
quality: request.quality === 'xhigh' || request.quality === 'max' ? 'high' : request.quality,
|
|
10
10
|
user_id: request.userIdentifier,
|
|
11
11
|
...request.extra,
|
|
12
12
|
openai_api_key: request.extra?.openai_api_key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-gpt-image-1.js","sourceRoot":"","sources":["../../../../src/transformers/replicate/openai-gpt-image-1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA4BnC,eAAe;IACb,oBAAoB,EAAE,CAAC,GAAG,EAAE;QAC1B,MAAM,WAAW,GAAyB;YACxC,aAAa,EAAE;gBACb,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAA6B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AgB,EAAE,OAAO,CAAC,CAAC;oBAC3B,OAAO,EAAE,OAAO,CAAC,cAAc;oBAC/B,GAAG,OAAO,CAAC,KAAK;oBAChB,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,cAAc;iBAC9C,CAAC;gBACF,aAAa,EAAE,KAAK,EAAE,QAA2B,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;oBAC1D,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;iBACzC,CAAC;aACH;SACF,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,EAAE;CACL,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,79 +1,78 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@aeye/models",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Static model information scraped from OpenAI, OpenRouter, Replicate, and AWS Bedrock",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/src/index.js",
|
|
7
|
-
"types": "dist/src/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": {
|
|
11
|
-
"types": "./dist/src/index.d.ts",
|
|
12
|
-
"default": "./dist/src/index.js"
|
|
13
|
-
},
|
|
14
|
-
"require": {
|
|
15
|
-
"types": "./dist/src/index.d.ts",
|
|
16
|
-
"default": "./dist/src/index.js"
|
|
17
|
-
},
|
|
18
|
-
"default": "./dist/src/index.js"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsc",
|
|
23
|
-
"typecheck": "tsc --noEmit",
|
|
24
|
-
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
25
|
-
"scrape": "tsx scripts/scrape.ts",
|
|
26
|
-
"scrape:
|
|
27
|
-
"scrape:openrouter
|
|
28
|
-
"scrape:
|
|
29
|
-
"scrape:
|
|
30
|
-
"scrape:replicate
|
|
31
|
-
"scrape:replicate:
|
|
32
|
-
"scrape:replicate:
|
|
33
|
-
"scrape:replicate:
|
|
34
|
-
"scrape:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"@aeye/
|
|
55
|
-
"@aeye/
|
|
56
|
-
"@aeye/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"@types/node": "^20.12.7",
|
|
61
|
-
"axios": "^1.7.2",
|
|
62
|
-
"openapi-typescript": "^7.10.1",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@aeye/models",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Static model information scraped from OpenAI, OpenRouter, Replicate, and AWS Bedrock",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/src/index.d.ts",
|
|
12
|
+
"default": "./dist/src/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/src/index.d.ts",
|
|
16
|
+
"default": "./dist/src/index.js"
|
|
17
|
+
},
|
|
18
|
+
"default": "./dist/src/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
25
|
+
"scrape": "tsx scripts/scrape.ts",
|
|
26
|
+
"scrape:auto": "tsx scripts/scrape.ts --sources=openrouter,openai,aws --metrics",
|
|
27
|
+
"scrape:openrouter": "tsx scripts/scrapers/openrouter.ts",
|
|
28
|
+
"scrape:openrouter:full": "tsx scripts/scrapers/openrouter.ts --metrics",
|
|
29
|
+
"scrape:openai": "tsx scripts/scrapers/openai.ts",
|
|
30
|
+
"scrape:replicate": "tsx scripts/scrapers/replicate.ts",
|
|
31
|
+
"scrape:replicate:test": "tsx scripts/scrapers/replicate.ts --transformers --transformers-only --models=\"adirik/kosmos-g\"",
|
|
32
|
+
"scrape:replicate:chunk": "tsx scripts/scrapers/replicate.ts --transformers --transformers-only --transformer-model=\"google/gemini-3-pro-preview\" --n=50 --transform-concurrency=0",
|
|
33
|
+
"scrape:replicate:models": "tsx scripts/scrapers/replicate.ts --transformers-only",
|
|
34
|
+
"scrape:replicate:patch": "tsx scripts/patch-modelinfo.ts",
|
|
35
|
+
"scrape:aws": "tsx scripts/scrapers/aws.ts"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"ai",
|
|
39
|
+
"models",
|
|
40
|
+
"openai",
|
|
41
|
+
"openrouter",
|
|
42
|
+
"replicate",
|
|
43
|
+
"aws",
|
|
44
|
+
"bedrock"
|
|
45
|
+
],
|
|
46
|
+
"author": "ClickerMonkey",
|
|
47
|
+
"license": "GPL-3.0",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/ClickerMonkey/aeye.git",
|
|
51
|
+
"directory": "packages/models"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@aeye/ai": "0.4.0",
|
|
55
|
+
"@aeye/aws": "0.4.0",
|
|
56
|
+
"@aeye/openrouter": "0.5.0",
|
|
57
|
+
"@aeye/replicate": "0.4.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^20.12.7",
|
|
61
|
+
"axios": "^1.7.2",
|
|
62
|
+
"openapi-typescript": "^7.10.1",
|
|
63
|
+
"replicate": "^0.34.1",
|
|
64
|
+
"tsconfig-paths": "^4.2.0",
|
|
65
|
+
"tsx": "^4.7.0",
|
|
66
|
+
"typescript": "^5.9.3"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=16.0.0"
|
|
73
|
+
},
|
|
74
|
+
"homepage": "https://github.com/ClickerMonkey/aeye#readme",
|
|
75
|
+
"bugs": {
|
|
76
|
+
"url": "https://github.com/ClickerMonkey/aeye/issues"
|
|
77
|
+
}
|
|
78
|
+
}
|
package/scripts/codegen.ts
CHANGED
|
@@ -6,8 +6,11 @@ import * as fs from 'fs/promises';
|
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import type { ModelInfo, ModelParameter } from '@aeye/ai';
|
|
8
8
|
|
|
9
|
-
export const stringify = (x: any, space?: number | string | undefined) =>
|
|
10
|
-
|
|
9
|
+
export const stringify = (x: any, space?: number | string | undefined) =>
|
|
10
|
+
// Drop `null` and non-finite numbers (NaN/Infinity) anywhere in the object so a
|
|
11
|
+
// stray scraped value can't emit an un-typecheckable field (e.g. `metrics: {
|
|
12
|
+
// timeToFirstToken: null }` against `number | undefined`).
|
|
13
|
+
(JSON.stringify(x, (_k, v) => (v === null || (typeof v === 'number' && !Number.isFinite(v)) ? undefined : v), space) || '')
|
|
11
14
|
.replace(/"([^"]+)":/g, '$1:')
|
|
12
15
|
.replace(/\n/g, '\n ')
|
|
13
16
|
.trim() || undefined;
|
|
@@ -24,6 +27,8 @@ export const stringifyModel = (m: ModelInfo) => {
|
|
|
24
27
|
[m.capabilities, `capabilities: new Set([${Array.from(m.capabilities).map(c => `'${c}'`).join(', ')}])`],
|
|
25
28
|
[m.supportedParameters?.size || (m.supportedParameters as any)?.length, `supportedParameters: new Set([${Array.from(m.supportedParameters || []).map(p => `'${p}'`).join(', ')}])`],
|
|
26
29
|
[m.pricing || {}, `pricing: ${stringify(m.pricing, 2)}`],
|
|
30
|
+
[m.reasoningEfforts?.length, `reasoningEfforts: [${(m.reasoningEfforts ?? []).map(e => `'${e}'`).join(', ')}]`],
|
|
31
|
+
[m.retiresAt, `retiresAt: '${m.retiresAt}'`],
|
|
27
32
|
[m.metrics, `metrics: ${stringify(m.metrics, 2)}`],
|
|
28
33
|
[m.metadata, `metadata: ${stringify(m.metadata, 2)}`],
|
|
29
34
|
];
|
|
@@ -69,6 +74,14 @@ export async function writeModelTS(
|
|
|
69
74
|
await fs.writeFile(outputPath, content, 'utf-8');
|
|
70
75
|
}
|
|
71
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Write model data as JSON for reference, sets as arrays
|
|
79
|
+
*/
|
|
80
|
+
export async function writeModelJSON(models: ModelInfo[], outputPath: string): Promise<void> {
|
|
81
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
82
|
+
await fs.writeFile(outputPath, JSON.stringify(models, (_key, value) => value instanceof Set ? Array.from(value) : value, 2));
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
/**
|
|
73
86
|
* Generate the models/index.ts file that aggregates all provider models
|
|
74
87
|
*/
|
|
@@ -114,5 +127,7 @@ export function generateMainIndexTS(): string {
|
|
|
114
127
|
|
|
115
128
|
export { models, openaiModels, openrouterModels, replicateModels, awsModels } from './models';
|
|
116
129
|
export { transformers } from './transformers';
|
|
130
|
+
export { replicateTransformers } from './transformers/replicate';
|
|
131
|
+
export { strictSupport } from './strict-support';
|
|
117
132
|
`;
|
|
118
133
|
}
|
package/scripts/scrape.ts
CHANGED
|
@@ -6,16 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
import * as fs from 'fs/promises';
|
|
8
8
|
import * as path from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
9
10
|
import { scrapeOpenAI } from './scrapers/openai';
|
|
10
11
|
import { scrapeOpenRouter } from './scrapers/openrouter';
|
|
11
12
|
import { scrapeReplicate } from './scrapers/replicate';
|
|
12
13
|
import { scrapeAWS } from './scrapers/aws';
|
|
13
14
|
import { generateModelsIndexTS, generateMainIndexTS } from './codegen';
|
|
14
15
|
|
|
16
|
+
type Source = 'openai' | 'openrouter' | 'replicate' | 'aws';
|
|
17
|
+
|
|
18
|
+
const SOURCES: Source[] = ['openai', 'openrouter', 'replicate', 'aws'];
|
|
19
|
+
|
|
20
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
|
|
15
22
|
interface ScraperOptions {
|
|
16
23
|
outputDir?: string;
|
|
17
24
|
cacheDir?: string;
|
|
18
|
-
sources?:
|
|
25
|
+
sources?: Source[];
|
|
19
26
|
concurrency?: number;
|
|
20
27
|
scrapeMetrics?: boolean;
|
|
21
28
|
awsRegion?: string;
|
|
@@ -27,7 +34,7 @@ interface ScraperOptions {
|
|
|
27
34
|
export async function scrapeAllModels(options: ScraperOptions = {}): Promise<void> {
|
|
28
35
|
const outputDir = options.outputDir || path.join(__dirname, '../data');
|
|
29
36
|
const cacheDir = options.cacheDir || path.join(__dirname, '../cache');
|
|
30
|
-
const sources = options.sources ||
|
|
37
|
+
const sources = options.sources || SOURCES;
|
|
31
38
|
const concurrency = options.concurrency || 5;
|
|
32
39
|
const scrapeMetrics = options.scrapeMetrics || false;
|
|
33
40
|
const awsRegion = options.awsRegion;
|
|
@@ -114,7 +121,8 @@ export async function scrapeAllModels(options: ScraperOptions = {}): Promise<voi
|
|
|
114
121
|
|
|
115
122
|
console.log(`\n${successCount}/${totalCount} sources completed successfully\n`);
|
|
116
123
|
|
|
117
|
-
|
|
124
|
+
// Any failed source fails the run; the sources that succeeded still regenerate
|
|
125
|
+
if (successCount < totalCount) {
|
|
118
126
|
process.exitCode = 1;
|
|
119
127
|
}
|
|
120
128
|
|
|
@@ -145,7 +153,7 @@ export async function scrapeAllModels(options: ScraperOptions = {}): Promise<voi
|
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
// CLI execution
|
|
148
|
-
if (
|
|
156
|
+
if (process.argv[1].endsWith('scrape.ts')) {
|
|
149
157
|
const args = process.argv.slice(2);
|
|
150
158
|
|
|
151
159
|
// Parse command line arguments
|
|
@@ -153,7 +161,7 @@ if (require.main === module) {
|
|
|
153
161
|
const cacheDir = args.find((arg) => arg.startsWith('--cache='))?.split('=')[1];
|
|
154
162
|
const sourcesArg = args.find((arg) => arg.startsWith('--sources='))?.split('=')[1];
|
|
155
163
|
const sources = sourcesArg
|
|
156
|
-
?
|
|
164
|
+
? sourcesArg.split(',').flatMap((name) => SOURCES.filter((source) => source === name))
|
|
157
165
|
: undefined;
|
|
158
166
|
|
|
159
167
|
const concurrencyArg = args.find((arg) => arg.startsWith('--concurrency='));
|