New: Audio API, Embeddings & Realtime WebSocket now available!
osmAPI LogoosmAPI

Anthropic Messages

Create a message using Anthropic's API format

POST
/v1/messages
AuthorizationBearer <token>

Bearer token authentication using API keys

In: header

modelstring

The model to use for completion

messages

Array of message objects

max_tokensnumber

Maximum number of tokens to generate

Range1 <= value
system?string|
temperature?number

Sampling temperature between 0 and 1

Range0 <= value <= 1
tools?

Available tools for the model to use

stream?boolean

Whether to stream the response

Defaultfalse
tool_choice?
stop_sequences?array<string>

Custom text sequences that will cause the model to stop generating

top_p?number

Nucleus sampling parameter

Range0 <= value <= 1
top_k?integer

Top-k sampling parameter

Range0 <= value
thinking?

Extended thinking configuration for reasoning models

metadata?

Metadata about the request

service_tier?string

Service tier for the request

Response Body

curl -X POST "https://api.osmapi.com/v1/messages" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-3-5-sonnet-20241022",    "messages": [      {        "role": "user",        "content": "string"      }    ],    "max_tokens": 1024  }'
{
  "id": "string",
  "type": "message",
  "role": "assistant",
  "model": "string",
  "content": [
    {
      "type": "text",
      "text": "string",
      "thinking": "string",
      "id": "string",
      "name": "string",
      "input": {
        "property1": null,
        "property2": null
      }
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": "string",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  }
}

How is this guide?