curl呼び出しの例
curl呼び出しの例
次の例では、PuLu AI APIが正常に応答するかどうかをすばやく確認できます。{此处填写ApiKey}を、コンソールで作成したAPIキーに置き換えてください。
ヒント
Windows Power Shellではバッククォート、macOSとLinuxではバックスラッシュで折り返す。3つの文章は完全に一致する。
Open AI Responsesインターフェイス
Windows Power Shell
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
}'チャット完了インタフェース
Windows Power Shell
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 Power Shell
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 Power Shell
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": "你好"
}
]
}
]
}'