Skip to main content
POST
/
claude-sonnet-4-5
/
v1
/
chat
/
completions
Chat Completions
curl --request POST \
  --url https://api.kie.ai/claude-sonnet-4-5/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1759055072437dqlsclj2.png"
          }
        }
      ]
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "googleSearch"
      }
    }
  ],
  "stream": true,
  "include_thoughts": true,
  "reasoning_effort": "high"
}
'
{
  "id": "chatcmpl-example-123",
  "object": "chat.completion",
  "created": 1741569952,
  "model": "claude-sonnet-4-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello, can I help you?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "service_tier": "default"
}

Streaming Support

When stream: true is set in the request, the API returns responses as server-sent events (SSE) with Content-Type: text/event-stream. This allows for progressive response delivery, where message deltas are sent incrementally as they are generated. Each event contains partial message content, enabling real-time display of responses in your application. Streaming Response Format:
  • Content-Type: text/event-stream
  • Each event line starts with data: followed by JSON
  • Events contain incremental message deltas
  • Final event indicates completion with finish_reason

Multimodal

Supports text and image inputs

Real-time Search

Web Access grounding enabled

Streaming

Server-sent events support

Flexible Roles

Multiple message roles supported

Unified Media File Format

In the messages parameter’s content array, whether it’s images, videos, audio, or other document types, all media files use the same format structure:
  • The type field is always "image_url"
  • The image_url field name remains unchanged
  • The only thing that changes is the url value, which points to the corresponding media file address
For example: images, videos, audio, PDFs, and other documents all use the same { type: 'image_url', image_url: { url: '...' } } structure.

Tools Parameter

The tools parameter is an optional array that allows you to define functions the model can call. The array can contain multiple objects.
Use this format to enable Web Access grounding:
{
  "type": "function",
  "function": {
    "name": "googleSearch"
  }
}
This enables real-time information retrieval via Web Access.
{
  "id": "chatcmpl-example-123",
  "object": "chat.completion",
  "created": 1741569952,
  "model": "claude-sonnet-4-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello, can I help you?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "service_tier": "default"
}

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
messages
object[]
required

An array of message objects. Each message has a role and content.

Unified Media File Format:

In the content array, whether it's images, videos, audio, or other document types, all media files use the same format structure:

  • The type field is always "image_url"
  • The image_url field name remains unchanged
  • The only thing that changes is the url value, which points to the corresponding media file address

For example: images, videos, audio, PDFs, and other documents all use the same { type: 'image_url', image_url: { url: '...' } } structure.

Minimum array length: 1
stream
boolean
default:true

If set to true, partial message deltas will be sent as server-sent events. Default is true.

tools
object[]

An optional array of tools the model may call.

  • Web Access: {"type": "function", "function": {"name": "googleSearch"}}
include_thoughts
boolean
default:true

Whether to enable thinking for the model. When set to true, the model performs internal thinking (the thinking process is not output in the response). When set to false, the model does not perform thinking. Default is true.

reasoning_effort
enum<string>
default:high

The effort level for the model to use for reasoning. Low effort is faster to respond, high effort is slower to respond but solves more complex problems. Default is "high".

Available options:
low,
high

Response

Request successful. Returns the standard chat completion format.

id
string

Unique identifier for the chat completion

Example:

"chatcmpl-example-123"

object
string

Object type

Example:

"chat.completion"

created
integer<int64>

Unix timestamp of when the completion was created

Example:

1677652288

model
string

Model name

Example:

"claude-sonnet-4-5"

choices
object[]

Array of completion choices

usage
object