---
agent:
  instructions: "Search the site by keyword or question. The search API returns Markdown."
  endpoint: "https://platform.invideo.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Formats and model IDs

> Call chat models in the Anthropic, OpenAI (Chat and Responses) or Gemini format with that provider's own SDK. Change only the base URL and the API key.

# Formats and model IDs

Keep your SDK and request format. Set the **base URL** to Platform and use
your Platform **API key**.

| Format | Endpoint | SDK | Base URL in the SDK |
| --- | --- | --- | --- |
| [Anthropic Messages](/docs/chat/anthropic) | `POST /v1/messages` | Anthropic SDK | `https://platform-api.invideo.io` |
| [OpenAI Chat](/docs/chat/completions) | `POST /v1/chat/completions` | OpenAI SDK | `https://platform-api.invideo.io/v1` |
| [OpenAI Responses](/docs/chat/responses) | `POST /v1/responses` | OpenAI SDK | `https://platform-api.invideo.io/v1` |
| [Gemini](/docs/chat/gemini) | `POST /v1beta/models/{model}:generateContent` and `:streamGenerateContent?alt=sse` | Google GenAI SDK | `https://platform-api.invideo.io` |

Every chat format on this page accepts any chat model enabled for your key. Use the canonical Platform model ID when sending a model through another provider’s format.

| Provider | Path | Settled USD field |
| --- | --- | --- |
| xAI | `POST /xai/v1/chat/completions` | `usage.cost` |
| DeepSeek | `POST /deepseek/v1/chat/completions` | `usage.cost` |
| Moonshot AI | `POST /moonshot/v1/chat/completions` | `usage.cost` |
| Z.ai | `POST /z-ai/api/paas/v4/chat/completions` | `usage.cost` |
| OpenRouter | `POST /openrouter/api/v1/chat/completions` | `usage.cost` |
| BytePlus | `POST /byteplus/api/v3/chat/completions` | `usage.cost` |
| Perplexity | `POST /perplexity/chat/completions` | `usage.cost` |
| MiniMax | `POST /minimax/anthropic/v1/messages` | `usage.cost_usd` |

Use your Platform key as a Bearer token. MiniMax also accepts `x-api-key` for the Anthropic SDK. The OpenAI formats include `usage.cost`, Anthropic Messages includes `usage.cost_usd`, and Gemini includes `usageMetadata.cost_usd`. The exact amount is also in `x-invideo-cost-usd` on a completed JSON response. Live streams report it in their final usage event.

## Passthrough or translated

- **Passthrough**: If you use the model’s native format, Platform sends the request unchanged. The response and stream events keep their original format. Supported fields include Anthropic `cache_control` breakpoints, `thinking`,
  system blocks, and PDF documents. Platform also keeps Responses API reasoning items and Gemini parts.
- **Translated**: Platform converts the request when you use a different format. Text, images, tools and the
  system prompt carry over. Anthropic `cache_control` and `thinking` are dropped.
  Use Anthropic `document` blocks with models in the Anthropic format and Responses
  `input_file` with models in the OpenAI format. Other formats return HTTP 400
  `unsupported_parameter` for PDFs.

In `GET /v1/models/{id}`, `chat.native_format` names the model's own format, `chat.also_speaks` lists other formats, and `chat.features` lists capabilities (`tools`, `vision`, `pdf`,
`prompt_cache`, `thinking`, `json`, `responses_api`). Logs show each request’s format and whether Platform sent it unchanged.

## The same call in each format

```python
# Anthropic SDK
import anthropic, os

client = anthropic.Anthropic(base_url="https://platform-api.invideo.io", api_key=os.environ["INVIDEO_API_KEY"])
answer = client.messages.create(
    model="gemini-4-carbon",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Name a video app for cooks."}],
)
print(answer.content[0].text)
```

```python
# OpenAI SDK (Chat Completions or Responses)
from openai import OpenAI
import os

client = OpenAI(base_url="https://platform-api.invideo.io/v1", api_key=os.environ["INVIDEO_API_KEY"])
answer = client.responses.create(model="gemini-4-carbon", input="Name a video app for cooks.")
print(answer.output_text)
```

```python
# Google GenAI SDK
from google import genai
import os

client = genai.Client(
    api_key=os.environ["INVIDEO_API_KEY"],
    http_options={"base_url": "https://platform-api.invideo.io", "api_version": "v1beta"},
)
answer = client.models.generate_content(model="gemini-4-carbon", contents="Name a video app for cooks.")
print(answer.text)
```

## Model IDs and aliases

Use the Platform model ID from `GET /v1/models` (for example `gemini-4-carbon`). When Platform recognises a provider ID as an alias for an enabled model, you can use that ID instead.
- The answer's `model` is the id you sent.
- An id we do not know gets the door's "not found" error (HTTP 404).

## Your key on each door

Send your Platform key the way that door's SDK sends it:

| Door | Header |
| --- | --- |
| Anthropic | `x-api-key: <key>` (or `Authorization: Bearer <key>`) |
| OpenAI | `Authorization: Bearer <key>` |
| Gemini | `x-goog-api-key: <key>` (or `Authorization: Bearer <key>`). A key in the URL (`?key=`) is refused (401): URLs end up in logs. |

