Skip to main content
POST
/
pydanticai
/
anthropic
/
v1
/
messages
Error
A valid request URL is required to generate request examples
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "<string>",
      "thinking": "<string>",
      "signature": "<string>",
      "data": "<string>",
      "tool_use_id": "<string>",
      "id": "<string>",
      "name": "<string>",
      "input": {},
      "server_name": "<string>",
      "content": "<string>",
      "source": {
        "type": "base64",
        "media_type": "<string>",
        "data": "<string>",
        "url": "<string>"
      },
      "cache_control": {
        "type": "ephemeral",
        "ttl": "<string>"
      },
      "citations": {
        "enabled": true
      },
      "context": "<string>",
      "title": "<string>"
    }
  ],
  "model": "<string>",
  "stop_reason": "end_turn",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123,
    "cache_creation": {
      "ephemeral_5m_input_tokens": 123,
      "ephemeral_1h_input_tokens": 123
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your provider API key or Bifrost authentication token. Virtual keys (prefixed with sk-bf-) can also be passed here.

Body

application/json
model
string
required

Model identifier (e.g., claude-3-opus-20240229)

Example:

"claude-3-opus-20240229"

max_tokens
integer
required

Maximum tokens to generate

messages
object[]
required

List of messages in the conversation

system

System prompt

cache_control
object

Automatic caching directives for the whole request

metadata
object
stream
boolean

Whether to stream the response

temperature
number
Required range: 0 <= x <= 1
top_p
number
top_k
integer
stop_sequences
string[]
tools
object[]
tool_choice
object
mcp_servers
object[]

MCP servers configuration (requires beta header)

thinking
object
output_format
object

Structured output format (requires beta header)

fallbacks
string[]

Response

Successful response

id
string
type
string
default:message
role
string
default:assistant
content
object[]
model
string
stop_reason
enum<string>
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal,
model_context_window_exceeded,
null
stop_sequence
string | null
usage
object