Skip to main content
POST
Use this endpoint when your client speaks the Anthropic Messages API (the Anthropic SDKs, Claude Code, and agents built on them). Point the SDK’s base URL at https://kymaapi.com and it calls this path itself. Setup per SDK: Anthropic SDK guide.

Authentication

Send your key as x-api-key: kyma-... (what the Anthropic SDKs send) or as Authorization: Bearer kyma-.... Either works.

Request body

string
required
A Kyma model id or alias, for example deepseek-v4-flash. Any chat model works; see GET /v1/models. This endpoint returns 400 naming the endpoint to use for an embedding model (POST /v1/embeddings), a reranking model (POST /v1/rerank), a decisions model (POST /v1/decisions), a model that does not produce text (for example image or speech) and a model that does not take text (transcription, audio understanding).
array
required
The conversation, as {role, content} objects with role "user" or "assistant". content is a string or an array of blocks:
  • text
  • image, with a base64 source (plus media_type) or a url source, on a model that accepts images (GET /v1/models?input_modalities=image). Other image sources, and images sent to a text-only model, return 400.
  • document, with a text source only. PDF, url, file and custom-content documents return 400: send the text instead.
  • tool_use (assistant turns) and tool_result (user turns). A tool_result may hold a string or text, document and image blocks.
Other block types are not forwarded to the model.
string | array
The system prompt, as a string or an array of text blocks. cache_control on a system block is kept. See Prompt caching.
integer
default:"4096"
Maximum tokens to generate. Unlike Anthropic’s API, it is optional here: when omitted, Kyma sends 4096. If your balance cannot pay for all of them, Kyma lowers the value and says so in the x-kyma-max-tokens-clamped header.
boolean
default:"false"
Stream the reply as Anthropic server-sent events.
number
Sampling temperature. When omitted, the model’s own default applies.
number
Nucleus sampling. When omitted, the model’s own default applies.
array
Strings that end generation.
array
Tool definitions: name, description, input_schema (JSON Schema). On models with supports_tools: true. See Tool calling.
object
{"type": "auto"}, {"type": "any"}, {"type": "none"} or {"type": "tool", "name": "..."}, with optional disable_parallel_tool_use: true. none and disable_parallel_tool_use are applied only when tools is also sent.
Other fields, such as top_k, thinking and metadata, are not forwarded to the model.

Response

  • content holds a text block, then one tool_use block (id, name, input) per tool call.
  • stop_reason is end_turn, max_tokens or tool_use. stop_sequence is always null.
  • model is the Kyma id your request resolved to.
  • usage carries input_tokens and output_tokens only.
With stream: true you get the Anthropic event sequence: message_start, content_block_start, content_block_delta (text_delta, or input_json_delta for tool input), content_block_stop, message_delta, message_stop. Kyma does not send an error event on this stream today.

Response headers

Errors

Every error on this endpoint uses Anthropic’s envelope, so an Anthropic SDK reads it as one: type: "error" on top, an Anthropic error type in error.type, and request_id at the top level. Kyma adds its own code next to the Anthropic type:
A stream that fails after it started ends with event: error and error.code: "stream_interrupted" (overloaded_error). Retry the whole request.