## List models in each shape

- `GET /v1/models`: the OpenAI shape. With an `anthropic-version` header (the
  Anthropic SDK's `client.models.list()`), the Anthropic shape:
  `{"data": [{"type": "model", "id", "display_name", "created_at"}], "has_more", "first_id", "last_id"}`.
- `GET /v1beta/models`: the Gemini shape:
  `{"models": [{"name": "models/<id>", "displayName", "inputTokenLimit", "outputTokenLimit", "supportedGenerationMethods"}]}`.

## What we do not run

Some provider features keep data or run paid tools under the provider account,
so the doors refuse them with HTTP 400 and the code `unsupported_parameter` (in
that door's error shape):

- **Stored state**: Anthropic Files (`source.type: "file"`), `container`,
  `mcp_servers`; OpenAI `file_id`, `previous_response_id` and `conversation`;
  Gemini `cachedContent`, and `fileData` with `gs://` or
  File API links. Send the content inline instead (base64 or an https link).
- **Server-side tools**: Anthropic `web_search`, `web_fetch`, `code_execution`,
  `tool_search`, `memory`, `mcp_toolset` (the client tools `computer`, `bash` and
  `text_editor` work: your code runs them);
  OpenAI `web_search`, `file_search`, `code_interpreter`, `image_generation`,
  `mcp`, `computer_use`; Gemini `googleSearch`, `codeExecution`, `urlContext`.
  Your own function tools work on every door.
- **Audio and video input** for any model but Gemini: HTTP 400
  `unsupported_parameter`, "This model does not take audio or video input."
  (See below for Gemini.)
- **Audio output** and more than one answer per call (`n` over 1).

Platform does not ask OpenAI to store your response. On Platform, send `store: false` to opt out of [stored answer retrieval](/docs/chat/responses#recover-a-chat-answer); background mode and resume require retention. Platform drops `service_tier` and OpenAI `metadata`. Anthropic’s `metadata.user_id` remains the user tag in Logs.
Endpoints we do not run (Files, Batches, Admin, `count_tokens`, embeddings)
answer with the door's 404 error.

An image or PDF given as an `https` link is fetched by us (public addresses
only; 20 MB a file, 50 MB in all) and sent to the model inline.

## Audio and video input (Gemini models)

Gemini models take audio and video: on the Gemini door as `inlineData` (or
an `https` `fileData`), and on the OpenAI Chat and Responses doors as
`input_audio` (`{"data": "<base64>", "format": "mp3"}`) or a `file` part with a
`data:audio/...` or `data:video/...;base64,` URL. Inline files up to 20 MB in all.

**Price.** Audio tokens (a video's sound included) cost the model's audio price,
`audio_input_per_m` in `GET /v1/models` (per 1M audio tokens); about 25 tokens per
second of audio. A video's frames cost the model's input price. Every other model
refuses audio and video: HTTP 400 `unsupported_parameter`, "This model does not take
audio or video input."

## Errors

Each door answers errors in its provider's shape, so the SDKs raise their
usual exceptions. Our own error code is always in an extra field.

```json
// Anthropic door
{"type": "error", "error": {"type": "not_found_error", "message": "...", "code": "model_not_found"}, "request_id": "..."}
// OpenAI doors
{"error": {"message": "...", "type": "invalid_request_error", "param": "model", "code": "model_not_found"}}
// Gemini door
{"error": {"code": 404, "message": "...", "status": "NOT_FOUND", "code_name": "model_not_found"}}
```

The HTTP status of a code is the same on every door: 401 bad key, 403 model
not on for your workspace, 404 unknown model, 413 too
large, 429 spend or rate limit, 400 invalid request (and `max_tokens_too_low`,
which is charged), 502 or 503 the provider failed (free). All codes:
[Errors](/docs/errors).

## Usage and cost

**Max length.** Set a max length (`max_tokens` / `max_completion_tokens` / `max_output_tokens` / `maxOutputTokens`). Without it we hold the model's full maximum; if your spend limit can't cover that, we lower the max to what it can.

Each door gives usage in its own shape, with `cost_usd` (what the call was
charged) added. Cache reads, cache writes and thinking tokens are counted and
charged.

| Door | Where |
| --- | --- |
| Anthropic | `usage` (`input_tokens`, `output_tokens`, `cache_creation_input_tokens`, `cache_read_input_tokens`, `cost_usd`); when streaming, on the last `message_delta` |
| OpenAI Chat | `usage` and `cost_usd`; when streaming, on the last chunk |
| OpenAI Responses | `usage` (`input_tokens`, `input_tokens_details.cached_tokens`, `output_tokens`, `output_tokens_details.reasoning_tokens`, `total_tokens`, `cost_usd`); when streaming, in `response.completed` |
| Gemini | `usageMetadata` (`promptTokenCount`, `candidatesTokenCount`, `cachedContentTokenCount`, `thoughtsTokenCount`, `totalTokenCount`, `cost_usd`); when streaming, on the last chunk |

Every answer has the header `x-request-id`: the request's id in Logs. The
answer's own id (Anthropic message id, Responses id, Chat id) is the same id.
