claude-sonnet-4-5-20250929-thinking
File Analysis
POST
/
v1
/
messages
Authorization
- Auth Type:
Bearer Auth(In:header) - Format:
Authorization: Bearer <YOUR_API_KEY> - Description: Use
Bearer <YOUR_API_KEY>. Format:Authorization: Bearer sk-xxxxxx. - API Key: where API Key is your AGCloud API KEY
Response Examples
Show Sync Response Examples
Show Sync Response Examples
Show Sync Response Examples
Show Sync Response Examples
Show Streaming Response Examples
Show Streaming Response Examples
Async Chat Response Field Description
| Field | Type | Range | Description |
|---|---|---|---|
id | string | - | The current chat task id. |
object | string | - | The type of object returned by the API. In this case it is always task. |
status | string | pending processing success failed | Current status of the task. |
created_at | number | - | Unix timestamp (in seconds) indicating when the task was created. |
Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | ✅ | - | The model ID to use for this request. |
messages | array<object> | ✅ | - | An array of message objects representing the conversation history. See Messages Structure. |
max_tokens | integer | ✅ | 4096 | The maximum number of tokens the model can generate in the response. Range 1-32000 |
async | boolean | - | false | Whether to return an asynchronous response. Only supported for non-streaming requests. |
stream | boolean | - | false | If true, returns a stream of server-sent events (SSE) as the response is generated. |
system | string | array<object> | - | - | System prompt that sets the behavior and context for the assistant. |
temperature | number | - | 1.0 | Controls the randomness of the output. Lower values produce more focused responses, higher values produce more creative outputs. Range 0.0-1.0 |
top_p | number | - | 1.0 | Nucleus sampling parameter. The model considers tokens with top_p cumulative probability mass. Range 0.0-1.0 |
top_k | integer | - | - | Limits token selection to the K most probable tokens at each step. |
stop_sequences | array<string> | - | - | An array of strings that will stop generation when encountered. |
If both
stream and async are true, stream takes precedence.Messages Array Structure
| Field | Type | Required | Description |
|---|---|---|---|
role | string | ✅ | The role of the message. Can be: user or assistant |
content | string | array<object> | ✅ | The content of the message. Can be a simple string for text-only messages, or an array of content blocks for multimodal content. |
>content.type | string | ✅ | The type of the content block. Detail see Content.Type |
>content.text | string | ✅ if type=text | The text content of the message. |
>content.source | object | ✅ if type not text | The source of the document or image. see Multimodal input |
>>content.source.type | string | ✅ | The source type. Supported values: base64, url |
>>content.source.media_type | string | ✅ if source.type=base64 | MIME type of the file. Supported values: application/pdf, text/plain, text/markdown, text/csv, image/png, image/jpeg, image/gif, image/webp |
>>content.source.data | string | ✅ if source.type=base64 | The base64-encoded file data. |
>>content.source.url | string | ✅ if source.type=url | The URL of the file to analyze. |
Multimodal input
{
"model": "claude-haiku-4-5-20251001",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is shown in this image?"
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://robohash.org/13.png"
}
}
]
}
]
}
{
"model": "claude-haiku-4-5-20251001",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Extract key information from pdf file."
},
{
"type": "document",
"source": {
"type": "url",
"url": "https://pdfobject.com/pdf/sample.pdf"
}
}
]
}
]
}
{
"model": "claude-haiku-4-5-20251001",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is shown in this image?"
},
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/png",
"data": "base64_encoded_image_data"
}
}
]
}
]
}
{
"model": "claude-haiku-4-5-20251001",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Extract key words from this pdf fle."
},
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": "base64_encoded_pdf_data"
}
}
]
}
]
}
Content Type Description
| Field | Description |
|---|---|
text | Plain text content for the user message or assistant response. Use with the text field. |
image | Image content provided via source. Supports base64-encoded data or a URL. |
document | Document file provided via source. Use for processing PDF, plain text, Markdown, or CSV files. Supports base64-encoded data or a URL. |
file | General file content provided via source. Automatically determines handling based on the media_type. Supports base64-encoded data or a URL. |
file_data | Inline file data using base64 encoding. Provide the file content directly via data and media_type fields without a source wrapper. |
⌘I