Docs menuinvideo Platform docsQuickstartFor AI agentsAPI referenceAuthenticationRequestsFilesErrorsLimitsBilling and balanceCatalogueProvider keys (BYOK)Formats and model IDsChat completionsOpenAI ResponsesAnthropic MessagesGeminiStreaming chat answersTools (function calling)Structured output (JSON)VideoAudioUse your own SDKOpenAI mediaElevenLabsReplicatefalGemini mediaxAIRunwayLumaDeepgram and CartesiaMakers' own APIsVideo provider formatsImage provider formatsAudio provider formatsLLM provider formatsGenerate and edit imagesTest your integrationWorkspaces and membersSecurityService accountsModels
View as markdown

Anthropic Messages

Use the Anthropic SDK with Platform: POST /v1/messages, with cache breakpoints, thinking, system blocks, tools, images and PDFs kept for models in this format.

POST /v1/messages takes Anthropic's Messages format, so the Anthropic SDKs work as they are. Set the base URL to https://platform-api.invideo.io and use your Platform API key.

  • Native format (passthrough). Your body goes to the model unchanged, including system blocks, cache_control breakpoints, thinking, tools and tool_choice, images, PDF document blocks, top_k, stop_sequences, temperature, top_p. The answer and the stream events come back as Anthropic sends them.
  • Other models: translated. Text, images, tools and the system prompt carry over; cache_control and thinking are dropped. PDF document blocks are refused (HTTP 400 unsupported_parameter, "Document (PDF) blocks work only with models in this format on this endpoint.").

See Formats and model IDs for model ids, aliases and what every door refuses.

Send a request

python
import anthropic, os

client = anthropic.Anthropic(
    base_url="https://platform-api.invideo.io",  # was api.anthropic.com
    api_key=os.environ["INVIDEO_API_KEY"],       # was ANTHROPIC_API_KEY
)

document = "The team approved a trial of the new editor for ten workspaces."
answer = client.messages.create(
    model="gemini-4-carbon",
    max_tokens=2000,
    system=[{"type": "text", "text": document, "cache_control": {"type": "ephemeral"}}],
    thinking={"type": "adaptive"},
    output_config={"effort": "low"},
    messages=[{"role": "user", "content": "Summarise the document."}],
)
print(answer.content[-1].text)
print(answer.usage)  # input, output, cache read and cache write tokens, and cost_usd
ts
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "https://platform-api.invideo.io", apiKey: process.env.INVIDEO_API_KEY });

const answer = await client.messages.create({
  model: "gemini-4-carbon",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Name a video app for cooks." }],
});
console.log(answer.content[0].type === "text" ? answer.content[0].text : answer.content[0]);
bash
curl https://platform-api.invideo.io/v1/messages \
  -H "x-api-key: $INVIDEO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-4-carbon",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Name a video app for cooks."}]
  }'

The key goes in x-api-key (what the SDK sends) or Authorization: Bearer. anthropic-version is accepted and not needed. Of anthropic-beta, only interleaved-thinking and fine-grained-tool-streaming are sent on; other betas are dropped.

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.

Streaming

With "stream": true (or client.messages.stream(...)), the answer comes as Anthropic's events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop and ping. A failure mid-stream is an event: error. The last message_delta has the usage, with cost_usd.

python
import anthropic, os

client = anthropic.Anthropic(base_url="https://platform-api.invideo.io", api_key=os.environ["INVIDEO_API_KEY"])

with client.messages.stream(
    model="gemini-4-carbon",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Write a haiku about soup."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

PDFs and images

Send them inline (base64) or as an https link. A link is fetched by us (public addresses only; 20 MB a file, 50 MB in all) and sent inline. Anthropic Files ("source": {"type": "file"}) are refused. Set INVIDEO_PDF_MODEL to an enabled model. In GET /v1/models/{id}, look for chat.native_format equal to anthropic_messages and pdf in chat.features.

python
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=os.environ["INVIDEO_PDF_MODEL"],
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": [
            {"type": "document", "source": {"type": "url", "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}},
            {"type": "text", "text": "What does this document say?"},
        ],
    }],
)
print(answer.content[-1].text)

Answer

json
{
  "id": "0193b0c4-...",
  "type": "message",
  "role": "assistant",
  "model": "gemini-4-carbon",
  "content": [{"type": "text", "text": "SimmerCut"}],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 14,
    "output_tokens": 6,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "cost_usd": "0.000143"
  }
}
  • id is the request's id in Logs (also the x-request-id header).
  • model is the id you sent.
  • stop_reason: end_turn (finished normally), max_tokens (it hit max_tokens), tool_use (it called a tool), stop_sequence, or refusal.

Not available

  • Server tools that run on Anthropic's side: web_search, web_fetch, code_execution, tool_search, memory and mcp_toolset (HTTP 400 unsupported_parameter). Client tools (computer, bash, text_editor) and your own tools work: your code runs them.
  • Files ("source": {"type": "file"}), container and mcp_servers.
  • Audio and video input (only Gemini models take them: Formats).

Errors

Anthropic's shape, so the SDK raises anthropic.NotFoundError, anthropic.RateLimitError and so on. Our code is in error.code:

json
{"type": "error", "error": {"type": "rate_limit_error", "message": "...", "code": "spend_limit_exceeded"}, "request_id": "0193b0c4-..."}

Not run here: Files, Batches, Admin and count_tokens (HTTP 404 not_found_error). All codes: Errors.