繁體中文
cURL
curl --request POST \ --url https://app.pathors.com/api/project/{projectId}/integration/api/chat/completions \ --header 'Authorization: <authorization>' \ --header 'Content-Type: application/json' \ --data '{ "messages": [ {} ], "stream": true, "session_id": "<string>" }'
{ "id": "<string>", "object": "<string>", "created": 123, "model": "<string>", "choices": [ {} ], "session_id": "<string>" }
使用我們的 OpenAI 兼容聊天完成 API 與任何平台整合。
role
content
{ "messages": [ { "role": "user", "content": "你好!" } ], "stream": false }
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1677858242, "model": "pathway-default", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "你好!我能幫你什麼忙?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": -1, "completion_tokens": -1, "total_tokens": -1 }, "session_id": "session-xyz789" }
stream
true
{ "id": "chatcmpl-abc123", "object": "chat.completion.chunk", "created": 1677858242, "model": "pathway-default", "choices": [ { "index": 0, "delta": { "content": "你好" }, "finish_reason": null } ], "session_id": "session-xyz789" }
finish_reason: "stop"
data: [DONE]