Anthropic Messages

Changed on

Create a message using Anthropic's API format

post/v1/messages

Request

  • Base URL
    https://api.llmgateway.io
  • Auth
    HTTP bearer

Request body

modelstring required

The model to use for completion

max_tokensnumber required

Maximum number of tokens to generate

temperaturenumber

Sampling temperature between 0 and 1

streamboolean

Whether to stream the response

Example request

{
  "model": "claude-3-5-sonnet-20241022",
  "max_tokens": 1024,
  "temperature": 0.7
}

Response

Successful response

idstring required
type'message' required
role'assistant' required
modelstring required
stop_reason'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal' | 'null' nullable required
stop_sequencestring nullable required
metadataobject

Gateway routing metadata, the same object /v1/chat/completions returns: used_provider, used_model, used_region and routing attempts. On streams it rides on the message_delta event.

safeguard_resultsobject[]

Anthropic's server-side safeguard verdicts, returned verbatim when the request carried safeguards. On streams it rides on the message_delta event's delta.

Changes

    • breaking

      removed subschema #7 subschema #8 subschema #9 subschema #10 from the //// request property anyOf list

    • warning

      added the new undefined enum value to the response property for the response status

    • info

      added subschema #7 subschema #8 subschema #9 subschema #10 to the //// request property anyOf list

    • info

      added the new optional request property /////////

    • info

      added the new optional request property ///