curl call example
curl call example
The following example is used to quickly confirm whether the PuLu AI API can respond normally. Please replace{此处填写ApiKey}with the API Key you created in the console.
Tips
Windows PowerShell uses backquotes to wrap, and macOS and Linux use backslashes to wrap. The three writing methods have exactly the same effect.
OpenAI Responses interface
Windows PowerShell
curl.exe https://www.puluai.com/v1/responses `
-H "Content-Type: application/json" `
-H "Authorization: Bearer {此处填写ApiKey}" `
-d '{
"model": "gpt-5.2",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "你好"
}
]
}
],
"stream": true
}'macOS
curl https://www.puluai.com/v1/responses \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {此处填写ApiKey}' \
-d '{
"model": "gpt-5.2",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "你好"
}
]
}
],
"stream": true
}'Linux
curl https://www.puluai.com/v1/responses \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {此处填写ApiKey}' \
-d '{
"model": "gpt-5.2",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "你好"
}
]
}
],
"stream": true
}'Chat Completions Interface
Windows PowerShell
curl.exe https://www.puluai.com/v1/chat/completions `
-H "Content-Type: application/json" `
-H "Authorization: Bearer {此处填写ApiKey}" `
-d '{
"model": "gpt-5.2",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream": true
}'macOS
curl https://www.puluai.com/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {此处填写ApiKey}' \
-d '{
"model": "gpt-5.2",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream": true
}'Linux
curl https://www.puluai.com/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {此处填写ApiKey}' \
-d '{
"model": "gpt-5.2",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream": true
}'Info
The response of/v1/chat/completionsis converted from/v1/responses. Some software or plug-ins may have compatibility differences. When best compatibility and caching capabilities are needed, the recommended configuration corresponding to the tool is preferred.
Claude Messages interface
Windows PowerShell
curl.exe https://www.puluai.com/v1/messages `
-H "Content-Type: application/json" `
-H "x-api-key: {此处填写ApiKey}" `
-d '{
"model": "claude-sonnet-4-5-20250929",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好",
"cache_control": { "type": "ephemeral" }
}
]
}
],
"max_tokens": 32000,
"stream": true
}'macOS
curl https://www.puluai.com/v1/messages \
-H 'Content-Type: application/json' \
-H 'x-api-key: {此处填写ApiKey}' \
-d '{
"model": "claude-sonnet-4-5-20250929",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好",
"cache_control": { "type": "ephemeral" }
}
]
}
],
"max_tokens": 32000,
"stream": true
}'Linux
curl https://www.puluai.com/v1/messages \
-H 'Content-Type: application/json' \
-H 'x-api-key: {此处填写ApiKey}' \
-d '{
"model": "claude-sonnet-4-5-20250929",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好",
"cache_control": { "type": "ephemeral" }
}
]
}
],
"max_tokens": 32000,
"stream": true
}'The authentication request header is compatible withAuthorizationandx-api-key, and can be selected according to client requirements.
Gemini interface
Windows PowerShell
curl.exe --location "https://www.puluai.com/v1beta/models/gemini-3-pro-preview:streamGenerateContent?alt=sse" `
--header "connection: keep-alive" `
--header "x-goog-api-key: {此处填写ApiKey}" `
--header "content-type: application/json" `
--data '{
"generationConfig": {
"temperature": 1
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好"
}
]
}
]
}'macOS
curl --location 'https://www.puluai.com/v1beta/models/gemini-3-pro-preview:streamGenerateContent?alt=sse' \
--header 'connection: keep-alive' \
--header 'x-goog-api-key: {此处填写ApiKey}' \
--header 'content-type: application/json' \
--data '{
"generationConfig": {
"temperature": 1
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好"
}
]
}
]
}'Linux
curl --location 'https://www.puluai.com/v1beta/models/gemini-3-pro-preview:streamGenerateContent?alt=sse' \
--header 'connection: keep-alive' \
--header 'x-goog-api-key: {此处填写ApiKey}' \
--header 'content-type: application/json' \
--data '{
"generationConfig": {
"temperature": 1
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好"
}
]
}
]
}'