codeLuma AI Text-to-Video

Generate Videos from Text or Images

Overview

The Luma AI Dream Machine API allows developers to generate, retrieve, and extend AI-generated content using a variety of inputs. This API is particularly useful for creative applications, such as generating visual content from text prompts.

Authentication

All API requests require a Bearer token for authentication. Include your token in the Authorization header of each request.

Pricing

Each generation costs 500 000 AI/ML Tokens

API Reference

circle-info

Ensure you replace "your-api-key" with your actual API key before running the code.

使用 Luma AI 生成视频。

post

使用 Luma AI 根据提示生成视频,允许根据文本描述创建视频。

请求体
aspect_ratiostring必填

The aspect ratio of the image

Example: 16:9
expand_promptboolean必填

Whether to expand the prompt

Example: true
image_end_urlstring必填

The URL for the end of the image

Example: https://example.com/image-end.jpg
image_urlstring必填

The URL of the main image

Example: https://example.com/main-image.jpg
user_promptstring必填

The user-provided prompt for image generation

Example: A beautiful sunset over the ocean
响应
chevron-right
200成功
application/json
post
/luma-ai/generations
200成功

Example

在 Luma AI 中按 ID 列出视频代。

get

根据 Luma AI 中的 ID 返回视频生成列表。

查询参数
idsstring[]必填
响应
chevron-right
200成功
application/json
get
/luma-ai/generation
200成功

Example

上传图像以便在 Luma AI 中进行处理。

post

上传图像以便在 Luma AI 中进一步处理,通常用于 3D 建模或视频生成。

请求体
urlstring必填
响应
chevron-right
200成功
application/json
post
/luma-ai/generations/file-upload
200成功

Example

使用 Luma AI 扩展视频。

post

使用 Luma AI 扩展现有视频,为视频项目创建附加内容。

路径参数
taskIdstring必填
请求体
aspect_ratiostring必填

The aspect ratio of the image

Example: 16:9
expand_promptboolean必填

Whether to expand the prompt

Example: true
image_end_urlstring必填

The URL for the end of the image

Example: https://example.com/image-end.jpg
image_urlstring必填

The URL of the main image

Example: https://example.com/main-image.jpg
user_promptstring必填

The user-provided prompt for image generation

Example: A beautiful sunset over the ocean
响应
chevron-right
200成功
application/json
post
/luma-ai/generations/{taskId}/extend
200成功

Example

最后更新于