For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create A Message

Create a message

post
Header parameters
AuthorizationstringRequiredExample: sk-lZxz
Body
modelstringRequired
max_tokensintegerRequired
systemstringRequired
stop_sequencesstring[]Required
temperaturenumberRequired
top_pnumberRequired
top_kintegerRequired
service_tierstringRequired
streambooleanRequired
context_managementnullRequired
Responses
200Success
application/json
costnumberRequired
idstringRequired
modelstringRequired
rolestringRequired
stop_reasonstringRequired
typestringRequired
post/v1/messages
POST /v1/messages HTTP/1.1
Host: llm.onerouter.pro
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 3398

{
  "model": "anthropic/claude-opus-4.6",
  "messages": [
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ],
  "max_tokens": 4096,
  "system": "You are a rigorous enterprise-grade information extraction assistant.",
  "metadata": {
    "user_id": "9d3d8d44-2c14-4c28-9d9a-7c9e6b97a001"
  },
  "stop_sequences": [
    "\n\nHuman:",
    "<END_JSON>"
  ],
  "temperature": 0.2,
  "top_p": 0.95,
  "top_k": 40,
  "tools": [
    {
      "name": "get_weather_forecast",
      "description": "Get the weather forecast for the next 3 days for a specified city.",
      "input_schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "location": {
            "type": "string",
            "description": "City or region name, for example Shanghai"
          },
          "units": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ],
            "description": "Temperature unit"
          },
          "days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7,
            "description": "Number of days to query"
          }
        },
        "required": [
          "location"
        ]
      }
    },
    {
      "name": "lookup_customer_profile",
      "description": "Look up customer profile information based on customer_id.",
      "input_schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "customer_id": {
            "type": "string",
            "description": "Unique customer ID"
          },
          "include_orders": {
            "type": "boolean",
            "description": "Whether to return recent orders"
          },
          "include_risk_flags": {
            "type": "boolean",
            "description": "Whether to return risk control flags"
          }
        },
        "required": [
          "customer_id"
        ]
      }
    }
  ],
  "tool_choice": {
    "type": "auto",
    "disable_parallel_tool_use": false
  },
  "thinking": {
    "type": "enabled",
    "budget_tokens": 2048
  },
  "service_tier": "standard_only",
  "output_config": {
    "effort": "max",
    "format": {
      "type": "json_schema",
      "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "task_id": {
            "type": "string",
            "description": "Unique task identifier"
          },
          "language": {
            "type": "string",
            "description": "Output language, for example zh-CN"
          },
          "summary": {
            "type": "string",
            "description": "Core summary"
          },
          "entities": {
            "type": "array",
            "description": "Recognized key entities",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "required": [
                "name",
                "type",
                "confidence"
              ]
            }
          },
          "facts": {
            "type": "array",
            "description": "List of extracted facts",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "field": {
                  "type": "string"
                },
                "value": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "source_quote": {
                  "type": "string"
                }
              },
              "required": [
                "field",
                "value"
              ]
            }
          },
          "citations": {
            "type": "array",
            "description": "Source citations",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "source_id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "source_id",
                "title",
                "url"
              ]
            }
          },
          "tool_calls_used": {
            "type": "array",
            "description": "Names of tools actually used",
            "items": {
              "type": "string"
            }
          },
          "confidence_overall": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "task_id",
          "language",
          "summary",
          "entities",
          "facts",
          "citations",
          "tool_calls_used",
          "confidence_overall"
        ]
      }
    }
  },
  "cache_control": {
    "type": "ephemeral",
    "ttl": "1h"
  },
  "stream": false,
  "stream_options": {
    "include_usage": true
  },
  "usage": {
    "include": true
  },
  "context_management": null,
  "provider": {
    "order": [
      "anthropic",
      "amazon-bedrock"
    ],
    "allow_fallbacks": true,
    "require_parameters": false,
    "data_collection": "allow",
    "zdr": false,
    "enforce_distillable_text": false,
    "only": [],
    "ignore": [],
    "quantizations": [],
    "sort": "throughput",
    "preferred_min_throughput": {
      "p50": 4,
      "p75": 3,
      "p90": 2,
      "p99": 1
    },
    "preferred_max_latency": {
      "p50": 20,
      "p75": 30,
      "p90": 40,
      "p99": 50
    }
  }
}
200Success
{
  "content": [
    {
      "text": "Hello! I'm doing well, thank you for asking! 😊\n\nI'm here and ready to help you. Whether you need to look up customer information, check a weather forecast, or anything else I can assist with, feel free to let me know. What can I do for you today?",
      "type": "text"
    }
  ],
  "cost": 0.008393,
  "cost_details": {
    "audio_cost": 0,
    "byok_cost": 0,
    "completion_cost": 0.0024375,
    "discount_rate": 1,
    "image_cost": 0,
    "is_byok": false,
    "native_web_search_cost": 0,
    "plugin_web_search_cost": 0,
    "prompt_cache_read_cost": 0,
    "prompt_cache_write_1_h": 0,
    "prompt_cache_write_5_min": 0,
    "prompt_cache_write_cost": 0,
    "prompt_cost": 0.005955,
    "reasoning_cost": 0,
    "tools_cost": 0,
    "video_cost": 0
  },
  "id": "gen-1774272969-DXyKYopTSDz6HSqTApSN",
  "model": "anthropic/claude-opus-4.6",
  "role": "assistant",
  "stop_reason": "end_turn",
  "type": "message",
  "usage": {
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "input_tokens": 794,
    "output_tokens": 65
  }
}

Last updated