@aexol/spectral 0.7.1 → 0.7.5
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/CHANGELOG.md +5 -0
- package/dist/agent/agents.js +1 -1
- package/dist/agent/index.js +199 -184
- package/dist/commands/serve.js +0 -3
- package/dist/designer/data/systems/renault/DESIGN.md +1 -1
- package/dist/designer/philosophies.js +668 -0
- package/dist/mcp/sampling-handler.js +1 -1
- package/dist/memory/commands/status.js +1 -1
- package/dist/memory/compaction.js +2 -2
- package/dist/memory/config.js +1 -1
- package/dist/memory/debug-log.js +1 -1
- package/dist/memory/hooks/compaction-hook.js +29 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/observer.js +2 -2
- package/dist/memory/project-observations-store.js +14 -0
- package/dist/memory/tokens.js +1 -1
- package/dist/memory/tools/read-project-observations.js +82 -0
- package/dist/memory/tools/recall-observation.js +2 -2
- package/dist/pi/agent-core/agent-loop.js +501 -0
- package/dist/pi/agent-core/agent.js +401 -0
- package/dist/pi/agent-core/harness/agent-harness.js +899 -0
- package/dist/pi/agent-core/harness/compaction/branch-summarization.js +173 -0
- package/dist/pi/agent-core/harness/compaction/compaction.js +532 -0
- package/dist/pi/agent-core/harness/compaction/utils.js +130 -0
- package/dist/pi/agent-core/harness/env/nodejs.js +485 -0
- package/dist/pi/agent-core/harness/messages.js +101 -0
- package/dist/pi/agent-core/harness/prompt-templates.js +229 -0
- package/dist/pi/agent-core/harness/session/jsonl-repo.js +100 -0
- package/dist/pi/agent-core/harness/session/jsonl-storage.js +230 -0
- package/dist/pi/agent-core/harness/session/memory-repo.js +41 -0
- package/dist/pi/agent-core/harness/session/memory-storage.js +113 -0
- package/dist/pi/agent-core/harness/session/repo-utils.js +38 -0
- package/dist/pi/agent-core/harness/session/session.js +196 -0
- package/dist/pi/agent-core/harness/session/uuid.js +49 -0
- package/dist/pi/agent-core/harness/skills.js +310 -0
- package/dist/pi/agent-core/harness/system-prompt.js +29 -0
- package/dist/pi/agent-core/harness/types.js +93 -0
- package/dist/pi/agent-core/harness/utils/shell-output.js +125 -0
- package/dist/pi/agent-core/harness/utils/truncate.js +289 -0
- package/dist/pi/agent-core/index.js +24 -0
- package/dist/pi/agent-core/node.js +2 -0
- package/dist/pi/agent-core/proxy.js +277 -0
- package/dist/pi/agent-core/types.js +1 -0
- package/dist/pi/ai/api-registry.js +43 -0
- package/dist/pi/ai/cli.js +120 -0
- package/dist/pi/ai/env-api-keys.js +169 -0
- package/dist/pi/ai/image-models.generated.js +441 -0
- package/dist/pi/ai/image-models.js +22 -0
- package/dist/pi/ai/images-api-registry.js +21 -0
- package/dist/pi/ai/images.js +13 -0
- package/dist/pi/ai/index.js +18 -0
- package/dist/pi/ai/models.generated.js +16220 -0
- package/dist/pi/ai/models.js +70 -0
- package/dist/pi/ai/oauth.js +1 -0
- package/dist/pi/ai/providers/anthropic.js +945 -0
- package/dist/pi/ai/providers/faux.js +367 -0
- package/dist/pi/ai/providers/github-copilot-headers.js +28 -0
- package/dist/pi/ai/providers/openai-completions.js +945 -0
- package/dist/pi/ai/providers/openai-prompt-cache.js +9 -0
- package/dist/pi/ai/providers/register-builtins.js +97 -0
- package/dist/pi/ai/providers/simple-options.js +40 -0
- package/dist/pi/ai/providers/transform-messages.js +183 -0
- package/dist/pi/ai/session-resources.js +21 -0
- package/dist/pi/ai/stream.js +26 -0
- package/dist/pi/ai/types.js +1 -0
- package/dist/pi/ai/utils/diagnostics.js +24 -0
- package/dist/pi/ai/utils/event-stream.js +80 -0
- package/dist/pi/ai/utils/hash.js +13 -0
- package/dist/pi/ai/utils/headers.js +7 -0
- package/dist/pi/ai/utils/json-parse.js +112 -0
- package/dist/pi/ai/utils/node-http-proxy.js +96 -0
- package/dist/pi/ai/utils/oauth/anthropic.js +334 -0
- package/dist/pi/ai/utils/oauth/device-code.js +54 -0
- package/dist/pi/ai/utils/oauth/github-copilot.js +270 -0
- package/dist/pi/ai/utils/oauth/index.js +121 -0
- package/dist/pi/ai/utils/oauth/oauth-page.js +104 -0
- package/dist/pi/ai/utils/oauth/openai-codex.js +384 -0
- package/dist/pi/ai/utils/oauth/pkce.js +30 -0
- package/dist/pi/ai/utils/oauth/types.js +1 -0
- package/dist/pi/ai/utils/overflow.js +150 -0
- package/dist/pi/ai/utils/sanitize-unicode.js +25 -0
- package/dist/pi/ai/utils/typebox-helpers.js +20 -0
- package/dist/pi/ai/utils/validation.js +280 -0
- package/dist/pi/coding-agent/bun/cli.js +7 -0
- package/dist/pi/coding-agent/bun/restore-sandbox-env.js +31 -0
- package/dist/pi/coding-agent/cli/args.js +340 -0
- package/dist/pi/coding-agent/cli/file-processor.js +82 -0
- package/dist/pi/coding-agent/cli/initial-message.js +21 -0
- package/dist/pi/coding-agent/cli.js +17 -0
- package/dist/pi/coding-agent/config.js +414 -0
- package/dist/pi/coding-agent/core/agent-session-runtime.js +299 -0
- package/dist/pi/coding-agent/core/agent-session-services.js +117 -0
- package/dist/pi/coding-agent/core/agent-session.js +2498 -0
- package/dist/pi/coding-agent/core/auth-guidance.js +20 -0
- package/dist/pi/coding-agent/core/auth-storage.js +441 -0
- package/dist/pi/coding-agent/core/bash-executor.js +110 -0
- package/dist/pi/coding-agent/core/compaction/branch-summarization.js +242 -0
- package/dist/pi/coding-agent/core/compaction/compaction.js +624 -0
- package/dist/pi/coding-agent/core/compaction/index.js +6 -0
- package/dist/pi/coding-agent/core/compaction/utils.js +152 -0
- package/dist/pi/coding-agent/core/defaults.js +1 -0
- package/dist/pi/coding-agent/core/diagnostics.js +1 -0
- package/dist/pi/coding-agent/core/event-bus.js +24 -0
- package/dist/pi/coding-agent/core/exec.js +74 -0
- package/dist/pi/coding-agent/core/export-html/ansi-to-html.js +248 -0
- package/dist/pi/coding-agent/core/export-html/index.js +225 -0
- package/dist/pi/coding-agent/core/export-html/tool-renderer.js +107 -0
- package/dist/pi/coding-agent/core/extensions/index.js +8 -0
- package/dist/pi/coding-agent/core/extensions/loader.js +485 -0
- package/dist/pi/coding-agent/core/extensions/runner.js +824 -0
- package/dist/pi/coding-agent/core/extensions/types.js +44 -0
- package/dist/pi/coding-agent/core/extensions/wrapper.js +21 -0
- package/dist/pi/coding-agent/core/footer-data-provider.js +309 -0
- package/dist/pi/coding-agent/core/http-dispatcher.js +47 -0
- package/dist/pi/coding-agent/core/index.js +11 -0
- package/dist/pi/coding-agent/core/keybindings.js +294 -0
- package/dist/pi/coding-agent/core/messages.js +122 -0
- package/dist/pi/coding-agent/core/model-registry.js +728 -0
- package/dist/pi/coding-agent/core/model-resolver.js +494 -0
- package/dist/pi/coding-agent/core/output-guard.js +58 -0
- package/dist/pi/coding-agent/core/package-manager.js +2020 -0
- package/dist/pi/coding-agent/core/prompt-templates.js +237 -0
- package/dist/pi/coding-agent/core/provider-display-names.js +32 -0
- package/dist/pi/coding-agent/core/resolve-config-value.js +125 -0
- package/dist/pi/coding-agent/core/resource-loader.js +733 -0
- package/dist/pi/coding-agent/core/sdk.js +282 -0
- package/dist/pi/coding-agent/core/session-cwd.js +37 -0
- package/dist/pi/coding-agent/core/session-manager.js +1146 -0
- package/dist/pi/coding-agent/core/settings-manager.js +794 -0
- package/dist/pi/coding-agent/core/skills.js +386 -0
- package/dist/pi/coding-agent/core/slash-commands.js +24 -0
- package/dist/pi/coding-agent/core/source-info.js +18 -0
- package/dist/pi/coding-agent/core/system-prompt.js +122 -0
- package/dist/pi/coding-agent/core/telemetry.js +8 -0
- package/dist/pi/coding-agent/core/timings.js +30 -0
- package/dist/pi/coding-agent/core/tools/bash.js +341 -0
- package/dist/pi/coding-agent/core/tools/edit-diff.js +344 -0
- package/dist/pi/coding-agent/core/tools/edit.js +324 -0
- package/dist/pi/coding-agent/core/tools/file-mutation-queue.js +36 -0
- package/dist/pi/coding-agent/core/tools/find.js +297 -0
- package/dist/pi/coding-agent/core/tools/grep.js +303 -0
- package/dist/pi/coding-agent/core/tools/index.js +111 -0
- package/dist/pi/coding-agent/core/tools/ls.js +168 -0
- package/dist/pi/coding-agent/core/tools/output-accumulator.js +183 -0
- package/dist/pi/coding-agent/core/tools/path-utils.js +61 -0
- package/dist/pi/coding-agent/core/tools/read.js +288 -0
- package/dist/pi/coding-agent/core/tools/render-utils.js +48 -0
- package/dist/pi/coding-agent/core/tools/tool-definition-wrapper.js +33 -0
- package/dist/pi/coding-agent/core/tools/truncate.js +214 -0
- package/dist/pi/coding-agent/core/tools/write.js +212 -0
- package/dist/pi/coding-agent/index.js +41 -0
- package/dist/pi/coding-agent/main.js +5 -0
- package/dist/pi/coding-agent/migrations.js +280 -0
- package/dist/pi/coding-agent/modes/index.js +7 -0
- package/dist/pi/coding-agent/modes/interactive/components/diff.js +132 -0
- package/dist/pi/coding-agent/modes/interactive/components/keybinding-hints.js +35 -0
- package/dist/pi/coding-agent/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/pi/coding-agent/modes/interactive/interactive-mode.js +3 -0
- package/dist/pi/coding-agent/modes/interactive/theme/theme.js +1023 -0
- package/dist/pi/coding-agent/modes/print-mode.js +130 -0
- package/dist/pi/coding-agent/modes/rpc/jsonl.js +48 -0
- package/dist/pi/coding-agent/modes/rpc/rpc-client.js +409 -0
- package/dist/pi/coding-agent/modes/rpc/rpc-mode.js +600 -0
- package/dist/pi/coding-agent/modes/rpc/rpc-types.js +7 -0
- package/dist/pi/coding-agent/utils/ansi.js +51 -0
- package/dist/pi/coding-agent/utils/changelog.js +86 -0
- package/dist/pi/coding-agent/utils/child-process.js +87 -0
- package/dist/pi/coding-agent/utils/clipboard-image.js +244 -0
- package/dist/pi/coding-agent/utils/clipboard-native.js +13 -0
- package/dist/pi/coding-agent/utils/clipboard.js +116 -0
- package/dist/pi/coding-agent/utils/exif-orientation.js +157 -0
- package/dist/pi/coding-agent/utils/frontmatter.js +25 -0
- package/dist/pi/coding-agent/utils/fs-watch.js +24 -0
- package/dist/pi/coding-agent/utils/git.js +162 -0
- package/dist/pi/coding-agent/utils/html.js +39 -0
- package/dist/pi/coding-agent/utils/image-convert.js +38 -0
- package/dist/pi/coding-agent/utils/image-resize.js +136 -0
- package/dist/pi/coding-agent/utils/mime.js +68 -0
- package/dist/pi/coding-agent/utils/paths.js +91 -0
- package/dist/pi/coding-agent/utils/photon.js +120 -0
- package/dist/pi/coding-agent/utils/pi-user-agent.js +4 -0
- package/dist/pi/coding-agent/utils/shell.js +194 -0
- package/dist/pi/coding-agent/utils/sleep.js +16 -0
- package/dist/pi/coding-agent/utils/syntax-highlight.js +117 -0
- package/dist/pi/coding-agent/utils/tools-manager.js +327 -0
- package/dist/pi/coding-agent/utils/version-check.js +81 -0
- package/dist/pi/coding-agent/utils/windows-self-update.js +76 -0
- package/dist/pi/tui/autocomplete.js +631 -0
- package/dist/pi/tui/components/box.js +103 -0
- package/dist/pi/tui/components/cancellable-loader.js +34 -0
- package/dist/pi/tui/components/editor.js +1915 -0
- package/dist/pi/tui/components/image.js +88 -0
- package/dist/pi/tui/components/input.js +425 -0
- package/dist/pi/tui/components/loader.js +68 -0
- package/dist/pi/tui/components/markdown.js +633 -0
- package/dist/pi/tui/components/select-list.js +158 -0
- package/dist/pi/tui/components/settings-list.js +184 -0
- package/dist/pi/tui/components/spacer.js +22 -0
- package/dist/pi/tui/components/text.js +88 -0
- package/dist/pi/tui/components/truncated-text.js +50 -0
- package/dist/pi/tui/editor-component.js +1 -0
- package/dist/pi/tui/fuzzy.js +109 -0
- package/dist/pi/tui/index.js +31 -0
- package/dist/pi/tui/keybindings.js +173 -0
- package/dist/pi/tui/keys.js +1172 -0
- package/dist/pi/tui/kill-ring.js +43 -0
- package/dist/pi/tui/stdin-buffer.js +360 -0
- package/dist/pi/tui/terminal-image.js +335 -0
- package/dist/pi/tui/terminal.js +324 -0
- package/dist/pi/tui/tui.js +1076 -0
- package/dist/pi/tui/undo-stack.js +24 -0
- package/dist/pi/tui/utils.js +1016 -0
- package/dist/relay/dispatcher.js +30 -0
- package/dist/server/handlers/queue.js +52 -0
- package/dist/server/pi-bridge.js +9 -1
- package/dist/server/session-stream.js +76 -111
- package/dist/server/storage.js +154 -2
- package/dist/server/title-generator.js +14 -153
- package/package.json +24 -6
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
// This file is auto-generated by scripts/generate-image-models.ts
|
|
2
|
+
// Do not edit manually - run 'npm run generate-image-models' to update
|
|
3
|
+
export const IMAGE_MODELS = {
|
|
4
|
+
openrouter: {
|
|
5
|
+
"black-forest-labs/flux.2-flex": {
|
|
6
|
+
id: "black-forest-labs/flux.2-flex",
|
|
7
|
+
name: "Black Forest Labs: FLUX.2 Flex",
|
|
8
|
+
api: "openrouter-images",
|
|
9
|
+
provider: "openrouter",
|
|
10
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
11
|
+
input: ["text", "image"],
|
|
12
|
+
output: ["image"],
|
|
13
|
+
cost: {
|
|
14
|
+
input: 0,
|
|
15
|
+
output: 0,
|
|
16
|
+
cacheRead: 0,
|
|
17
|
+
cacheWrite: 0,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
"black-forest-labs/flux.2-klein-4b": {
|
|
21
|
+
id: "black-forest-labs/flux.2-klein-4b",
|
|
22
|
+
name: "Black Forest Labs: FLUX.2 Klein 4B",
|
|
23
|
+
api: "openrouter-images",
|
|
24
|
+
provider: "openrouter",
|
|
25
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
26
|
+
input: ["text", "image"],
|
|
27
|
+
output: ["image"],
|
|
28
|
+
cost: {
|
|
29
|
+
input: 0,
|
|
30
|
+
output: 0,
|
|
31
|
+
cacheRead: 0,
|
|
32
|
+
cacheWrite: 0,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
"black-forest-labs/flux.2-max": {
|
|
36
|
+
id: "black-forest-labs/flux.2-max",
|
|
37
|
+
name: "Black Forest Labs: FLUX.2 Max",
|
|
38
|
+
api: "openrouter-images",
|
|
39
|
+
provider: "openrouter",
|
|
40
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
41
|
+
input: ["text", "image"],
|
|
42
|
+
output: ["image"],
|
|
43
|
+
cost: {
|
|
44
|
+
input: 0,
|
|
45
|
+
output: 0,
|
|
46
|
+
cacheRead: 0,
|
|
47
|
+
cacheWrite: 0,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
"black-forest-labs/flux.2-pro": {
|
|
51
|
+
id: "black-forest-labs/flux.2-pro",
|
|
52
|
+
name: "Black Forest Labs: FLUX.2 Pro",
|
|
53
|
+
api: "openrouter-images",
|
|
54
|
+
provider: "openrouter",
|
|
55
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
56
|
+
input: ["text", "image"],
|
|
57
|
+
output: ["image"],
|
|
58
|
+
cost: {
|
|
59
|
+
input: 0,
|
|
60
|
+
output: 0,
|
|
61
|
+
cacheRead: 0,
|
|
62
|
+
cacheWrite: 0,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
"bytedance-seed/seedream-4.5": {
|
|
66
|
+
id: "bytedance-seed/seedream-4.5",
|
|
67
|
+
name: "ByteDance Seed: Seedream 4.5",
|
|
68
|
+
api: "openrouter-images",
|
|
69
|
+
provider: "openrouter",
|
|
70
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
71
|
+
input: ["image", "text"],
|
|
72
|
+
output: ["image"],
|
|
73
|
+
cost: {
|
|
74
|
+
input: 0,
|
|
75
|
+
output: 0,
|
|
76
|
+
cacheRead: 0,
|
|
77
|
+
cacheWrite: 0,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
"google/gemini-2.5-flash-image": {
|
|
81
|
+
id: "google/gemini-2.5-flash-image",
|
|
82
|
+
name: "Google: Nano Banana (Gemini 2.5 Flash Image)",
|
|
83
|
+
api: "openrouter-images",
|
|
84
|
+
provider: "openrouter",
|
|
85
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
86
|
+
input: ["image", "text"],
|
|
87
|
+
output: ["image", "text"],
|
|
88
|
+
cost: {
|
|
89
|
+
input: 0.3,
|
|
90
|
+
output: 2.5,
|
|
91
|
+
cacheRead: 0.03,
|
|
92
|
+
cacheWrite: 0.08333333333333334,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
"google/gemini-3-pro-image-preview": {
|
|
96
|
+
id: "google/gemini-3-pro-image-preview",
|
|
97
|
+
name: "Google: Nano Banana Pro (Gemini 3 Pro Image Preview)",
|
|
98
|
+
api: "openrouter-images",
|
|
99
|
+
provider: "openrouter",
|
|
100
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
101
|
+
input: ["image", "text"],
|
|
102
|
+
output: ["image", "text"],
|
|
103
|
+
cost: {
|
|
104
|
+
input: 2,
|
|
105
|
+
output: 12,
|
|
106
|
+
cacheRead: 0.19999999999999998,
|
|
107
|
+
cacheWrite: 0.375,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
"google/gemini-3.1-flash-image-preview": {
|
|
111
|
+
id: "google/gemini-3.1-flash-image-preview",
|
|
112
|
+
name: "Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)",
|
|
113
|
+
api: "openrouter-images",
|
|
114
|
+
provider: "openrouter",
|
|
115
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
116
|
+
input: ["image", "text"],
|
|
117
|
+
output: ["image", "text"],
|
|
118
|
+
cost: {
|
|
119
|
+
input: 0.5,
|
|
120
|
+
output: 3,
|
|
121
|
+
cacheRead: 0,
|
|
122
|
+
cacheWrite: 0,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
"openai/gpt-5-image": {
|
|
126
|
+
id: "openai/gpt-5-image",
|
|
127
|
+
name: "OpenAI: GPT-5 Image",
|
|
128
|
+
api: "openrouter-images",
|
|
129
|
+
provider: "openrouter",
|
|
130
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
131
|
+
input: ["image", "text"],
|
|
132
|
+
output: ["image", "text"],
|
|
133
|
+
cost: {
|
|
134
|
+
input: 10,
|
|
135
|
+
output: 10,
|
|
136
|
+
cacheRead: 1.25,
|
|
137
|
+
cacheWrite: 0,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
"openai/gpt-5-image-mini": {
|
|
141
|
+
id: "openai/gpt-5-image-mini",
|
|
142
|
+
name: "OpenAI: GPT-5 Image Mini",
|
|
143
|
+
api: "openrouter-images",
|
|
144
|
+
provider: "openrouter",
|
|
145
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
146
|
+
input: ["image", "text"],
|
|
147
|
+
output: ["image", "text"],
|
|
148
|
+
cost: {
|
|
149
|
+
input: 2.5,
|
|
150
|
+
output: 2,
|
|
151
|
+
cacheRead: 0.25,
|
|
152
|
+
cacheWrite: 0,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
"openai/gpt-5.4-image-2": {
|
|
156
|
+
id: "openai/gpt-5.4-image-2",
|
|
157
|
+
name: "OpenAI: GPT-5.4 Image 2",
|
|
158
|
+
api: "openrouter-images",
|
|
159
|
+
provider: "openrouter",
|
|
160
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
161
|
+
input: ["image", "text"],
|
|
162
|
+
output: ["image", "text"],
|
|
163
|
+
cost: {
|
|
164
|
+
input: 8,
|
|
165
|
+
output: 15,
|
|
166
|
+
cacheRead: 2,
|
|
167
|
+
cacheWrite: 0,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
"openrouter/auto": {
|
|
171
|
+
id: "openrouter/auto",
|
|
172
|
+
name: "Auto Router",
|
|
173
|
+
api: "openrouter-images",
|
|
174
|
+
provider: "openrouter",
|
|
175
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
176
|
+
input: ["text", "image"],
|
|
177
|
+
output: ["text", "image"],
|
|
178
|
+
cost: {
|
|
179
|
+
input: -1000000,
|
|
180
|
+
output: -1000000,
|
|
181
|
+
cacheRead: 0,
|
|
182
|
+
cacheWrite: 0,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
"recraft/recraft-v3": {
|
|
186
|
+
id: "recraft/recraft-v3",
|
|
187
|
+
name: "Recraft: Recraft V3",
|
|
188
|
+
api: "openrouter-images",
|
|
189
|
+
provider: "openrouter",
|
|
190
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
191
|
+
input: ["text", "image"],
|
|
192
|
+
output: ["image"],
|
|
193
|
+
cost: {
|
|
194
|
+
input: 0,
|
|
195
|
+
output: 0,
|
|
196
|
+
cacheRead: 0,
|
|
197
|
+
cacheWrite: 0,
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
"recraft/recraft-v4": {
|
|
201
|
+
id: "recraft/recraft-v4",
|
|
202
|
+
name: "Recraft: Recraft V4",
|
|
203
|
+
api: "openrouter-images",
|
|
204
|
+
provider: "openrouter",
|
|
205
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
206
|
+
input: ["text", "image"],
|
|
207
|
+
output: ["image"],
|
|
208
|
+
cost: {
|
|
209
|
+
input: 0,
|
|
210
|
+
output: 0,
|
|
211
|
+
cacheRead: 0,
|
|
212
|
+
cacheWrite: 0,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
"recraft/recraft-v4-pro": {
|
|
216
|
+
id: "recraft/recraft-v4-pro",
|
|
217
|
+
name: "Recraft: Recraft V4 Pro",
|
|
218
|
+
api: "openrouter-images",
|
|
219
|
+
provider: "openrouter",
|
|
220
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
221
|
+
input: ["text", "image"],
|
|
222
|
+
output: ["image"],
|
|
223
|
+
cost: {
|
|
224
|
+
input: 0,
|
|
225
|
+
output: 0,
|
|
226
|
+
cacheRead: 0,
|
|
227
|
+
cacheWrite: 0,
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
"recraft/recraft-v4-pro-vector": {
|
|
231
|
+
id: "recraft/recraft-v4-pro-vector",
|
|
232
|
+
name: "Recraft: Recraft V4 Pro Vector",
|
|
233
|
+
api: "openrouter-images",
|
|
234
|
+
provider: "openrouter",
|
|
235
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
236
|
+
input: ["text", "image"],
|
|
237
|
+
output: ["image"],
|
|
238
|
+
cost: {
|
|
239
|
+
input: 0,
|
|
240
|
+
output: 0,
|
|
241
|
+
cacheRead: 0,
|
|
242
|
+
cacheWrite: 0,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
"recraft/recraft-v4-vector": {
|
|
246
|
+
id: "recraft/recraft-v4-vector",
|
|
247
|
+
name: "Recraft: Recraft V4 Vector",
|
|
248
|
+
api: "openrouter-images",
|
|
249
|
+
provider: "openrouter",
|
|
250
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
251
|
+
input: ["text", "image"],
|
|
252
|
+
output: ["image"],
|
|
253
|
+
cost: {
|
|
254
|
+
input: 0,
|
|
255
|
+
output: 0,
|
|
256
|
+
cacheRead: 0,
|
|
257
|
+
cacheWrite: 0,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
"recraft/recraft-v4.1": {
|
|
261
|
+
id: "recraft/recraft-v4.1",
|
|
262
|
+
name: "Recraft: Recraft V4.1",
|
|
263
|
+
api: "openrouter-images",
|
|
264
|
+
provider: "openrouter",
|
|
265
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
266
|
+
input: ["text", "image"],
|
|
267
|
+
output: ["image"],
|
|
268
|
+
cost: {
|
|
269
|
+
input: 0,
|
|
270
|
+
output: 0,
|
|
271
|
+
cacheRead: 0,
|
|
272
|
+
cacheWrite: 0,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
"recraft/recraft-v4.1-pro": {
|
|
276
|
+
id: "recraft/recraft-v4.1-pro",
|
|
277
|
+
name: "Recraft: Recraft V4.1 Pro",
|
|
278
|
+
api: "openrouter-images",
|
|
279
|
+
provider: "openrouter",
|
|
280
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
281
|
+
input: ["text", "image"],
|
|
282
|
+
output: ["image"],
|
|
283
|
+
cost: {
|
|
284
|
+
input: 0,
|
|
285
|
+
output: 0,
|
|
286
|
+
cacheRead: 0,
|
|
287
|
+
cacheWrite: 0,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
"recraft/recraft-v4.1-pro-vector": {
|
|
291
|
+
id: "recraft/recraft-v4.1-pro-vector",
|
|
292
|
+
name: "Recraft: Recraft V4.1 Pro Vector",
|
|
293
|
+
api: "openrouter-images",
|
|
294
|
+
provider: "openrouter",
|
|
295
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
296
|
+
input: ["text", "image"],
|
|
297
|
+
output: ["image"],
|
|
298
|
+
cost: {
|
|
299
|
+
input: 0,
|
|
300
|
+
output: 0,
|
|
301
|
+
cacheRead: 0,
|
|
302
|
+
cacheWrite: 0,
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
"recraft/recraft-v4.1-utility": {
|
|
306
|
+
id: "recraft/recraft-v4.1-utility",
|
|
307
|
+
name: "Recraft: Recraft V4.1 Utility",
|
|
308
|
+
api: "openrouter-images",
|
|
309
|
+
provider: "openrouter",
|
|
310
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
311
|
+
input: ["text", "image"],
|
|
312
|
+
output: ["image"],
|
|
313
|
+
cost: {
|
|
314
|
+
input: 0,
|
|
315
|
+
output: 0,
|
|
316
|
+
cacheRead: 0,
|
|
317
|
+
cacheWrite: 0,
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
"recraft/recraft-v4.1-utility-pro": {
|
|
321
|
+
id: "recraft/recraft-v4.1-utility-pro",
|
|
322
|
+
name: "Recraft: Recraft V4.1 Utility Pro",
|
|
323
|
+
api: "openrouter-images",
|
|
324
|
+
provider: "openrouter",
|
|
325
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
326
|
+
input: ["text", "image"],
|
|
327
|
+
output: ["image"],
|
|
328
|
+
cost: {
|
|
329
|
+
input: 0,
|
|
330
|
+
output: 0,
|
|
331
|
+
cacheRead: 0,
|
|
332
|
+
cacheWrite: 0,
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
"recraft/recraft-v4.1-vector": {
|
|
336
|
+
id: "recraft/recraft-v4.1-vector",
|
|
337
|
+
name: "Recraft: Recraft V4.1 Vector",
|
|
338
|
+
api: "openrouter-images",
|
|
339
|
+
provider: "openrouter",
|
|
340
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
341
|
+
input: ["text", "image"],
|
|
342
|
+
output: ["image"],
|
|
343
|
+
cost: {
|
|
344
|
+
input: 0,
|
|
345
|
+
output: 0,
|
|
346
|
+
cacheRead: 0,
|
|
347
|
+
cacheWrite: 0,
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
"sourceful/riverflow-v2-fast": {
|
|
351
|
+
id: "sourceful/riverflow-v2-fast",
|
|
352
|
+
name: "Sourceful: Riverflow V2 Fast",
|
|
353
|
+
api: "openrouter-images",
|
|
354
|
+
provider: "openrouter",
|
|
355
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
356
|
+
input: ["text", "image"],
|
|
357
|
+
output: ["image"],
|
|
358
|
+
cost: {
|
|
359
|
+
input: 0,
|
|
360
|
+
output: 0,
|
|
361
|
+
cacheRead: 0,
|
|
362
|
+
cacheWrite: 0,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
"sourceful/riverflow-v2-fast-preview": {
|
|
366
|
+
id: "sourceful/riverflow-v2-fast-preview",
|
|
367
|
+
name: "Sourceful: Riverflow V2 Fast Preview",
|
|
368
|
+
api: "openrouter-images",
|
|
369
|
+
provider: "openrouter",
|
|
370
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
371
|
+
input: ["text", "image"],
|
|
372
|
+
output: ["image"],
|
|
373
|
+
cost: {
|
|
374
|
+
input: 0,
|
|
375
|
+
output: 0,
|
|
376
|
+
cacheRead: 0,
|
|
377
|
+
cacheWrite: 0,
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
"sourceful/riverflow-v2-max-preview": {
|
|
381
|
+
id: "sourceful/riverflow-v2-max-preview",
|
|
382
|
+
name: "Sourceful: Riverflow V2 Max Preview",
|
|
383
|
+
api: "openrouter-images",
|
|
384
|
+
provider: "openrouter",
|
|
385
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
386
|
+
input: ["text", "image"],
|
|
387
|
+
output: ["image"],
|
|
388
|
+
cost: {
|
|
389
|
+
input: 0,
|
|
390
|
+
output: 0,
|
|
391
|
+
cacheRead: 0,
|
|
392
|
+
cacheWrite: 0,
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
"sourceful/riverflow-v2-pro": {
|
|
396
|
+
id: "sourceful/riverflow-v2-pro",
|
|
397
|
+
name: "Sourceful: Riverflow V2 Pro",
|
|
398
|
+
api: "openrouter-images",
|
|
399
|
+
provider: "openrouter",
|
|
400
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
401
|
+
input: ["text", "image"],
|
|
402
|
+
output: ["image"],
|
|
403
|
+
cost: {
|
|
404
|
+
input: 0,
|
|
405
|
+
output: 0,
|
|
406
|
+
cacheRead: 0,
|
|
407
|
+
cacheWrite: 0,
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
"sourceful/riverflow-v2-standard-preview": {
|
|
411
|
+
id: "sourceful/riverflow-v2-standard-preview",
|
|
412
|
+
name: "Sourceful: Riverflow V2 Standard Preview",
|
|
413
|
+
api: "openrouter-images",
|
|
414
|
+
provider: "openrouter",
|
|
415
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
416
|
+
input: ["text", "image"],
|
|
417
|
+
output: ["image"],
|
|
418
|
+
cost: {
|
|
419
|
+
input: 0,
|
|
420
|
+
output: 0,
|
|
421
|
+
cacheRead: 0,
|
|
422
|
+
cacheWrite: 0,
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
"x-ai/grok-imagine-image-quality": {
|
|
426
|
+
id: "x-ai/grok-imagine-image-quality",
|
|
427
|
+
name: "xAI: Grok Imagine Image Quality",
|
|
428
|
+
api: "openrouter-images",
|
|
429
|
+
provider: "openrouter",
|
|
430
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
431
|
+
input: ["text", "image"],
|
|
432
|
+
output: ["image"],
|
|
433
|
+
cost: {
|
|
434
|
+
input: 0,
|
|
435
|
+
output: 0,
|
|
436
|
+
cacheRead: 0,
|
|
437
|
+
cacheWrite: 0,
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
},
|
|
441
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IMAGE_MODELS } from "./image-models.generated.js";
|
|
2
|
+
const imageModelRegistry = new Map();
|
|
3
|
+
for (const [provider, models] of Object.entries(IMAGE_MODELS)) {
|
|
4
|
+
const providerModels = new Map();
|
|
5
|
+
for (const [id, model] of Object.entries(models)) {
|
|
6
|
+
providerModels.set(id, model);
|
|
7
|
+
}
|
|
8
|
+
imageModelRegistry.set(provider, providerModels);
|
|
9
|
+
}
|
|
10
|
+
export function getImageModel(provider, modelId) {
|
|
11
|
+
const providerModels = imageModelRegistry.get(provider);
|
|
12
|
+
return providerModels?.get(modelId);
|
|
13
|
+
}
|
|
14
|
+
export function getImageProviders() {
|
|
15
|
+
return Array.from(imageModelRegistry.keys());
|
|
16
|
+
}
|
|
17
|
+
export function getImageModels(provider) {
|
|
18
|
+
const models = imageModelRegistry.get(provider);
|
|
19
|
+
return models
|
|
20
|
+
? Array.from(models.values())
|
|
21
|
+
: [];
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const imagesApiProviderRegistry = new Map();
|
|
2
|
+
function wrapGenerateImages(api, generateImages) {
|
|
3
|
+
return (model, context, options) => {
|
|
4
|
+
if (model.api !== api) {
|
|
5
|
+
throw new Error(`Mismatched api: ${model.api} expected ${api}`);
|
|
6
|
+
}
|
|
7
|
+
return generateImages(model, context, options);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function registerImagesApiProvider(provider, sourceId) {
|
|
11
|
+
imagesApiProviderRegistry.set(provider.api, {
|
|
12
|
+
provider: {
|
|
13
|
+
api: provider.api,
|
|
14
|
+
generateImages: wrapGenerateImages(provider.api, provider.generateImages),
|
|
15
|
+
},
|
|
16
|
+
sourceId,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function getImagesApiProvider(api) {
|
|
20
|
+
return imagesApiProviderRegistry.get(api)?.provider;
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "./providers/register-builtins.js";
|
|
2
|
+
import { getImagesApiProvider } from "./images-api-registry.js";
|
|
3
|
+
function resolveImagesApiProvider(api) {
|
|
4
|
+
const provider = getImagesApiProvider(api);
|
|
5
|
+
if (!provider) {
|
|
6
|
+
throw new Error(`No API provider registered for api: ${api}`);
|
|
7
|
+
}
|
|
8
|
+
return provider;
|
|
9
|
+
}
|
|
10
|
+
export async function generateImages(model, context, options) {
|
|
11
|
+
const provider = resolveImagesApiProvider(model.api);
|
|
12
|
+
return provider.generateImages(model, context, options);
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { Type } from "typebox";
|
|
2
|
+
export * from "./api-registry.js";
|
|
3
|
+
export * from "./env-api-keys.js";
|
|
4
|
+
export * from "./image-models.js";
|
|
5
|
+
export * from "./images.js";
|
|
6
|
+
export * from "./images-api-registry.js";
|
|
7
|
+
export * from "./models.js";
|
|
8
|
+
export * from "./providers/faux.js";
|
|
9
|
+
export * from "./providers/register-builtins.js";
|
|
10
|
+
export * from "./session-resources.js";
|
|
11
|
+
export * from "./stream.js";
|
|
12
|
+
export * from "./types.js";
|
|
13
|
+
export * from "./utils/diagnostics.js";
|
|
14
|
+
export * from "./utils/event-stream.js";
|
|
15
|
+
export * from "./utils/json-parse.js";
|
|
16
|
+
export * from "./utils/overflow.js";
|
|
17
|
+
export * from "./utils/typebox-helpers.js";
|
|
18
|
+
export * from "./utils/validation.js";
|