For the complete documentation index, see llms.txt. This page is also available as Markdown.

Anthropic Messages

Create a messages response. This endpoint is compatible with the Anthropic API.

post

Create a messages response. This endpoint is compatible with the Anthropic API.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body

Request message for /v1/messages

preferencestring · enumOptional

The provider preference for handling the request.

Possible values:
allowed_providersstring[] · nullableOptional

The providers that are allowed to be used for the completion.

Example: ["mistral","scaleway"]
eu_nativeboolean · nullableOptional

Whether to consider only providers based and regulated withing the EU. Even when false, all our endpoints are GDPR compliant.

Example: false
allow_quantizationboolean · nullableOptional

Whether to allow quantized endpoints.

Example: true
allow_zero_data_retentionboolean · nullableOptional

Whether to use only ZDR providers.

enable_model_fallbackboolean · nullableOptional

Whether to allow model fallback when a model is currently unavailable.

fallbacksstring[] · nullableOptional

The providers that are allowed to be used for the completion.

Example: ["mistral-small-2506","mistral-small-2503"]
max_tokensinteger · int32Optional

The maximum number of tokens to generate before stopping. The model may stop before the max_tokens when it reaches the stop sequence.

modelstringOptional

Model name for the model to use.

Example: mistral-small-2603
stop_sequencesstring[] · nullableOptional

(Not supported by reasoning models) Up to 4 sequences where the API will stop generating further tokens.

streamboolean · nullableOptional

If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.

systemone of · nullableOptional

System prompt message for the model, defining how the model should behave to user messages.

stringOptional

Text content of system prompt.

or
temperaturenumber · max: 2 · nullableOptional

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. It may not work well with reasoning models.

Default: 1
tool_choiceone of · nullableOptional

Controls which (if any) tool is called by the model. "none" means the model will not call any tool and instead generates a message. "auto" means the model can pick between generating a message or calling one or more tools. "any" means the model must call one or more tools. Specifying a particular tool via {"type": "tool", "function": {"name": "get_weather"}} forces the model to call that tool. "none" is the default when no tools are provided. "auto" is the default if tools are provided.

or
or
top_kinteger · nullableOptional

(Unsupported) When generating next tokens, randomly selecting the next token from the k most likely options.

top_pnumber · max: 1 · nullableOptional

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. It is generally recommended to alter this or temperature but not both.

Default: 1
Responses
200

Success

application/json

Response message for /v1/messages

idstringRequired

Unique object identifier.

modelstringRequired

Model name that handled the request.

Example: latest
rolestringRequired

Role of the generated message. Always "assistant".

stop_reasonstring · nullableOptional

Reason to stop. "stop_sequence" means the inference has reached a model-defined or user-supplied stop sequence in stop. "max_tokens" means the inference result has reached models' maximum allowed token length or user defined value in max_tokens. "end_turn" or null in streaming mode when the chunk is not the last. "tool_use" means the model has called a tool and is waiting for the tool response.

stop_sequencestring · nullableOptional

Custom stop sequence used to stop the generation.

typestringRequired

Object type. This is always "message" for message types.

Example: message
post/messages
POST /v1/messages HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 88

{
  "model": "latest",
  "max_tokens": 32,
  "messages": [
    {
      "role": "user",
      "content": "Hello, world"
    }
  ]
}
{
  "id": "4f224bfb-9d53-4c82-b40a-b7cd80831ec2",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello there! \"Hello, world\" is a classic, isn't it? Whether you're just saying hi or channeling your inner coder, I'm happy to greet you back"
    }
  ],
  "model": "latest",
  "stop_reason": "max_tokens",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 9,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 32
  }
}

Last updated