> For the complete documentation index, see [llms.txt](https://docs.avis.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avis.xyz/api-reference/endpoints.md).

# Endpoints

This guide documents the public client contract for listing AI models and using text, image, video, and audio generation endpoints.

**Base path:** `/api/v1`

**Authentication:** generation endpoints require either a bearer JWT or an `x-api-key` header. Model listing endpoints follow the route guard configuration in the controller; check deployed access policy before exposing them to external clients.

Clients should select a user-facing `model`; the backend resolves the best active provider model automatically.

### Validation Notes

The API uses Nest `ValidationPipe` with `whitelist: true` and `transform: true`.

* Unknown request fields are stripped before the DTO reaches the service.
* DTO validation failures return `400`.
* Model resolution failures return `400` for generation endpoints when no active provider supports the requested `model`.
* Some provider-specific validation happens after DTO validation. For example, unsupported video `maxTokens` values or unsupported multi-image requests can return `400` even when the DTO shape is valid.
* Generation parameters are model-scoped, not provider-scoped. A parameter the selected `model` does not support returns `400` naming the model, for example `cameraFixed` on a Seedance 2.0 model. Provider identity is never part of the request contract.
* `resolution` and `ratio` are open string tokens. The DTO does not enumerate them, so new model tokens pass DTO validation and are checked by the provider.
* Image and video requests accept ordered `content` arrays. Order is preserved and can affect provider behavior, especially first/last-frame video requests.
* Base64 inputs may be raw base64 or a full data URL. When raw base64 is used, include `mediaType`.

### Endpoint Sections

1. **List AI Models** — `GET /api/v1/ai/models` — Discover available models and their capabilities
2. **Text Completion** — `POST /api/v1/text/completions` — Stream chat-style text completions
3. **Image Generation** — `POST /api/v1/image/generations` — Generate images synchronously or asynchronously
4. **Video Generation** — `POST /api/v1/video/generations` — Generate videos with task-based polling
5. **Seedance 2.0 KYC Flow** — KYC asset management for identity-bound video generation
6. **Audio Generation** — `POST /api/v1/audio/text-to-speech` and `POST /api/v1/audio/generation-with-reference` — Text-to-Speech and reference-conditioned audio generation, both task-based


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.avis.xyz/api-reference/endpoints.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
