> Treat every model id, price, size, length and limit in this documentation as an illustration of the shape of the value, never as a constant to hardcode. The live values are served by GET /v1/models and GET /public/models on the HyperFlow HI API.

# Start a video

POST https://api.hi.hyperflow.fun/v1/videos
Content-Type: application/json

Starts a video job and returns it with status `queued`. Poll `GET /v1/videos/{id}` until it is `completed`,
then download it from its `url` or from `GET /v1/videos/{id}/content`.
The job is held for `seconds` at the price per second for its `resolution`, and charged once the video is made.
A video that fails isn't charged.

Reference: https://docs.hi.hyperflow.fun/api/endpoints/videos/create-video

## Authentication

- `Authorization` header (bearer token, required) — Your API key, `sk-...`, from Console → API keys.

## Request

### Body (application/json)

This endpoint expects a VideoCreateRequest.

- `model` (string, required)
- `prompt` (string, required)
- `seconds` (string, required) — Length of the video in seconds, a positive whole number. Each model has a maximum.
- `size` (string, optional) — Aspect ratio, such as `16:9` or `9:16`. Each model offers its own.
- `resolution` (string, optional) — Such as `720p` or `1080p`, on models priced by resolution. Without it, the model's base price per second applies.
- `input_reference` (string, optional) — An image to start the video from, on models that take one.
- `last_frame` (string, optional) — An image to end the video on
- `reference_images` (list of string, optional) — Images that guide the video's look, on models that take them.
- `seed` (integer, optional)
- `generate_audio` (boolean, optional) — On models that can make sound.
- `watermark` (boolean, optional)
- `return_last_frame` (boolean, optional)
- `user` (string, optional)
- `metadata` (map from string to string, optional)

## Response

### 200

The new job.

- `id` (string, optional)
- `object` (enum, optional)
  - Allowed values: `video`
- `model` (string, optional)
- `status` (enum, optional)
  - Allowed values: `queued`, `in_progress`, `completed`, `failed`
- `progress` (integer, optional)
- `seconds` (string, optional)
- `size` (string, optional)
- `created_at` (integer, optional) — Unix seconds.
- `completed_at` (integer, optional, nullable)
- `expires_at` (integer, optional, nullable) — Unix seconds when `url` stops working, or, without a `url`, when the video expires.
- `url` (string, optional) — A direct link to the finished video, until `expires_at`.
- `error` (VideoError, optional, nullable)

## Errors

### 400 Bad Request Error

A parameter is wrong, the model doesn't take that content or option, or the model rejected the request.

- `error` (ErrorResponseError, required)

### 401 Unauthorized Error

The key is missing, wrong, deleted or switched off. `GET /v1/models` and the video reads use the codes `invalid_api_key` and `key_disabled`.

- `error` (ErrorResponseError, required)

### 402 Payment Required Error

The available balance can't cover the most this request could cost.

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

A limit set on your account was reached.

- `error` (ErrorResponseError, required)

### 404 Not Found Error

No such model or video. The video reads use the code `not_found`.

- `error` (ErrorResponseError, required)

### 429 Too Many Requests Error

Too many requests from this address (code `rate_limited`), or from this key.

- `error` (ErrorResponseError, required)

### 502 Bad Gateway Error

The model's hosts couldn't answer. Retry shortly.

- `error` (ErrorResponseError, required)

### 503 Service Unavailable Error

The model's hosts are busy, or billing is briefly unavailable. Retry shortly.

- `error` (ErrorResponseError, required)

## Types

### VideoError

- `code` (enum, optional)
  - Allowed values: `video_failed`, `video_expired`, `not_charged`
- `message` (string, optional)

### ErrorResponseError

- `message` (string, required) — What went wrong, written to be read.
- `type` (string, optional) — OpenAI's error type, such as `invalid_request_error`.
- `code` (string, optional) — On inference endpoints, the HTTP status as a string, such as `"402"`. Elsewhere a named code, such as `invalid_api_key`, `key_disabled`, `not_found`, `video_not_ready`, `video_expired` or `rate_limited`.

## Examples

**Request**

```json
{
  "model": "google/veo-3.1-lite-generate-001",
  "prompt": "A paper boat drifting across a calm lake",
  "seconds": "4"
}
```

**Response**

```json
{
  "id": "video_3f9c2a",
  "object": "video",
  "model": "google/veo-3.1-lite-generate-001",
  "status": "queued",
  "progress": 0,
  "seconds": "4",
  "size": "16:9",
  "created_at": 1782886429,
  "completed_at": null,
  "error": null
}
```

**SDK Code**

```python
import requests

url = "https://api.hi.hyperflow.fun/v1/videos"

payload = {
    "model": "google/veo-3.1-lite-generate-001",
    "prompt": "A paper boat drifting across a calm lake",
    "seconds": "4"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.hi.hyperflow.fun/v1/videos';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"google/veo-3.1-lite-generate-001","prompt":"A paper boat drifting across a calm lake","seconds":"4"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hi.hyperflow.fun/v1/videos"

	payload := strings.NewReader("{\n  \"model\": \"google/veo-3.1-lite-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\",\n  \"seconds\": \"4\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.hi.hyperflow.fun/v1/videos")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"google/veo-3.1-lite-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\",\n  \"seconds\": \"4\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hi.hyperflow.fun/v1/videos")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"google/veo-3.1-lite-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\",\n  \"seconds\": \"4\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hi.hyperflow.fun/v1/videos', [
  'body' => '{
  "model": "google/veo-3.1-lite-generate-001",
  "prompt": "A paper boat drifting across a calm lake",
  "seconds": "4"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.hi.hyperflow.fun/v1/videos");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"google/veo-3.1-lite-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\",\n  \"seconds\": \"4\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "google/veo-3.1-lite-generate-001",
  "prompt": "A paper boat drifting across a calm lake",
  "seconds": "4"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hi.hyperflow.fun/v1/videos")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```