Skip to main content

Endpoint

Authentication and API version

Use your ViVi-API key. These examples use the 2023-06-01 Messages format. Change the version if your model or channel requires it; a new upstream version does not automatically mean the gateway supports it.
Replace YOUR_ANTHROPIC_MODEL with an available model ID that supports Anthropic Messages.

Request parameters

Put instructions in the top-level system field, not in a message with role: "system". Tools, thinking, and multimodal features require model and channel support.

Request examples

Set VIVI_API_KEY to your ViVi-API key in your shell environment. See Quickstart to create a key. Install requests with python -m pip install requests. cURL uses Bash syntax.

Response

Illustrative response:
Tool calls may return tool_use blocks and a corresponding stop reason. Do not treat these blocks as plain text.

System instructions and multi-turn conversations

Send relevant history with every request. Context and output limits depend on the selected model.

Streaming

Common event order: message_start → content_block_start → content_block_delta → content_block_stop → message_delta → message_stop. ping or error events may appear between them.
Read delta.text only when delta.type is text_delta. Tool and thinking deltas use other structures. A stream can fail after the initial HTTP 200 response, so handle error events.

Integration notes

  • max_tokens is required.
  • Send the protocol version in the anthropic-version header.
  • Output is in content, not choices[0].message.content.
  • Read the error body and check troubleshooting.
Protocol references: Anthropic Messages and API versioning. Availability depends on ViVi-API support.