สร้างการตอบกลับ (OpenAI Responses API)
post/v1/responses
สร้างการตอบกลับของโมเดลผ่าน OpenAI Responses API รองรับบทสนทนาหลายรอบ การเรียกใช้เครื่องมือ และการให้เหตุผล
การยืนยันตัวตน
ส่งคีย์ API ของ OLETOKEN เป็น Bearer token สร้างคีย์ได้ที่หน้า API Keys ในคอนโซล
Authorization: Bearer $OLETOKEN_API_KEYเนื้อหาคำขอ
Content-Type:application/json
| ฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| model | string | — | |
| input | string | object[] | — | อินพุต ซึ่งเป็นสตริงหรืออาร์เรย์ของข้อความ |
| instructions | string | — | — |
| max_output_tokens | integer | — | — |
| temperature | number | — | — |
| top_p | number | — | — |
| stream | boolean | — | — |
| tools | object[] | — | — |
| tool_choice | string | object | — | — |
| reasoning | object | — | — |
| effort | stringlowmediumhigh | — | — |
| summary | string | — | — |
| previous_response_id | string | — | — |
| truncation | stringautodisabled | — | — |
การตอบกลับ
200สร้างการตอบกลับแล้ว
| ฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| id | string | — | — |
| object | string | — | — |
| created_at | integer | — | — |
| status | stringcompletedfailedin_progressincomplete | — | — |
| model | string | — | — |
| output | object[] | — | — |
| type | string | — | — |
| id | string | — | — |
| status | string | — | — |
| role | string | — | — |
| content | object[] | — | — |
| type | string | — | — |
| text | string | — | — |
| usage | Usage | — | — |
| prompt_tokens | integer | — | จำนวนโทเค็นของพรอมต์ |
| completion_tokens | integer | — | จำนวนโทเค็นคำตอบ |
| total_tokens | integer | — | จำนวนโทเค็นทั้งหมด |
| prompt_tokens_details | object | — | — |
| cached_tokens | integer | — | — |
| text_tokens | integer | — | — |
| audio_tokens | integer | — | — |
| image_tokens | integer | — | — |
| completion_tokens_details | object | — | — |
| text_tokens | integer | — | — |
| audio_tokens | integer | — | — |
| reasoning_tokens | integer | — | — |
ตัวอย่างคำขอ
curl -X POST 'https://api.oletoken.ai/v1/responses' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "string"
}'
