- Introduction
- Quick Start Guide
- Make a request
- Chat Models
- ChatGpt
- ChatGPT (Audio)
- ChatGPT (Chat)
- Chat completion object
- Create chat completion (streaming)
- Create chat completion (non-streaming)
- Create chat image recognition (streaming)
- Create chat image recognition (streaming) base64
- Create chat image recognition (non-streaming)
- Function calling
- N choices
- Create chat function call (only non-streaming)
- Create structured output
- ChatGPT (Completions)
- ChatGPT(Embeddings)
- Anthropic Claude
- Gemini
- Image Models
- GPT-IMAGE-1
- MJ
- Ideogram
- Kling Image
- Flux
- Recraft API
- Models use Dall-e Format
- DALL·E 3POST
- Video Models
- Kling Video
- Runway ML Video
- Luma Video
- Pika Video
- Google Veo
- Minimax - Hailuo
- Music Model - Suno
- Python Samples
- python openai official library (using AutoGPT, langchain, etc.)
- Python uses speech to text
- Python uses text to speech
- Python uses Embeddings
- python calls DALL·E
- python simple call openai function-calling demo
- python langchain
- python llama_index
- Python uses gpt-4o to identify pictures-local pictures
- python library streaming output
- Python uses gpt-4o to identify images
- Plug-in/software usage tutorials
- Help Center
- Tutorials
Messages(Web search)
POST
/v1/messages
Request
Header Params
Authorization
string
optional
Body Params application/json
model
string
required
max_tokens
integer
required
messages
array [object {2}]
required
role
string
optional
content
string
optional
tools
array [object {5}]
required
type
string
optional
name
string
optional
max_uses
integer
optional
description
string
optional
input_schema
object
optional
Example
{
"model": "claude-3-7-sonnet-20250219",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "How do I update a web app to TypeScript 5.5?"
}
],
"tools": [
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5
}
]
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1/messages' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-3-7-sonnet-20250219",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "How do I update a web app to TypeScript 5.5?"
}
],
"tools": [
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5
}
]
}'
Responses
🟢200OK
application/json
Body
id
string
required
type
string
required
role
string
required
content
array [object {2}]
required
type
string
optional
text
string
optional
stop_reason
string
required
model
string
required
usage
object
required
input_tokens
integer
required
cache_creation_input_tokens
integer
required
cache_read_input_tokens
integer
required
output_tokens
integer
required
Example
{
"id": "chatcmpl-89D7UVB9Lac3rIZD7Wgt69AT33Njf",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": " I don't see any image in your message. Could you please upload or share the image you'd like me to describe? Once you do, I'll be happy to provide a detailed description of what I see."
}
],
"stop_reason": "end_turn",
"model": "claude-sonnet-4-20250514",
"usage": {
"input_tokens": 96,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"output_tokens": 43
}
}
Modified at 2025-06-13 15:24:34