@j-o-r/hello-dave 0.0.10 → 0.1.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/README.md +2 -0
- package/README.md.bak.1779452127 +240 -0
- package/TODO.md +30 -8
- package/agents/code_agent.js +6 -6
- package/agents/daisy_agent.js +10 -7
- package/agents/minimax.js +173 -0
- package/agents/stability.js +173 -0
- package/bin/codeDave +1 -1
- package/bin/dave.js +1 -1
- package/docs/music-toolsets.md +137 -0
- package/docs/plans/minimax-music-generation.md +80 -0
- package/docs/plans/unified-agent-architecture.md +146 -0
- package/docs/plans/websocket-streaming-plan.md.bak +317 -0
- package/docs/prompt/task_clarification_and_documentation.md +35 -0
- package/lib/API/minimax/ImageToolset.js +169 -0
- package/lib/API/minimax/MusicToolset.js +290 -0
- package/lib/API/minimax/VideoToolset.js +296 -0
- package/lib/API/minimax/image.generation.md +239 -0
- package/lib/API/minimax/image.js +219 -0
- package/lib/API/minimax/image.to.image.md +257 -0
- package/lib/API/minimax/index.js +16 -0
- package/lib/API/minimax/music.cover.preprocess.md +206 -0
- package/lib/API/minimax/music.generation.md +346 -0
- package/lib/API/minimax/music.js +257 -0
- package/lib/API/minimax/music.lyrics.generation.md +205 -0
- package/lib/API/minimax/video.download.md +133 -0
- package/lib/API/minimax/video.first.last.image.md +186 -0
- package/lib/API/minimax/video.from.image.md +206 -0
- package/lib/API/minimax/video.from.subject.md +164 -0
- package/lib/API/minimax/video.generation.md +192 -0
- package/lib/API/minimax/video.js +339 -0
- package/lib/API/minimax/video.query.md +128 -0
- package/lib/API/stability.ai/ImageToolset.js +357 -0
- package/lib/API/stability.ai/MusicToolset.js +302 -0
- package/lib/API/stability.ai/audio-3.md +205 -0
- package/lib/API/stability.ai/audio.js +679 -0
- package/lib/API/stability.ai/image.js +911 -0
- package/lib/API/stability.ai/image.md +271 -0
- package/lib/API/stability.ai/index.js +11 -0
- package/lib/API/stability.ai/openapi.json +17118 -0
- package/lib/API/x.ai/ImageToolset.js +165 -0
- package/lib/API/x.ai/image.editing.md +86 -0
- package/lib/API/x.ai/image.js +393 -0
- package/lib/API/x.ai/image.md +213 -0
- package/lib/API/x.ai/image.to.generation.md +494 -0
- package/lib/API/x.ai/image.to.video.md +23 -0
- package/lib/API/x.ai/index.js +9 -0
- package/lib/AgentManager.js +1 -1
- package/lib/CdnToolset.js +191 -0
- package/lib/ToolSet.js +19 -1
- package/lib/cdn.js +373 -0
- package/lib/fafs.js +3 -1
- package/lib/genericToolset.js +43 -166
- package/lib/index.js +9 -1
- package/package.json +2 -2
- package/types/API/minimax/ImageToolset.d.ts +3 -0
- package/types/API/minimax/MusicToolset.d.ts +3 -0
- package/types/API/minimax/VideoToolset.d.ts +3 -0
- package/types/API/minimax/image.d.ts +109 -0
- package/types/API/minimax/index.d.ts +15 -0
- package/types/API/minimax/music.d.ts +46 -0
- package/types/API/minimax/video.d.ts +165 -0
- package/types/API/stability.ai/ImageToolset.d.ts +3 -0
- package/types/API/stability.ai/MusicToolset.d.ts +3 -0
- package/types/API/stability.ai/audio.d.ts +193 -0
- package/types/API/stability.ai/image.d.ts +274 -0
- package/types/API/stability.ai/index.d.ts +11 -0
- package/types/API/x.ai/ImageToolset.d.ts +3 -0
- package/types/API/x.ai/image.d.ts +82 -0
- package/types/API/x.ai/index.d.ts +9 -0
- package/types/AgentManager.d.ts +1 -1
- package/types/CdnToolset.d.ts +20 -0
- package/types/ToolSet.d.ts +8 -0
- package/types/cdn.d.ts +141 -0
- package/types/index.d.ts +8 -2
- package/docs/multi-agent-clusters.md.bak +0 -229
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Stable Image API Specifications
|
|
2
|
+
|
|
3
|
+
> Extracted from `lib/API/stability.ai/openapi.json` for Stability AI's Stable Image services (v2beta).
|
|
4
|
+
> This document serves as the source specification for generating the HTTP wrapper `image.js` (modeled after `lib/API/stability.ai/audio.js` and `lib/API/minimax/music.js`).
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Stability AI provides a comprehensive suite of image generation, editing, upscaling, and control tools powered by models like Stable Diffusion 3.5, Stable Image Ultra/Core, and specialized edit/control services.
|
|
9
|
+
|
|
10
|
+
**Key Models & Services**:
|
|
11
|
+
- **Generate**:
|
|
12
|
+
- `stable-image-ultra`: Photorealistic, high-quality (8 credits).
|
|
13
|
+
- `stable-image-core`: Fast & affordable (3 credits).
|
|
14
|
+
- `sd3` (Stable Diffusion 3.5): Large, Large Turbo, Medium, Flash variants.
|
|
15
|
+
- **Upscale**:
|
|
16
|
+
- `conservative`: Preserves details, up to 4MP (40 credits).
|
|
17
|
+
- `creative`: Heavy reimagining for degraded images (60 credits, async).
|
|
18
|
+
- `fast`: 4x resolution boost, lightweight (~1s, 2 credits).
|
|
19
|
+
- **Edit**:
|
|
20
|
+
- Erase, Inpaint, Outpaint, Search & Replace, Search & Recolor, Remove Background, Replace Background & Relight.
|
|
21
|
+
- **Control**:
|
|
22
|
+
- Sketch, Structure, Style, Style Transfer.
|
|
23
|
+
- **Results**: Async result fetching for generations that return IDs.
|
|
24
|
+
|
|
25
|
+
- **Base URL**: `https://api.stability.ai`
|
|
26
|
+
- **Authentication**: `Authorization: Bearer sk-...` header.
|
|
27
|
+
- **Common Patterns**:
|
|
28
|
+
- Most endpoints support `multipart/form-data`.
|
|
29
|
+
- `accept: image/*` for binary image response or `application/json` for base64.
|
|
30
|
+
- Many return 200 with image bytes or 202 with `{ "id": "..." }` for async (poll `/v2beta/results/{id}` or specific result endpoints).
|
|
31
|
+
- Credits vary (see individual endpoints).
|
|
32
|
+
- Output formats: `jpeg`, `png` (default), `webp`.
|
|
33
|
+
- Max image size: Typically 4,096–9,437,184 pixels total; aspect ratios constrained.
|
|
34
|
+
- Content moderation: 403 responses for flagged content.
|
|
35
|
+
- Rate limit: 150 requests / 10 seconds.
|
|
36
|
+
|
|
37
|
+
**Async Workflow** (for creative upscale, replace-background-and-relight, some generations):
|
|
38
|
+
1. POST → 202 with `id`.
|
|
39
|
+
2. Poll `GET /v2beta/results/{id}` (or specific result path) with `accept: image/*`.
|
|
40
|
+
3. 200 = ready (binary or JSON); 202 = in-progress.
|
|
41
|
+
|
|
42
|
+
**Notes**:
|
|
43
|
+
- English prompts preferred; copyrighted/public figure content may be rejected.
|
|
44
|
+
- See official docs: [Stability Platform API](https://platform.stability.ai/docs).
|
|
45
|
+
|
|
46
|
+
## Endpoints
|
|
47
|
+
|
|
48
|
+
### Generate
|
|
49
|
+
|
|
50
|
+
#### 1. Stable Image Ultra
|
|
51
|
+
**POST** `/v2beta/stable-image/generate/ultra`
|
|
52
|
+
|
|
53
|
+
Highest quality photorealistic generation.
|
|
54
|
+
|
|
55
|
+
**Request**:
|
|
56
|
+
- `multipart/form-data`
|
|
57
|
+
- Required: `prompt`
|
|
58
|
+
- Optional: `negative_prompt`, `aspect_ratio` (default 1:1), `seed`, `output_format`, `image` + `strength` (for img2img), `style_preset`
|
|
59
|
+
|
|
60
|
+
**Responses**:
|
|
61
|
+
- 200: Image bytes or JSON `{ "image": "base64...", "seed", "finish_reason" }`
|
|
62
|
+
- Errors: 400/422/403/429/500
|
|
63
|
+
|
|
64
|
+
#### 2. Stable Image Core
|
|
65
|
+
**POST** `/v2beta/stable-image/generate/core`
|
|
66
|
+
|
|
67
|
+
Fast, affordable generation.
|
|
68
|
+
|
|
69
|
+
Similar params to Ultra (no `image`/`strength` by default).
|
|
70
|
+
|
|
71
|
+
#### 3. Stable Diffusion 3.5
|
|
72
|
+
**POST** `/v2beta/stable-image/generate/sd3`
|
|
73
|
+
|
|
74
|
+
Supports `sd3.5-large`, `sd3.5-large-turbo`, `sd3.5-medium`, `sd3.5-flash`.
|
|
75
|
+
|
|
76
|
+
- `mode`: `text-to-image` or `image-to-image`
|
|
77
|
+
- For img2img: `image` + `strength` required.
|
|
78
|
+
- `cfg_scale`, `negative_prompt`, `style_preset`, etc.
|
|
79
|
+
|
|
80
|
+
### Upscale
|
|
81
|
+
|
|
82
|
+
#### 1. Conservative Upscale
|
|
83
|
+
**POST** `/v2beta/stable-image/upscale/conservative`
|
|
84
|
+
|
|
85
|
+
Preserves original while upscaling to 4MP.
|
|
86
|
+
|
|
87
|
+
Required: `image`, `prompt`
|
|
88
|
+
Optional: `negative_prompt`, `seed`, `output_format`, `creativity`
|
|
89
|
+
|
|
90
|
+
#### 2. Creative Upscale (async)
|
|
91
|
+
**POST** `/v2beta/stable-image/upscale/creative`
|
|
92
|
+
|
|
93
|
+
For degraded images; returns `id` for polling `/v2beta/stable-image/upscale/creative/result/{id}`.
|
|
94
|
+
|
|
95
|
+
#### 3. Fast Upscale
|
|
96
|
+
**POST** `/v2beta/stable-image/upscale/fast`
|
|
97
|
+
|
|
98
|
+
Quick 4x enhancement.
|
|
99
|
+
|
|
100
|
+
Required: `image`
|
|
101
|
+
Optional: `output_format`
|
|
102
|
+
|
|
103
|
+
### Edit
|
|
104
|
+
|
|
105
|
+
#### Erase
|
|
106
|
+
**POST** `/v2beta/stable-image/edit/erase`
|
|
107
|
+
|
|
108
|
+
Remove objects using mask or alpha channel.
|
|
109
|
+
|
|
110
|
+
Required: `image`
|
|
111
|
+
Optional: `mask`, `grow_mask`, `seed`, `output_format`
|
|
112
|
+
|
|
113
|
+
#### Inpaint
|
|
114
|
+
**POST** `/v2beta/stable-image/edit/inpaint`
|
|
115
|
+
|
|
116
|
+
Fill/replace areas with prompt or search mode.
|
|
117
|
+
|
|
118
|
+
Supports `mode: search` (with `search_prompt`) or `mask`.
|
|
119
|
+
|
|
120
|
+
#### Outpaint
|
|
121
|
+
**POST** `/v2beta/stable-image/edit/outpaint`
|
|
122
|
+
|
|
123
|
+
Expand image in directions (`left`, `right`, `up`, `down` pixels).
|
|
124
|
+
|
|
125
|
+
Required: `image` + at least one direction.
|
|
126
|
+
Optional: `prompt`, `creativity`, `style_preset`
|
|
127
|
+
|
|
128
|
+
#### Search and Replace
|
|
129
|
+
**POST** `/v2beta/stable-image/edit/search-and-replace`
|
|
130
|
+
|
|
131
|
+
Auto-segment and replace object described by `search_prompt`.
|
|
132
|
+
|
|
133
|
+
Required: `image`, `prompt`, `search_prompt`
|
|
134
|
+
|
|
135
|
+
#### Search and Recolor
|
|
136
|
+
**POST** `/v2beta/stable-image/edit/search-and-recolor`
|
|
137
|
+
|
|
138
|
+
Change color of object via `select_prompt`.
|
|
139
|
+
|
|
140
|
+
#### Remove Background
|
|
141
|
+
**POST** `/v2beta/stable-image/edit/remove-background`
|
|
142
|
+
|
|
143
|
+
Segments and removes background.
|
|
144
|
+
|
|
145
|
+
Required: `image`
|
|
146
|
+
Optional: `output_format` (`png`/`webp`)
|
|
147
|
+
|
|
148
|
+
#### Replace Background and Relight (async)
|
|
149
|
+
**POST** `/v2beta/stable-image/edit/replace-background-and-relight`
|
|
150
|
+
|
|
151
|
+
Swap background + adjust lighting.
|
|
152
|
+
|
|
153
|
+
Required: `subject_image`
|
|
154
|
+
Optional: `background_prompt` or `background_reference`, lighting params, etc.
|
|
155
|
+
Returns `id` for polling.
|
|
156
|
+
|
|
157
|
+
### Control
|
|
158
|
+
|
|
159
|
+
#### Sketch
|
|
160
|
+
**POST** `/v2beta/stable-image/control/sketch`
|
|
161
|
+
|
|
162
|
+
Refine sketches or control via edges.
|
|
163
|
+
|
|
164
|
+
Required: `image`, `prompt`
|
|
165
|
+
Optional: `control_strength` (0-1), `negative_prompt`, `style_preset`
|
|
166
|
+
|
|
167
|
+
#### Structure
|
|
168
|
+
**POST** `/v2beta/stable-image/control/structure`
|
|
169
|
+
|
|
170
|
+
Maintain structure of input image.
|
|
171
|
+
|
|
172
|
+
Similar to Sketch.
|
|
173
|
+
|
|
174
|
+
#### Style
|
|
175
|
+
**POST** `/v2beta/stable-image/control/style`
|
|
176
|
+
|
|
177
|
+
Apply style from control image.
|
|
178
|
+
|
|
179
|
+
#### Style Transfer
|
|
180
|
+
**POST** `/v2beta/stable-image/control/style-transfer`
|
|
181
|
+
|
|
182
|
+
Transform content while preserving composition using style image.
|
|
183
|
+
|
|
184
|
+
Required: `init_image`, `style_image`
|
|
185
|
+
|
|
186
|
+
### Results
|
|
187
|
+
|
|
188
|
+
#### Fetch Generation Result
|
|
189
|
+
**GET** `/v2beta/results/{id}`
|
|
190
|
+
|
|
191
|
+
Poll for image results (used by async endpoints).
|
|
192
|
+
|
|
193
|
+
Headers: `accept: image/*` or `application/json`
|
|
194
|
+
|
|
195
|
+
Responses:
|
|
196
|
+
- 200: Image bytes + headers (`finish-reason`, `seed`, `content-type`)
|
|
197
|
+
- 202: `{ "id": "...", "status": "in-progress" }`
|
|
198
|
+
- 404: Expired/not found
|
|
199
|
+
|
|
200
|
+
## Common Error Responses
|
|
201
|
+
|
|
202
|
+
- **400**: Invalid parameters (e.g., missing required fields).
|
|
203
|
+
- **403**: Content moderation flag.
|
|
204
|
+
- **413**: Payload too large (>10MiB).
|
|
205
|
+
- **422**: Rejected (copyright, public figure, language).
|
|
206
|
+
- **429**: Rate limit.
|
|
207
|
+
- **500**: Internal error.
|
|
208
|
+
|
|
209
|
+
Error JSON example:
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"id": "...",
|
|
213
|
+
"name": "bad_request",
|
|
214
|
+
"errors": ["prompt: is required"]
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## OpenAPI Excerpts (Key Patterns)
|
|
219
|
+
|
|
220
|
+
Most image endpoints follow this structure (multipart/form-data, accept header for binary/JSON, 200 with image or 202 with id).
|
|
221
|
+
|
|
222
|
+
Example for Generate Ultra (simplified):
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"post": {
|
|
226
|
+
"tags": ["Generate"],
|
|
227
|
+
"summary": "Stable Image Ultra",
|
|
228
|
+
"requestBody": {
|
|
229
|
+
"content": {
|
|
230
|
+
"multipart/form-data": {
|
|
231
|
+
"schema": {
|
|
232
|
+
"properties": {
|
|
233
|
+
"prompt": { "type": "string", "maxLength": 10000 },
|
|
234
|
+
"aspect_ratio": { "enum": ["1:1", "16:9", ...] },
|
|
235
|
+
"image": { "type": "string", "format": "binary" },
|
|
236
|
+
"strength": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
237
|
+
},
|
|
238
|
+
"required": ["prompt"]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"responses": {
|
|
244
|
+
"200": { "description": "Generation successful." },
|
|
245
|
+
"202": { "description": "Async started." }
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Similar patterns for Edit/Control/Upscale with file uploads (`image`, `mask`, `subject_image`, etc.) and specific params like `control_strength`, `grow_mask`, `search_prompt`.
|
|
252
|
+
|
|
253
|
+
## Code Generation Notes for `image.js`
|
|
254
|
+
|
|
255
|
+
- Implement methods: `generateUltra(params)`, `generateCore(params)`, `generateSD3(params)`, `upscaleConservative(params, imageFile)`, `upscaleCreative(...)`, `editInpaint(...)`, `controlSketch(...)`, `fetchResult(id)`, etc.
|
|
256
|
+
- Use `FormData` for all uploads.
|
|
257
|
+
- Handle async polling loop (similar to audio.js `fetchResult`).
|
|
258
|
+
- Support binary download (`responseType: 'arraybuffer'`) and base64 JSON.
|
|
259
|
+
- Validation: image dimensions, aspect ratios, credit costs, duration equivalents (N/A for images).
|
|
260
|
+
- Error handling: Specific messages for moderation, size limits, etc.
|
|
261
|
+
- Defaults: `output_format: "png"`, random seed=0.
|
|
262
|
+
- Model-specific handling (e.g., SD3 modes).
|
|
263
|
+
- Keep tiny & efficient like audio.js.
|
|
264
|
+
|
|
265
|
+
## References
|
|
266
|
+
- Full spec: `lib/API/stability.ai/openapi.json`
|
|
267
|
+
- Related: `audio-3.md` for audio parity.
|
|
268
|
+
- Official docs & Colab examples in OpenAPI `x-codeSamples`.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
*Generated: May 22, 2026. Focused on v2beta Stable Image endpoints for wrapper implementation.*
|