@j-o-r/hello-dave 0.1.1 → 0.1.4
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 +42 -25
- package/README.md +81 -221
- package/TODO.md +173 -35
- package/agents/agent_creator.js +105 -0
- package/agents/agent_creator.prompt.md +371 -0
- package/agents/ask_agent.js +64 -127
- package/agents/claude_agent.js +68 -0
- package/agents/code_agent.js +55 -135
- package/agents/code_agent.prompt.md +50 -0
- package/agents/echo_agent.js +76 -0
- package/agents/financial_expert.js +75 -0
- package/agents/gpt_agent.js +52 -103
- package/agents/gpt_code.js +81 -0
- package/agents/grok_agent.js +58 -114
- package/agents/minimax_agent.js +92 -0
- package/agents/mureka_agent.js +77 -0
- package/agents/planner_agent.js +172 -0
- package/agents/stability_agent.js +87 -0
- package/agents/test_agent.js +75 -157
- package/agents/weather_agent.js +73 -0
- package/agents/workflow_agent.js +189 -0
- package/bin/dave.js +436 -184
- package/docs/bin-dave.md +85 -35
- package/docs/cdn-ssh.md +100 -0
- package/docs/creating-agents.md +301 -0
- package/docs/creating-toolsets.md +336 -0
- package/docs/docs-organization.md +48 -0
- package/docs/project-overview.md +86 -51
- package/lib/API/elevenlabs.io/music.compose.md +441 -0
- package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
- package/lib/API/elevenlabs.io/music.stream.md +425 -0
- package/lib/API/lalal.ai/lalal.js +445 -0
- package/lib/API/lalal.ai/openapi.json +2614 -0
- package/lib/API/minimax/ImageToolset.js +82 -37
- package/lib/API/minimax/MusicToolset.js +125 -79
- package/lib/API/minimax/VideoToolset.js +170 -167
- package/lib/API/minimax/image.js +5 -1
- package/lib/API/minimax/music.js +210 -23
- package/lib/API/minimax/video.js +242 -53
- package/lib/API/mureka/MusicToolset.js +646 -0
- package/lib/API/mureka/README.md +41 -0
- package/lib/API/mureka/index.js +7 -0
- package/lib/API/mureka/music.js +658 -0
- package/lib/API/openai.com/index.js +7 -0
- package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
- package/lib/API/openai.com/video.create.character.md +40 -0
- package/lib/API/openai.com/video.create.md +219 -0
- package/lib/API/openai.com/video.delete.md +44 -0
- package/lib/API/openai.com/video.download.md +31 -0
- package/lib/API/openai.com/video.edit.md +155 -0
- package/lib/API/openai.com/video.extend.md +166 -0
- package/lib/API/openai.com/video.fetch.character.md +43 -0
- package/lib/API/openai.com/video.js +784 -0
- package/lib/API/openai.com/video.list.md +201 -0
- package/lib/API/openai.com/video.remix.md +175 -0
- package/lib/API/openai.com/video.retrieve.md +139 -0
- package/lib/API/openai.com/videoToolset.js +616 -0
- package/lib/API/stability.ai/ImageToolset.js +131 -40
- package/lib/API/stability.ai/MusicToolset.js +79 -47
- package/lib/API/stability.ai/audio.js +63 -131
- package/lib/API/x.ai/chat.responses.md +1040 -0
- package/lib/API/x.ai/image.js +229 -59
- package/lib/API/x.ai/imageToolset.js +376 -0
- package/lib/API/x.ai/index.js +1 -1
- package/lib/API/x.ai/responses.js +9 -18
- package/lib/Agent.js +271 -0
- package/lib/Agent.js.old +284 -0
- package/lib/AgentLauncher.js +562 -0
- package/lib/Cli.js +87 -13
- package/lib/Prompt.js +23 -1
- package/lib/Session.js +5 -4
- package/lib/ToolSet.js +102 -6
- package/lib/agentLoader.js +369 -0
- package/lib/cdn.js +67 -231
- package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
- package/lib/defaultToolsets.js +43 -0
- package/lib/fafs.js +1 -1
- package/lib/genericToolset.js +442 -119
- package/lib/handOffToolset.js +179 -0
- package/lib/index.js +34 -27
- package/lib/toolsetLoader.js +248 -0
- package/package.json +11 -5
- package/types/API/lalal.ai/lalal.d.ts +116 -0
- package/types/API/minimax/image.d.ts +2 -1
- package/types/API/minimax/music.d.ts +189 -26
- package/types/API/minimax/video.d.ts +100 -31
- package/types/API/mureka/index.d.ts +7 -0
- package/types/API/mureka/music.d.ts +472 -0
- package/types/API/openai.com/index.d.ts +7 -0
- package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
- package/types/API/openai.com/video.d.ts +409 -0
- package/types/API/openai.com/videoToolset.d.ts +24 -0
- package/types/API/stability.ai/audio.d.ts +14 -103
- package/types/API/stability.ai/image.d.ts +2 -2
- package/types/API/x.ai/image.d.ts +138 -26
- package/types/API/x.ai/imageToolset.d.ts +3 -0
- package/types/API/x.ai/index.d.ts +1 -1
- package/types/API/x.ai/responses.d.ts +4 -4
- package/types/Agent.d.ts +123 -0
- package/types/AgentLauncher.d.ts +222 -0
- package/types/Cli.d.ts +28 -8
- package/types/Prompt.d.ts +23 -5
- package/types/Session.d.ts +1 -1
- package/types/ToolSet.d.ts +10 -0
- package/types/agentLoader.d.ts +78 -0
- package/types/cdn.d.ts +15 -90
- package/types/defaultToolsets.d.ts +9 -0
- package/types/fafs.d.ts +1 -1
- package/types/genericToolset.d.ts +1 -1
- package/types/handOffToolset.d.ts +28 -0
- package/types/index.d.ts +19 -17
- package/types/toolsetLoader.d.ts +114 -0
- package/utils/format_log.js +101 -23
- package/utils/launch_agent.js +18 -0
- package/utils/list_sessions.sh +13 -5
- package/utils/search_sessions.sh +65 -29
- package/utils/toolsets.js +33 -0
- package/README.md.bak.1779452127 +0 -240
- package/agents/codeserver.sh +0 -47
- package/agents/daisy_agent.js +0 -173
- package/agents/docs_agent.js +0 -148
- package/agents/memory_agent.js +0 -263
- package/agents/minimax.js +0 -173
- package/agents/npm_agent.js +0 -202
- package/agents/prompt_agent.js +0 -133
- package/agents/readme_agent.js +0 -148
- package/agents/spawn_agent.js +0 -160
- package/agents/stability.js +0 -173
- package/agents/todo_agent.js +0 -175
- package/bin/codeDave +0 -58
- package/docs/agent-dave-websocket-protocol.md +0 -180
- package/docs/agent-manager.md +0 -244
- package/docs/codeserver-pattern.md +0 -191
- package/docs/generic-toolset.md +0 -326
- package/docs/howtos/agent-networking.md +0 -253
- package/docs/howtos/spawn-agents.md.bak +0 -200
- package/docs/howtos/spawn-agents.md.bak_new +0 -200
- package/docs/multi-agent-clusters.md +0 -265
- package/docs/music-toolsets.md +0 -137
- package/docs/path-resolution-best-practices.md +0 -104
- package/docs/plans/minimax-music-generation.md +0 -80
- package/docs/plans/unified-agent-architecture.md +0 -146
- package/docs/plans/websocket-streaming-plan.md.bak +0 -317
- package/docs/prompt/spawn_agent.md +0 -175
- package/docs/prompt/spawn_agent.md.bak +0 -201
- package/docs/prompt/task_clarification_and_documentation.md +0 -35
- package/docs/prompt-class.md +0 -141
- package/docs/todo-archive-infra-2026-04-21.md +0 -15
- package/docs/todo-archive-v0.0.8.md +0 -1
- package/docs/todo-archive-v0.1.0.md +0 -32
- package/docs/todo-archive.md +0 -44
- package/docs/tools-syntax-validation.md +0 -121
- package/docs/toolset.md +0 -164
- package/docs/xai-responses.md +0 -111
- package/docs/xai_collections.md +0 -106
- package/lib/API/x.ai/ImageToolset.js +0 -165
- package/lib/API/x.ai/text.js +0 -415
- package/lib/AgentClient.js +0 -248
- package/lib/AgentManager.js +0 -245
- package/lib/AgentServer.js +0 -404
- package/lib/wsCli.js +0 -287
- package/lib/wsIO.js +0 -90
- package/types/API/x.ai/text.d.ts +0 -286
- package/types/AgentClient.d.ts +0 -109
- package/types/AgentManager.d.ts +0 -100
- package/types/AgentServer.d.ts +0 -89
- package/types/wsCli.d.ts +0 -17
- package/types/wsIO.d.ts +0 -30
- package/utils/test.sh +0 -46
- /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
- /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
- /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
- /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
|
@@ -3,7 +3,7 @@ https://platform.openai.com/docs/api-reference/responses/create
|
|
|
3
3
|
Allthough we can use store = true and previous_response_id: response.id,
|
|
4
4
|
Stil all tokens are billed.
|
|
5
5
|
*/
|
|
6
|
-
import { GLOBAL } from '
|
|
6
|
+
import { GLOBAL } from '../../fafs.js'
|
|
7
7
|
import { request as doRequest } from '@j-o-r/apiserver';
|
|
8
8
|
import { sleep } from '@j-o-r/sh';
|
|
9
9
|
/**
|
|
@@ -22,7 +22,7 @@ import { sleep } from '@j-o-r/sh';
|
|
|
22
22
|
* @property {number} [max_output_tokens=4000] - Maximum number of output tokens.
|
|
23
23
|
* @property {number} [max_tool_calls=10] - Maximum number of tool calls allowed.
|
|
24
24
|
* @property {?Object} [metadata=null] - Optional metadata object.
|
|
25
|
-
* @property {'gpt-5.
|
|
25
|
+
* @property {'gpt-5.5'|'gpt-5.4'|'gpt-5.4-mini'} [model='gpt-5.4-mini'] - Model version to use.
|
|
26
26
|
* @property {?string} [prompt=null] - Reusable prompt string.
|
|
27
27
|
* @property {Object} [reasoning={effort: 'medium', summary: 'auto'}] - Reasoning configuration.
|
|
28
28
|
* @property {'low'|'medium'|'high'|null} reasoning.effort - Effort level for reasoning.
|
|
@@ -37,8 +37,8 @@ import { sleep } from '@j-o-r/sh';
|
|
|
37
37
|
* @property {boolean} [parallel_tool_calls=true] - Allow parallel tool calls if true.
|
|
38
38
|
* @property {'auto'} [tool_choice='auto'] - Tool choice setting, default is auto-selected.
|
|
39
39
|
* @property {OpenAITool[]} [tools=[]] - Array of tool objects: custom function tools (`OAToolCall`) or built-in OpenAI tools (e.g., `{type: "web_search_preview"}`).
|
|
40
|
-
* @property {?number } top_logprobs=null An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.
|
|
41
|
-
* @property {?number } top_p=1 Top-p sampling value between 0 and 1.
|
|
40
|
+
* @property {?number } [top_logprobs=null] An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.
|
|
41
|
+
* @property {?number } [top_p=1] Top-p sampling value between 0 and 1.
|
|
42
42
|
* @property {?string} [previous_response_id] - Needed reponse_id to validate tool calls on the next request
|
|
43
43
|
*/
|
|
44
44
|
/**
|
|
@@ -101,7 +101,7 @@ const API_URL = 'https://api.openai.com/v1/responses';
|
|
|
101
101
|
* Get the default headers
|
|
102
102
|
* @returns {object}
|
|
103
103
|
*/
|
|
104
|
-
const getHeaders = (USER_AGENT = '@j-o-r/
|
|
104
|
+
const getHeaders = (USER_AGENT = '@j-o-r/hello-world') => {
|
|
105
105
|
if (!process.env['OPENAIKEY']) {
|
|
106
106
|
throw new Error('Missing OPENAIKEY!export OPENAIKEY=<OPENAI_API_KEY>')
|
|
107
107
|
}
|
|
@@ -196,7 +196,40 @@ const generateHistory = (messages) => {
|
|
|
196
196
|
}, []);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Convert only the latest tool response message to OpenAI Responses API
|
|
201
|
+
* `function_call_output` input items.
|
|
202
|
+
*
|
|
203
|
+
* This is required when `previous_response_id` is set: OpenAI already has the
|
|
204
|
+
* assistant function_call items from the previous response, so the follow-up
|
|
205
|
+
* request should contain only the matching function_call_output items.
|
|
206
|
+
*
|
|
207
|
+
* @param {import('../../../Prompt.js').Message[]} messages - Prompt messages.
|
|
208
|
+
* @returns {OAFunctionCallOutput[]} Latest function call outputs.
|
|
209
|
+
* @throws {Error} If the last message is not a tool response message.
|
|
210
|
+
*/
|
|
211
|
+
const generateLastFunctionCallOutputs = (messages) => {
|
|
212
|
+
const last = messages[messages.length - 1];
|
|
213
|
+
if (!last || last.role !== 'tool') {
|
|
214
|
+
throw new Error('Expected last message to be tool when previous_response_id is set');
|
|
215
|
+
}
|
|
216
|
+
const outputs = last.content.map(
|
|
217
|
+
/** @param {import('../../../Prompt.js').FunctionResponse} item */
|
|
218
|
+
(item) => {
|
|
219
|
+
if (item.type === 'function_response') {
|
|
220
|
+
return {
|
|
221
|
+
type: 'function_call_output',
|
|
222
|
+
call_id: item.function_response.call_id,
|
|
223
|
+
output: item.function_response.response
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
).filter(item => item !== undefined);
|
|
228
|
+
if (outputs.length === 0) {
|
|
229
|
+
throw new Error('Expected at least one function_response in last tool message');
|
|
230
|
+
}
|
|
231
|
+
return outputs;
|
|
232
|
+
}
|
|
200
233
|
|
|
201
234
|
// tools": [{"type": "web_search_preview"}],
|
|
202
235
|
//** @type {OAOptions} */
|
|
@@ -208,7 +241,7 @@ const defaultSettings = {
|
|
|
208
241
|
// instructions: '',
|
|
209
242
|
// max_output_tokens: 4000,
|
|
210
243
|
// metadata: null,
|
|
211
|
-
model: '
|
|
244
|
+
model: 'gpt-5.4-mini',
|
|
212
245
|
// // https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts
|
|
213
246
|
// prompt: null,
|
|
214
247
|
// https://platform.openai.com/docs/api-reference/responses/create#responses-create-reasoning
|
|
@@ -223,9 +256,8 @@ const defaultSettings = {
|
|
|
223
256
|
// temperature: 0.2, // value between 0 -2
|
|
224
257
|
// text: { format: { type: "text" } }, // optional
|
|
225
258
|
parallel_tool_calls: true,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// // tools: [],
|
|
259
|
+
// tool_choice: 'auto', // optional
|
|
260
|
+
tools: [],
|
|
229
261
|
// top_logprobs: 0,
|
|
230
262
|
// top_p: 1,
|
|
231
263
|
// truncation: null,
|
|
@@ -239,19 +271,33 @@ const defaultSettings = {
|
|
|
239
271
|
* @param {ToolSet} [toolset]
|
|
240
272
|
* @param {OAOptions} [options]
|
|
241
273
|
*/
|
|
242
|
-
function getBody(prompt, toolset, options) {
|
|
274
|
+
function getBody(prompt, toolset, options = {}) {
|
|
243
275
|
// From the messages I only want assistant and user
|
|
244
276
|
/** @type {OAOptions} */
|
|
245
277
|
// @ts-ignore
|
|
246
278
|
const body = { ...defaultSettings, ...options };
|
|
247
279
|
// const body = options ? mergeOptions(DEFAULT_OPTIONS, options) : DEFAULT_OPTIONS;
|
|
248
280
|
body.instructions = prompt.hasSystemprompt ? prompt.system_prompt : '';
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
281
|
+
|
|
282
|
+
if (body.previous_response_id) {
|
|
283
|
+
// Recursive tool-continuation request: send only the latest tool outputs.
|
|
284
|
+
// Sending full history here can make OpenAI reject the request because the
|
|
285
|
+
// referenced function_call items already live under previous_response_id.
|
|
286
|
+
const messages = prompt.messages;
|
|
287
|
+
body.input = generateLastFunctionCallOutputs(messages);
|
|
288
|
+
} else {
|
|
289
|
+
// Fresh/stateless request: reduce tokens and prevent conflicts before
|
|
290
|
+
// copying prompt.messages. prompt.messages returns a deep copy, so pruning
|
|
291
|
+
// after this line would not affect the history sent in this request.
|
|
292
|
+
prompt.pruneResolvedFunctionCallsExceptLast();
|
|
293
|
+
|
|
294
|
+
// the last messages should be a role tool or user else the model cannot handle the request
|
|
295
|
+
const messages = prompt.messages;
|
|
296
|
+
if (!['user', 'tool'].includes(messages[messages.length - 1].role)) {
|
|
297
|
+
throw new Error('Missing last user question or tool');
|
|
298
|
+
}
|
|
299
|
+
body.input = generateHistory(messages);
|
|
253
300
|
}
|
|
254
|
-
body.input = generateHistory(messages);
|
|
255
301
|
if (toolset) {
|
|
256
302
|
// @ts-ignore
|
|
257
303
|
body.tool_choice = toolset.toolChoice;
|
|
@@ -308,7 +354,7 @@ function parseMessages(messages, prompt) {
|
|
|
308
354
|
}
|
|
309
355
|
} else if (type === 'image_generation_call') {
|
|
310
356
|
prompt.addMultiModal('assistant', [{ type: 'image_url', url: msg.result }]);
|
|
311
|
-
} else if (type === 'function_call'
|
|
357
|
+
} else if (type === 'function_call') {
|
|
312
358
|
toolcall.push({
|
|
313
359
|
type: 'function_request',
|
|
314
360
|
function_request: {
|
|
@@ -363,7 +409,7 @@ async function parseResponse(duration, prompt, res, toolset) {
|
|
|
363
409
|
* @param {number} [counter] - leave empty this counts the number of requests when doing recursive request calls
|
|
364
410
|
* @return {Promise<import('../../../Session.js').Message>}
|
|
365
411
|
*/
|
|
366
|
-
async function request(prompt, toolset = null, options, counter = 0) {
|
|
412
|
+
async function request(prompt, toolset = null, options = {}, counter = 0) {
|
|
367
413
|
// Max number of recurusive calls
|
|
368
414
|
const counterMax = GLOBAL.max_recursive_requests;
|
|
369
415
|
const start = new Date().getTime();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
## Create a character from an uploaded video.
|
|
2
|
+
[source](https://developers.openai.com/api/reference/resources/videos/methods/create_character)
|
|
3
|
+
**post** `/videos/characters`
|
|
4
|
+
|
|
5
|
+
Create a character from an uploaded video.
|
|
6
|
+
|
|
7
|
+
### Returns
|
|
8
|
+
|
|
9
|
+
- `id: string`
|
|
10
|
+
|
|
11
|
+
Identifier for the character creation cameo.
|
|
12
|
+
|
|
13
|
+
- `created_at: number`
|
|
14
|
+
|
|
15
|
+
Unix timestamp (in seconds) when the character was created.
|
|
16
|
+
|
|
17
|
+
- `name: string`
|
|
18
|
+
|
|
19
|
+
Display name for the character.
|
|
20
|
+
|
|
21
|
+
### Example
|
|
22
|
+
|
|
23
|
+
```http
|
|
24
|
+
curl https://api.openai.com/v1/videos/characters \
|
|
25
|
+
-H 'Content-Type: multipart/form-data' \
|
|
26
|
+
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
27
|
+
-F name=x \
|
|
28
|
+
-F 'video=@/path/to/video'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Response
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"id": "id",
|
|
36
|
+
"created_at": 0,
|
|
37
|
+
"name": "name"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
## [Create video](https://developers.openai.com/api/reference/resources/videos/methods/create)
|
|
2
|
+
|
|
3
|
+
**post** `/videos`
|
|
4
|
+
|
|
5
|
+
Create a new video generation job from a prompt and optional reference assets.
|
|
6
|
+
|
|
7
|
+
### Body Parameters
|
|
8
|
+
|
|
9
|
+
- `prompt: string`
|
|
10
|
+
|
|
11
|
+
Text prompt that describes the video to generate.
|
|
12
|
+
|
|
13
|
+
- `input_reference: optional ImageInputReferenceParam`
|
|
14
|
+
|
|
15
|
+
Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`.
|
|
16
|
+
|
|
17
|
+
- `file_id: optional string`
|
|
18
|
+
|
|
19
|
+
- `image_url: optional string`
|
|
20
|
+
|
|
21
|
+
A fully qualified URL or base64-encoded data URL.
|
|
22
|
+
|
|
23
|
+
- `model: optional VideoModel`
|
|
24
|
+
|
|
25
|
+
The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.
|
|
26
|
+
|
|
27
|
+
- `string`
|
|
28
|
+
|
|
29
|
+
- `"sora-2" or "sora-2-pro" or "sora-2-2025-10-06" or 2 more`
|
|
30
|
+
|
|
31
|
+
- `"sora-2"`
|
|
32
|
+
|
|
33
|
+
- `"sora-2-pro"`
|
|
34
|
+
|
|
35
|
+
- `"sora-2-2025-10-06"`
|
|
36
|
+
|
|
37
|
+
- `"sora-2-pro-2025-10-06"`
|
|
38
|
+
|
|
39
|
+
- `"sora-2-2025-12-08"`
|
|
40
|
+
|
|
41
|
+
- `seconds: optional VideoSeconds`
|
|
42
|
+
|
|
43
|
+
Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.
|
|
44
|
+
|
|
45
|
+
- `"4"`
|
|
46
|
+
|
|
47
|
+
- `"8"`
|
|
48
|
+
|
|
49
|
+
- `"12"`
|
|
50
|
+
|
|
51
|
+
- `size: optional VideoSize`
|
|
52
|
+
|
|
53
|
+
Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.
|
|
54
|
+
|
|
55
|
+
- `"720x1280"`
|
|
56
|
+
|
|
57
|
+
- `"1280x720"`
|
|
58
|
+
|
|
59
|
+
- `"1024x1792"`
|
|
60
|
+
|
|
61
|
+
- `"1792x1024"`
|
|
62
|
+
|
|
63
|
+
### Returns
|
|
64
|
+
|
|
65
|
+
- `Video object { id, completed_at, created_at, 10 more }`
|
|
66
|
+
|
|
67
|
+
Structured information describing a generated video job.
|
|
68
|
+
|
|
69
|
+
- `id: string`
|
|
70
|
+
|
|
71
|
+
Unique identifier for the video job.
|
|
72
|
+
|
|
73
|
+
- `completed_at: number`
|
|
74
|
+
|
|
75
|
+
Unix timestamp (seconds) for when the job completed, if finished.
|
|
76
|
+
|
|
77
|
+
- `created_at: number`
|
|
78
|
+
|
|
79
|
+
Unix timestamp (seconds) for when the job was created.
|
|
80
|
+
|
|
81
|
+
- `error: VideoCreateError`
|
|
82
|
+
|
|
83
|
+
Error payload that explains why generation failed, if applicable.
|
|
84
|
+
|
|
85
|
+
- `code: string`
|
|
86
|
+
|
|
87
|
+
A machine-readable error code that was returned.
|
|
88
|
+
|
|
89
|
+
- `message: string`
|
|
90
|
+
|
|
91
|
+
A human-readable description of the error that was returned.
|
|
92
|
+
|
|
93
|
+
- `expires_at: number`
|
|
94
|
+
|
|
95
|
+
Unix timestamp (seconds) for when the downloadable assets expire, if set.
|
|
96
|
+
|
|
97
|
+
- `model: VideoModel`
|
|
98
|
+
|
|
99
|
+
The video generation model that produced the job.
|
|
100
|
+
|
|
101
|
+
- `string`
|
|
102
|
+
|
|
103
|
+
- `"sora-2" or "sora-2-pro" or "sora-2-2025-10-06" or 2 more`
|
|
104
|
+
|
|
105
|
+
- `"sora-2"`
|
|
106
|
+
|
|
107
|
+
- `"sora-2-pro"`
|
|
108
|
+
|
|
109
|
+
- `"sora-2-2025-10-06"`
|
|
110
|
+
|
|
111
|
+
- `"sora-2-pro-2025-10-06"`
|
|
112
|
+
|
|
113
|
+
- `"sora-2-2025-12-08"`
|
|
114
|
+
|
|
115
|
+
- `object: "video"`
|
|
116
|
+
|
|
117
|
+
The object type, which is always `video`.
|
|
118
|
+
|
|
119
|
+
- `"video"`
|
|
120
|
+
|
|
121
|
+
- `progress: number`
|
|
122
|
+
|
|
123
|
+
Approximate completion percentage for the generation task.
|
|
124
|
+
|
|
125
|
+
- `prompt: string`
|
|
126
|
+
|
|
127
|
+
The prompt that was used to generate the video.
|
|
128
|
+
|
|
129
|
+
- `remixed_from_video_id: string`
|
|
130
|
+
|
|
131
|
+
Identifier of the source video if this video is a remix.
|
|
132
|
+
|
|
133
|
+
- `seconds: string`
|
|
134
|
+
|
|
135
|
+
Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
|
|
136
|
+
|
|
137
|
+
- `size: VideoSize`
|
|
138
|
+
|
|
139
|
+
The resolution of the generated video.
|
|
140
|
+
|
|
141
|
+
- `"720x1280"`
|
|
142
|
+
|
|
143
|
+
- `"1280x720"`
|
|
144
|
+
|
|
145
|
+
- `"1024x1792"`
|
|
146
|
+
|
|
147
|
+
- `"1792x1024"`
|
|
148
|
+
|
|
149
|
+
- `status: "queued" or "in_progress" or "completed" or "failed"`
|
|
150
|
+
|
|
151
|
+
Current lifecycle status of the video job.
|
|
152
|
+
|
|
153
|
+
- `"queued"`
|
|
154
|
+
|
|
155
|
+
- `"in_progress"`
|
|
156
|
+
|
|
157
|
+
- `"completed"`
|
|
158
|
+
|
|
159
|
+
- `"failed"`
|
|
160
|
+
|
|
161
|
+
### Example
|
|
162
|
+
|
|
163
|
+
```http
|
|
164
|
+
curl https://api.openai.com/v1/videos \
|
|
165
|
+
-H 'Content-Type: application/json' \
|
|
166
|
+
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
167
|
+
-d '{
|
|
168
|
+
"prompt": "x"
|
|
169
|
+
}'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Response
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"id": "id",
|
|
177
|
+
"completed_at": 0,
|
|
178
|
+
"created_at": 0,
|
|
179
|
+
"error": {
|
|
180
|
+
"code": "code",
|
|
181
|
+
"message": "message"
|
|
182
|
+
},
|
|
183
|
+
"expires_at": 0,
|
|
184
|
+
"model": "sora-2",
|
|
185
|
+
"object": "video",
|
|
186
|
+
"progress": 0,
|
|
187
|
+
"prompt": "prompt",
|
|
188
|
+
"remixed_from_video_id": "remixed_from_video_id",
|
|
189
|
+
"seconds": "seconds",
|
|
190
|
+
"size": "720x1280",
|
|
191
|
+
"status": "queued"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Example
|
|
196
|
+
|
|
197
|
+
```http
|
|
198
|
+
curl https://api.openai.com/v1/videos \
|
|
199
|
+
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
200
|
+
-F "model=sora-2" \
|
|
201
|
+
-F "prompt=A calico cat playing a piano on stage"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### Response
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"id": "video_123",
|
|
209
|
+
"object": "video",
|
|
210
|
+
"model": "sora-2",
|
|
211
|
+
"status": "queued",
|
|
212
|
+
"progress": 0,
|
|
213
|
+
"created_at": 1712697600,
|
|
214
|
+
"size": "1024x1792",
|
|
215
|
+
"seconds": "8",
|
|
216
|
+
"quality": "standard"
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
## [Delete video](https://developers.openai.com/api/reference/resources/videos/methods/delete)
|
|
2
|
+
|
|
3
|
+
**delete** `/videos/{video_id}`
|
|
4
|
+
|
|
5
|
+
Permanently delete a completed or failed video and its stored assets.
|
|
6
|
+
|
|
7
|
+
### Path Parameters
|
|
8
|
+
|
|
9
|
+
- `video_id: string`
|
|
10
|
+
|
|
11
|
+
### Returns
|
|
12
|
+
|
|
13
|
+
- `id: string`
|
|
14
|
+
|
|
15
|
+
Identifier of the deleted video.
|
|
16
|
+
|
|
17
|
+
- `deleted: boolean`
|
|
18
|
+
|
|
19
|
+
Indicates that the video resource was deleted.
|
|
20
|
+
|
|
21
|
+
- `object: "video.deleted"`
|
|
22
|
+
|
|
23
|
+
The object type that signals the deletion response.
|
|
24
|
+
|
|
25
|
+
- `"video.deleted"`
|
|
26
|
+
|
|
27
|
+
### Example
|
|
28
|
+
|
|
29
|
+
```http
|
|
30
|
+
curl https://api.openai.com/v1/videos/$VIDEO_ID \
|
|
31
|
+
-X DELETE \
|
|
32
|
+
-H "Authorization: Bearer $OPENAI_API_KEY"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Response
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"id": "id",
|
|
40
|
+
"deleted": true,
|
|
41
|
+
"object": "video.deleted"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## [Retrieve video content](https://developers.openai.com/api/reference/resources/videos/methods/download_content)
|
|
2
|
+
|
|
3
|
+
**get** `/videos/{video_id}/content`
|
|
4
|
+
|
|
5
|
+
Download the generated video bytes or a derived preview asset.
|
|
6
|
+
|
|
7
|
+
Streams the rendered video content for the specified video job.
|
|
8
|
+
|
|
9
|
+
### Path Parameters
|
|
10
|
+
|
|
11
|
+
- `video_id: string`
|
|
12
|
+
|
|
13
|
+
### Query Parameters
|
|
14
|
+
|
|
15
|
+
- `variant: optional "video" or "thumbnail" or "spritesheet"`
|
|
16
|
+
|
|
17
|
+
Which downloadable asset to return. Defaults to the MP4 video.
|
|
18
|
+
|
|
19
|
+
- `"video"`
|
|
20
|
+
|
|
21
|
+
- `"thumbnail"`
|
|
22
|
+
|
|
23
|
+
- `"spritesheet"`
|
|
24
|
+
|
|
25
|
+
### Example
|
|
26
|
+
|
|
27
|
+
```http
|
|
28
|
+
curl https://api.openai.com/v1/videos/$VIDEO_ID/content \
|
|
29
|
+
-H "Authorization: Bearer $OPENAI_API_KEY"
|
|
30
|
+
```
|
|
31
|
+
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
## Create a new video generation job by editing a source video or existing generated video.
|
|
2
|
+
[source](https://developers.openai.com/api/reference/resources/videos/methods/edit)
|
|
3
|
+
**post** `/videos/edits`
|
|
4
|
+
|
|
5
|
+
Create a new video generation job by editing a source video or existing generated video.
|
|
6
|
+
|
|
7
|
+
### Body Parameters
|
|
8
|
+
|
|
9
|
+
- `prompt: string`
|
|
10
|
+
|
|
11
|
+
Text prompt that describes how to edit the source video.
|
|
12
|
+
|
|
13
|
+
- `video: object { id }`
|
|
14
|
+
|
|
15
|
+
Reference to the completed video to edit.
|
|
16
|
+
|
|
17
|
+
- `id: string`
|
|
18
|
+
|
|
19
|
+
The identifier of the completed video.
|
|
20
|
+
|
|
21
|
+
### Returns
|
|
22
|
+
|
|
23
|
+
- `Video object { id, completed_at, created_at, 10 more }`
|
|
24
|
+
|
|
25
|
+
Structured information describing a generated video job.
|
|
26
|
+
|
|
27
|
+
- `id: string`
|
|
28
|
+
|
|
29
|
+
Unique identifier for the video job.
|
|
30
|
+
|
|
31
|
+
- `completed_at: number`
|
|
32
|
+
|
|
33
|
+
Unix timestamp (seconds) for when the job completed, if finished.
|
|
34
|
+
|
|
35
|
+
- `created_at: number`
|
|
36
|
+
|
|
37
|
+
Unix timestamp (seconds) for when the job was created.
|
|
38
|
+
|
|
39
|
+
- `error: VideoCreateError`
|
|
40
|
+
|
|
41
|
+
Error payload that explains why generation failed, if applicable.
|
|
42
|
+
|
|
43
|
+
- `code: string`
|
|
44
|
+
|
|
45
|
+
A machine-readable error code that was returned.
|
|
46
|
+
|
|
47
|
+
- `message: string`
|
|
48
|
+
|
|
49
|
+
A human-readable description of the error that was returned.
|
|
50
|
+
|
|
51
|
+
- `expires_at: number`
|
|
52
|
+
|
|
53
|
+
Unix timestamp (seconds) for when the downloadable assets expire, if set.
|
|
54
|
+
|
|
55
|
+
- `model: VideoModel`
|
|
56
|
+
|
|
57
|
+
The video generation model that produced the job.
|
|
58
|
+
|
|
59
|
+
- `string`
|
|
60
|
+
|
|
61
|
+
- `"sora-2" or "sora-2-pro" or "sora-2-2025-10-06" or 2 more`
|
|
62
|
+
|
|
63
|
+
- `"sora-2"`
|
|
64
|
+
|
|
65
|
+
- `"sora-2-pro"`
|
|
66
|
+
|
|
67
|
+
- `"sora-2-2025-10-06"`
|
|
68
|
+
|
|
69
|
+
- `"sora-2-pro-2025-10-06"`
|
|
70
|
+
|
|
71
|
+
- `"sora-2-2025-12-08"`
|
|
72
|
+
|
|
73
|
+
- `object: "video"`
|
|
74
|
+
|
|
75
|
+
The object type, which is always `video`.
|
|
76
|
+
|
|
77
|
+
- `"video"`
|
|
78
|
+
|
|
79
|
+
- `progress: number`
|
|
80
|
+
|
|
81
|
+
Approximate completion percentage for the generation task.
|
|
82
|
+
|
|
83
|
+
- `prompt: string`
|
|
84
|
+
|
|
85
|
+
The prompt that was used to generate the video.
|
|
86
|
+
|
|
87
|
+
- `remixed_from_video_id: string`
|
|
88
|
+
|
|
89
|
+
Identifier of the source video if this video is a remix.
|
|
90
|
+
|
|
91
|
+
- `seconds: string`
|
|
92
|
+
|
|
93
|
+
Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
|
|
94
|
+
|
|
95
|
+
- `size: VideoSize`
|
|
96
|
+
|
|
97
|
+
The resolution of the generated video.
|
|
98
|
+
|
|
99
|
+
- `"720x1280"`
|
|
100
|
+
|
|
101
|
+
- `"1280x720"`
|
|
102
|
+
|
|
103
|
+
- `"1024x1792"`
|
|
104
|
+
|
|
105
|
+
- `"1792x1024"`
|
|
106
|
+
|
|
107
|
+
- `status: "queued" or "in_progress" or "completed" or "failed"`
|
|
108
|
+
|
|
109
|
+
Current lifecycle status of the video job.
|
|
110
|
+
|
|
111
|
+
- `"queued"`
|
|
112
|
+
|
|
113
|
+
- `"in_progress"`
|
|
114
|
+
|
|
115
|
+
- `"completed"`
|
|
116
|
+
|
|
117
|
+
- `"failed"`
|
|
118
|
+
|
|
119
|
+
### Example
|
|
120
|
+
|
|
121
|
+
```http
|
|
122
|
+
curl https://api.openai.com/v1/videos/edits \
|
|
123
|
+
-H 'Content-Type: application/json' \
|
|
124
|
+
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
125
|
+
-d '{
|
|
126
|
+
"prompt": "x",
|
|
127
|
+
"video": {
|
|
128
|
+
"id": "video_123"
|
|
129
|
+
}
|
|
130
|
+
}'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Response
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"id": "id",
|
|
138
|
+
"completed_at": 0,
|
|
139
|
+
"created_at": 0,
|
|
140
|
+
"error": {
|
|
141
|
+
"code": "code",
|
|
142
|
+
"message": "message"
|
|
143
|
+
},
|
|
144
|
+
"expires_at": 0,
|
|
145
|
+
"model": "sora-2",
|
|
146
|
+
"object": "video",
|
|
147
|
+
"progress": 0,
|
|
148
|
+
"prompt": "prompt",
|
|
149
|
+
"remixed_from_video_id": "remixed_from_video_id",
|
|
150
|
+
"seconds": "seconds",
|
|
151
|
+
"size": "720x1280",
|
|
152
|
+
"status": "queued"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|