# One type's models

`GET /v1/embeddings/models`, `GET /v1/images/models` and `GET /v1/videos/models` each list the
models of one type on sale, with their prices in DA.

## Request

Send it with an API key. It takes no field: the address names the type. The
[Models](/docs/models) guide lists every model at once.

| Route | Lists |
|---|---|
| `GET /v1/embeddings/models` | the embeddings models |
| `GET /v1/images/models` | the picture models |
| `GET /v1/videos/models` | the video models, with what each can make |

```python
import json
import os
import urllib.request

API_KEY = os.environ["OPENDUNES_API_KEY"]
ADDRESS = "https://opendunes.com/v1/videos/models"

request = urllib.request.Request(
    ADDRESS,
    headers={"Authorization": "Bearer " + API_KEY},
)
with urllib.request.urlopen(request) as response:
    models = json.load(response)["data"]

for model in models:
    print(
        model["id"],
        model["supported_durations"],
        model["supported_resolutions"],
    )
```

```javascript
const API_KEY = process.env.OPENDUNES_API_KEY;
const ADDRESS = "https://opendunes.com/v1/videos/models";

const response = await fetch(ADDRESS, {
  headers: { Authorization: `Bearer ${API_KEY}` },
});
const { data } = await response.json();

for (const model of data) {
  console.log(model.id, model.supported_durations, model.supported_resolutions);
}
```

```go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

const address = "https://opendunes.com/v1/videos/models"

func main() {
	apiKey := os.Getenv("OPENDUNES_API_KEY")

	req, err := http.NewRequest("GET", address, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+apiKey)

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	var body struct {
		Data []struct {
			ID                   string   `json:"id"`
			SupportedDurations   []int    `json:"supported_durations"`
			SupportedResolutions []string `json:"supported_resolutions"`
		} `json:"data"`
	}
	if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
		panic(err)
	}
	for _, model := range body.Data {
		fmt.Println(
			model.ID, model.SupportedDurations, model.SupportedResolutions,
		)
	}
}
```

```bash cURL
ADDRESS="https://opendunes.com/v1/videos/models"

curl "$ADDRESS" \
  -H "Authorization: Bearer $OPENDUNES_API_KEY"
```

## Response

`200 OK`.

| Field | Holds |
|---|---|
| `data` | the models of that type, newest first, each as [All models](/docs/reference/models) describes a model: its `id`, its `pricing` in DA and the rest |

A video model also holds what it can make. Each is `null` where the model does not say.

| Field | Holds |
|---|---|
| `supported_resolutions` | the resolutions it makes, such as `720p` or `1080p` |
| `supported_aspect_ratios` | the shapes it makes, such as `16:9` or `9:16` |
| `supported_sizes` | the sizes it makes, width by height |
| `supported_durations` | the clip lengths it makes, in seconds |
| `supported_frame_images` | the frames it can start or end on, `first_frame` or `last_frame` |
| `upscale_factor` | on a model that upscales a clip: how far it can enlarge one |
| `creativity` | on a model that upscales a clip: the creativity levels it takes |
| `generate_audio` | whether it can make the clip's sound |
| `seed` | whether a `seed` makes a clip repeatable |
| `allowed_passthrough_parameters` | the provider's own settings it accepts, under `provider` |
| `pricing_skus` | its price for each kind of output, in DA, each a string per unit, with `discount` beside them |

## What it cost

Free. Reading the catalogue is never charged.

## Errors

`error.code` carries the status, and `error.message` says why.

| Status | When |
|---|---|
| 401 | the key is missing, wrong, disabled or expired |
| 403 | the key answers only from the addresses set on it, and this request came from another |
| 503 | the video models could not be read just now; `Retry-After` says how many seconds to wait |
