Пример вызова curl
Пример вызова curl
Приведенный ниже пример позволяет быстро убедиться в том, что API PuLu AI отвечает правильно.Замените {此处填写ApiKey} ключем API, созданным в консоли.
Совет
В Windows PowerShell используются обратные кавычки, а в macOS и Linux используется обратная косовая линия.Все три варианта написания полностью совпадают.
Интерфейс OpenAI Responses
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
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
}'Инфо
Ответы /v1/chat/completions преобразованы /v1/responses, некоторые программы или плагины могут быть несовместимы.Для обеспечения оптимальной совместимости и кэширования рекомендуется использовать конфигурацию инструмента.
Интерфейс Claude Messages
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
}'Заголовок запроса на аутентификацию совместим с Authorization и x-api-key и может быть выбран в зависимости от требования клиента.
Интерфейс Gemini
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": "你好"
}
]
}
]
}'