SPB Git

Repository Public

create.md 5.4 KB 260 lines markdown

1> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.23## Create a video45**post** `/videos`67Create a new video generation job from a prompt and optional reference assets.89### Body Parameters1011- `prompt: string`1213  Text prompt that describes the video to generate.1415- `input_reference: optional ImageInputReferenceParam`1617  Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`.1819  - `file_id: optional string`2021  - `image_url: optional string`2223    A fully qualified URL or base64-encoded data URL.2425- `model: optional VideoModel`2627  The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.2829  - `string`3031  - `"sora-2" or "sora-2-pro" or "sora-2-2025-10-06" or 2 more`3233    - `"sora-2"`3435    - `"sora-2-pro"`3637    - `"sora-2-2025-10-06"`3839    - `"sora-2-pro-2025-10-06"`4041    - `"sora-2-2025-12-08"`4243- `seconds: optional VideoSeconds`4445  Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.4647  - `"4"`4849  - `"8"`5051  - `"12"`5253- `size: optional VideoSize`5455  Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.5657  - `"720x1280"`5859  - `"1280x720"`6061  - `"1024x1792"`6263  - `"1792x1024"`6465### Returns6667- `Video object { id, completed_at, created_at, 10 more }`6869  Structured information describing a generated video job.7071  - `id: string`7273    Unique identifier for the video job.7475  - `completed_at: number or null`7677    Unix timestamp (seconds) for when the job completed, if finished.7879  - `created_at: number`8081    Unix timestamp (seconds) for when the job was created.8283  - `error: VideoCreateError or null`8485    Error payload that explains why generation failed, if applicable.8687    - `code: string`8889      A machine-readable error code that was returned.9091    - `message: string`9293      A human-readable description of the error that was returned.9495    - `misalignment: optional object { detailed_explanation, error_type, steer }`9697      - `detailed_explanation: optional string`9899        The public explanation for this block.100101      - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`102103        An optional classification; clients must accept additional values.104105        - `string`106107        - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`108109          An optional classification; clients must accept additional values.110111          - `"potentially_unintended_data_transfer"`112113          - `"potentially_unintended_data_access"`114115          - `"potentially_unintended_destructive_activity"`116117          - `"other"`118119      - `steer: optional object { message }`120121        An optional public continuation instruction.122123        - `message: string`124125          The public continuation instruction.126127  - `expires_at: number or null`128129    Unix timestamp (seconds) for when the downloadable assets expire, if set.130131  - `model: VideoModel`132133    The video generation model that produced the job.134135    - `string`136137    - `"sora-2" or "sora-2-pro" or "sora-2-2025-10-06" or 2 more`138139      - `"sora-2"`140141      - `"sora-2-pro"`142143      - `"sora-2-2025-10-06"`144145      - `"sora-2-pro-2025-10-06"`146147      - `"sora-2-2025-12-08"`148149  - `object: "video"`150151    The object type, which is always `video`.152153    - `"video"`154155  - `progress: number`156157    Approximate completion percentage for the generation task.158159  - `prompt: string or null`160161    The prompt that was used to generate the video.162163  - `remixed_from_video_id: string or null`164165    Identifier of the source video if this video is a remix.166167  - `seconds: string`168169    Duration of the generated clip in seconds. For extensions, this is the stitched total duration.170171  - `size: VideoSize`172173    The resolution of the generated video.174175    - `"720x1280"`176177    - `"1280x720"`178179    - `"1024x1792"`180181    - `"1792x1024"`182183  - `status: "queued" or "in_progress" or "completed" or "failed"`184185    Current lifecycle status of the video job.186187    - `"queued"`188189    - `"in_progress"`190191    - `"completed"`192193    - `"failed"`194195### Example196197```http198curl https://api.openai.com/v1/videos \199    -H 'Content-Type: application/json' \200    -H "Authorization: Bearer $OPENAI_API_KEY" \201    -d '{202          "prompt": "x"203        }'204```205206#### Response207208```json209{210  "id": "id",211  "completed_at": 0,212  "created_at": 0,213  "error": {214    "code": "code",215    "message": "message",216    "misalignment": {217      "detailed_explanation": "detailed_explanation",218      "error_type": "potentially_unintended_data_transfer",219      "steer": {220        "message": "message"221      }222    }223  },224  "expires_at": 0,225  "model": "sora-2",226  "object": "video",227  "progress": 0,228  "prompt": "prompt",229  "remixed_from_video_id": "remixed_from_video_id",230  "seconds": "string",231  "size": "720x1280",232  "status": "queued"233}234```235236### Example237238```http239curl https://api.openai.com/v1/videos \240  -H "Authorization: Bearer $OPENAI_API_KEY" \241  -F "model=sora-2" \242  -F "prompt=A calico cat playing a piano on stage"243```244245#### Response246247```json248{249  "id": "video_123",250  "object": "video",251  "model": "sora-2",252  "status": "queued",253  "progress": 0,254  "created_at": 1712697600,255  "size": "1024x1792",256  "seconds": "8",257  "quality": "standard"258}259```260
Files main
Menu

Theme