v27

latestOpenAPI 3.1.0raw.githubusercontent.com2026-04-22216424765.0 KB
anthropic-messages.openapi_other

Create a Message

Anthropic-compatible endpoint.

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.

Fireworks Quickstarts:

  • Serverless Quickstart
  • Deployments Quickstart
post/v1/messages

Request body

modelstring required

The model that will complete your prompt. See the Fireworks Model Library for available models.

max_tokensinteger

The maximum number of tokens to generate before stopping.

Note that models may stop before reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.

Different models have different maximum values for this parameter. See models for details.

stop_sequencesstring[]

Custom text sequences that will cause the model to stop generating.

Models will normally stop when they have naturally completed their turn, which will result in a response stop_reason of "end_turn".

If you want the model to stop generating when it encounters custom strings of text, you can use the stop_sequences parameter. If the model encounters one of the custom sequences, the response stop_reason value will be "stop_sequence" and the response stop_sequence value will contain the matched stop sequence.

streamboolean

Whether to incrementally stream the response using server-sent events.

See streaming for details.

temperaturenumber

Amount of randomness injected into the response.

Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.

Note that even with temperature of 0.0, the results will not be fully deterministic.

top_kinteger

Only sample from the top K options for each subsequent token.

Used to remove "long tail" low probability responses. Learn more technical details here.

Recommended for advanced use cases only. You usually only need to use temperature.

top_pnumber

Use nucleus sampling.

In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by top_p. You should either alter temperature or top_p, but not both.

Recommended for advanced use cases only. You usually only need to use temperature.

raw_outputboolean nullable

Return raw output from the model.

Example request

{
  "max_tokens": 1024,
  "messages": [
    {
      "content": "Hello, world",
      "role": "user"
    }
  ],
  "model": "claude-opus-4-6"
}

Response

Message object.

idstring required

Unique object identifier.

The format and length of IDs may change over time.

type'message' required

Object type.

For Messages, this is always "message".

role'assistant' required

Conversational role of the generated message.

This will always be "assistant".

modelstring required

The model that will complete your prompt. See the Fireworks Model Library for available models.

stop_reason'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal' required
stop_sequencestring nullable required

Which custom stop sequence was generated, if any.

This value will be a non-null string if one of your custom stop sequences was generated.

Example response

{
  "content": [
    {
      "citations": null,
      "text": "Hi! How can I help you today?",
      "type": "text"
    }
  ],
  "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
  "model": "claude-opus-4-6",
  "role": "assistant",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message"
}