Skip to main content
POST
https://app.firmware.ai
/
api
/
v1
/
messages
Messages
curl --request POST \
  --url https://app.firmware.ai/api/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "max_tokens": 123,
  "messages": [
    {}
  ],
  "stream": true,
  "system": {},
  "temperature": 123,
  "stop_sequences": [
    {}
  ],
  "tools": [
    {}
  ],
  "tool_choice": {}
}
'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "model": "claude-3-5-sonnet-20241022",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help you today?"
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 10,
    "output_tokens": 12
  }
}
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. The Messages API can be used for either single queries or stateless multi-turn conversations.

Authenticate

Use an API key in the Authorization header.
curl https://app.firmware.ai/api/v1/messages \
  -H "Authorization: Bearer $FIRMWARE_API_KEY"

Request body

model
string
required
Anthropic model ID to use. See available models for the full list.
max_tokens
integer
required
The maximum number of tokens to generate before stopping.
messages
array
required
Conversation turns as an array of { role, content } objects.
[
  { "role": "user", "content": "Hello, Claude" }
]
content may be a string or an array of content blocks (e.g. { "type": "text", "text": "..." }).
stream
boolean
default:"false"
Enable Server-Sent Events streaming for the response.
system
string | array
System prompt.
temperature
number
Sampling temperature.
stop_sequences
array
Custom stop sequences.
tools
array
List of tools the model may call.
tool_choice
object
Controls tool calling behavior.

Examples

curl https://app.firmware.ai/api/v1/messages \
  -H "Authorization: Bearer $FIRMWARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 256,
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Response

Returns an Anthropic-compatible message object. If stream=true, the response is an SSE stream (text/event-stream).
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "model": "claude-3-5-sonnet-20241022",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help you today?"
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 10,
    "output_tokens": 12
  }
}