Claude · Schema
CreateMessageRequest
Artificial IntelligenceChatbotConversational AIGenerative AILarge Language ModelsMachine LearningNatural Language Processing
Properties
| Name | Type | Description |
|---|---|---|
| model | string | The model that will complete your prompt. See the list of available models. |
| max_tokens | integer | The maximum number of tokens to generate before stopping. Different models support different maximum values. |
| messages | array | Input messages. Alternating user and assistant conversational turns. Maximum 100,000 messages per request. |
| system | object | System prompt providing context and instructions to Claude. Can be a string or array of content blocks. |
| temperature | number | Amount of randomness injected into the response. Ranges from 0.0 to 1.0. Use closer to 0.0 for analytical tasks, closer to 1.0 for creative tasks. |
| top_p | number | Use nucleus sampling. Recommended to use either temperature or top_p, but not both. |
| top_k | integer | Only sample from the top K options for each subsequent token. |
| stop_sequences | array | Custom text sequences that will cause the model to stop generating. |
| stream | boolean | Whether to incrementally stream the response using server-sent events. |
| metadata | object | |
| tools | array | Definitions of tools that the model may use. |
| tool_choice | object | |
| thinking | object | |
| output_config | object | |
| service_tier | string | Service tier to use for this request. |
| cache_control | object |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "#/components/schemas/CreateMessageRequest",
"title": "CreateMessageRequest",
"type": "object",
"required": [
"model",
"max_tokens",
"messages"
],
"properties": {
"model": {
"type": "string",
"description": "The model that will complete your prompt. See the list of available models.",
"example": "claude-sonnet-4-6"
},
"max_tokens": {
"type": "integer",
"description": "The maximum number of tokens to generate before stopping. Different models support different maximum values.",
"minimum": 1,
"example": 1024
},
"messages": {
"type": "array",
"description": "Input messages. Alternating user and assistant conversational turns. Maximum 100,000 messages per request.",
"items": {
"$ref": "#/components/schemas/MessageParam"
},
"minItems": 1,
"example": []
},
"system": {
"description": "System prompt providing context and instructions to Claude. Can be a string or array of content blocks.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/TextBlockParam"
}
}
],
"example": "example_value"
},
"temperature": {
"type": "number",
"description": "Amount of randomness injected into the response. Ranges from 0.0 to 1.0. Use closer to 0.0 for analytical tasks, closer to 1.0 for creative tasks.",
"minimum": 0.0,
"maximum": 1.0,
"default": 1.0,
"example": 42.5
},
"top_p": {
"type": "number",
"description": "Use nucleus sampling. Recommended to use either temperature or top_p, but not both.",
"minimum": 0.0,
"maximum": 1.0,
"example": 42.5
},
"top_k": {
"type": "integer",
"description": "Only sample from the top K options for each subsequent token.",
"minimum": 1,
"example": 10
},
"stop_sequences": {
"type": "array",
"description": "Custom text sequences that will cause the model to stop generating.",
"items": {
"type": "string"
},
"example": []
},
"stream": {
"type": "boolean",
"description": "Whether to incrementally stream the response using server-sent events.",
"default": false,
"example": true
},
"metadata": {
"$ref": "#/components/schemas/Metadata"
},
"tools": {
"type": "array",
"description": "Definitions of tools that the model may use.",
"items": {
"$ref": "#/components/schemas/Tool"
},
"example": []
},
"tool_choice": {
"$ref": "#/components/schemas/ToolChoice"
},
"thinking": {
"$ref": "#/components/schemas/ThinkingConfig"
},
"output_config": {
"$ref": "#/components/schemas/OutputConfig"
},
"service_tier": {
"type": "string",
"description": "Service tier to use for this request.",
"enum": [
"auto",
"standard_only"
],
"default": "auto",
"example": "auto"
},
"cache_control": {
"$ref": "#/components/schemas/CacheControl"
}
}
}