> 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 Flow AI API.

# Start a video

POST https://ai.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 `GET /v1/videos/{id}/content`.

Reference: https://ai-docs.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, optional) — Length of the video, such as `"4"`. Each model has its own choices.
- `size` (string, optional) — Resolution, such as `1280x720`.
- `input_reference` (string, optional) — An image to start the video from, on models that take one.
- `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)
- `error` (VideoError, optional, nullable)

## Errors

### 400 Bad Request Error

A parameter is wrong, or the model doesn't take that content, size or count. Code `invalid_request`.

- `error` (ErrorResponseError, required)

### 401 Unauthorized Error

The key is missing, wrong or deleted (`invalid_api_key`), or turned off (`key_disabled`).

- `error` (ErrorResponseError, required)

### 402 Payment Required Error

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

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

The key's or the account's spending limit is reached.

- `error` (ErrorResponseError, required)

### 404 Not Found Error

No such model or video. Code `not_found`.

- `error` (ErrorResponseError, required)

### 429 Too Many Requests Error

Too many requests from this address. Code `rate_limited`.

- `error` (ErrorResponseError, required)

### 502 Bad Gateway Error

The model's hosts couldn't answer. Code `host_unavailable`. Retry shortly.

- `error` (ErrorResponseError, required)

## Types

### VideoError

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

### ErrorResponseError

- `message` (string, required) — What went wrong
- `type` (string, optional) — OpenAI's error type, such as `invalid_request_error`.
- `code` (string, optional) — Flow AI's error code, such as `insufficient_balance`.

## Examples

**Request**

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

**Response**

```json
{
  "id": "string",
  "object": "video",
  "model": "string",
  "status": "queued",
  "progress": 1,
  "seconds": "string",
  "size": "string",
  "created_at": 1,
  "completed_at": 1,
  "error": {
    "code": "video_failed",
    "message": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://ai.hyperflow.fun/v1/videos"

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

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

print(response.json())
```

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

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://ai.hyperflow.fun/v1/videos"

	payload := strings.NewReader("{\n  \"model\": \"google/veo-3.1-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\"\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://ai.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-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\"\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://ai.hyperflow.fun/v1/videos")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"google/veo-3.1-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

var client = new RestClient("https://ai.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-generate-001\",\n  \"prompt\": \"A paper boat drifting across a calm lake\"\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-generate-001",
  "prompt": "A paper boat drifting across a calm lake"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://ai.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()
```