template.en.mdx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # Completion App API
  4. The text generation application offers non-session support and is ideal for translation, article writing, summarization AI, and more.
  5. <div>
  6. ### Base URL
  7. <CodeGroup title="Code" targetCode={props.appDetail.api_base_url}>
  8. ```javascript
  9. ```
  10. </CodeGroup>
  11. ### Authentication
  12. The Service API uses `API-Key` authentication.
  13. <i>**Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.**</i>
  14. For all API requests, include your API Key in the `Authorization` HTTP Header, as shown below:
  15. <CodeGroup title="Code">
  16. ```javascript
  17. Authorization: Bearer {API_KEY}
  18. ```
  19. </CodeGroup>
  20. </div>
  21. ---
  22. <Heading
  23. url='/completion-messages'
  24. method='POST'
  25. title='Create Completion Message'
  26. name='#Create-Completion-Message'
  27. />
  28. <Row>
  29. <Col>
  30. Send a request to the text generation application.
  31. ### Request Body
  32. <Properties>
  33. <Property name='inputs' type='object' key='inputs'>
  34. Allows the entry of various variable values defined by the App.
  35. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable.
  36. The text generation application requires at least one key/value pair to be inputted.
  37. - `query` (string) Required
  38. The input text, the content to be processed.
  39. </Property>
  40. <Property name='response_mode' type='string' key='response_mode'>
  41. The mode of response return, supporting:
  42. - `streaming` Streaming mode (recommended), implements a typewriter-like output through SSE ([Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)).
  43. - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long)
  44. <i>Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.</i>
  45. </Property>
  46. <Property name='user' type='string' key='user'>
  47. User identifier, used to define the identity of the end-user for retrieval and statistics.
  48. Should be uniquely defined by the developer within the application.
  49. </Property>
  50. <Property name='files' type='array[object]' key='files'>
  51. File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.
  52. - `type` (string) Supported type: `image` (currently only supports image type)
  53. - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload
  54. - `url` (string) Image URL (when the transfer method is `remote_url`)
  55. - `upload_file_id` (string) Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)
  56. </Property>
  57. </Properties>
  58. ### Response
  59. When `response_mode` is `blocking`, return a CompletionResponse object.
  60. When `response_mode` is `streaming`, return a ChunkCompletionResponse stream.
  61. ### ChatCompletionResponse
  62. Returns the complete App result, `Content-Type` is `application/json`.
  63. - `message_id` (string) Unique message ID
  64. - `mode` (string) App mode, fixed as `chat`
  65. - `answer` (string) Complete response content
  66. - `metadata` (object) Metadata
  67. - `usage` (Usage) Model usage information
  68. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  69. - `created_at` (int) Message creation timestamp, e.g., 1705395332
  70. ### ChunkChatCompletionResponse
  71. Returns the stream chunks outputted by the App, `Content-Type` is `text/event-stream`.
  72. Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
  73. <CodeGroup>
  74. ```streaming {{ title: 'Response' }}
  75. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  76. ```
  77. </CodeGroup>
  78. The structure of the streaming chunks varies depending on the `event`:
  79. - `event: message` LLM returns text chunk event, i.e., the complete text is output in a chunked fashion.
  80. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  81. - `message_id` (string) Unique message ID
  82. - `answer` (string) LLM returned text chunk content
  83. - `created_at` (int) Creation timestamp, e.g., 1705395332
  84. - `event: message_end` Message end event, receiving this event means streaming has ended.
  85. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  86. - `message_id` (string) Unique message ID
  87. - `metadata` (object) Metadata
  88. - `usage` (Usage) Model usage information
  89. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  90. - `event: tts_message` TTS audio stream event, that is, speech synthesis output. The content is an audio block in Mp3 format, encoded as a base64 string. When playing, simply decode the base64 and feed it into the player. (This message is available only when auto-play is enabled)
  91. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  92. - `message_id` (string) Unique message ID
  93. - `audio` (string) The audio after speech synthesis, encoded in base64 text content, when playing, simply decode the base64 and feed it into the player
  94. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  95. - `event: tts_message_end` TTS audio stream end event, receiving this event indicates the end of the audio stream.
  96. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  97. - `message_id` (string) Unique message ID
  98. - `audio` (string) The end event has no audio, so this is an empty string
  99. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  100. - `event: message_replace` Message content replacement event.
  101. When output content moderation is enabled, if the content is flagged, then the message content will be replaced with a preset reply through this event.
  102. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  103. - `message_id` (string) Unique message ID
  104. - `answer` (string) Replacement content (directly replaces all LLM reply text)
  105. - `created_at` (int) Creation timestamp, e.g., 1705395332
  106. - `event: error`
  107. Exceptions that occur during the streaming process will be output in the form of stream events, and reception of an error event will end the stream.
  108. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  109. - `message_id` (string) Unique message ID
  110. - `status` (int) HTTP status code
  111. - `code` (string) Error code
  112. - `message` (string) Error message
  113. - `event: ping` Ping event every 10 seconds to keep the connection alive.
  114. ### Errors
  115. - 404, Conversation does not exists
  116. - 400, `invalid_param`, abnormal parameter input
  117. - 400, `app_unavailable`, App configuration unavailable
  118. - 400, `provider_not_initialize`, no available model credential configuration
  119. - 400, `provider_quota_exceeded`, model invocation quota insufficient
  120. - 400, `model_currently_not_support`, current model unavailable
  121. - 400, `completion_request_error`, text generation failed
  122. - 500, internal server error
  123. </Col>
  124. <Col sticky>
  125. <CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": {"query": "Hello, world!"},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}>
  126. ```bash {{ title: 'cURL' }}
  127. curl -X POST '${props.appDetail.api_base_url}/completion-messages' \
  128. --header 'Authorization: Bearer {api_key}' \
  129. --header 'Content-Type: application/json' \
  130. --data-raw '{
  131. "inputs": {
  132. "query": "Hello, world!"
  133. },
  134. "response_mode": "streaming",
  135. "user": "abc-123"
  136. }'
  137. ```
  138. </CodeGroup>
  139. ### Blocking Mode
  140. <CodeGroup title="Response">
  141. ```json {{ title: 'Response' }}
  142. {
  143. "event": "message",
  144. "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  145. "mode": "completion",
  146. "answer": "Hello World!...",
  147. "metadata": {
  148. "usage": {
  149. "prompt_tokens": 1033,
  150. "prompt_unit_price": "0.001",
  151. "prompt_price_unit": "0.001",
  152. "prompt_price": "0.0010330",
  153. "completion_tokens": 128,
  154. "completion_unit_price": "0.002",
  155. "completion_price_unit": "0.001",
  156. "completion_price": "0.0002560",
  157. "total_tokens": 1161,
  158. "total_price": "0.0012890",
  159. "currency": "USD",
  160. "latency": 0.7682376249867957
  161. }
  162. },
  163. "created_at": 1705407629
  164. }
  165. ```
  166. </CodeGroup>
  167. ### Streaming Mode
  168. <CodeGroup title="Response">
  169. ```streaming {{ title: 'Response' }}
  170. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " I", "created_at": 1679586595}
  171. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": "'m", "created_at": 1679586595}
  172. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " glad", "created_at": 1679586595}
  173. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " to", "created_at": 1679586595}
  174. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " meet", "created_at": 1679586595}
  175. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " you", "created_at": 1679586595}
  176. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}}}
  177. data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
  178. data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
  179. ```
  180. </CodeGroup>
  181. </Col>
  182. </Row>
  183. ---
  184. <Heading
  185. url='/files/upload'
  186. method='POST'
  187. title='File Upload'
  188. name='#file-upload'
  189. />
  190. <Row>
  191. <Col>
  192. Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text.
  193. Supports png, jpg, jpeg, webp, gif formats.
  194. <i>Uploaded files are for use by the current end-user only.</i>
  195. ### Request Body
  196. This interface requires a `multipart/form-data` request.
  197. - `file` (File) Required
  198. The file to be uploaded.
  199. - `user` (string) Required
  200. User identifier, defined by the developer's rules, must be unique within the application.
  201. ### Response
  202. After a successful upload, the server will return the file's ID and related information.
  203. - `id` (uuid) ID
  204. - `name` (string) File name
  205. - `size` (int) File size (bytes)
  206. - `extension` (string) File extension
  207. - `mime_type` (string) File mime-type
  208. - `created_by` (uuid) End-user ID
  209. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  210. ### Errors
  211. - 400, `no_file_uploaded`, a file must be provided
  212. - 400, `too_many_files`, currently only one file is accepted
  213. - 400, `unsupported_preview`, the file does not support preview
  214. - 400, `unsupported_estimate`, the file does not support estimation
  215. - 413, `file_too_large`, the file is too large
  216. - 415, `unsupported_file_type`, unsupported extension, currently only document files are accepted
  217. - 503, `s3_connection_failed`, unable to connect to S3 service
  218. - 503, `s3_permission_denied`, no permission to upload files to S3
  219. - 503, `s3_file_too_large`, file exceeds S3 size limit
  220. - 500, internal server error
  221. </Col>
  222. <Col sticky>
  223. ### Request Example
  224. <CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
  225. ```bash {{ title: 'cURL' }}
  226. curl -X POST '${props.appDetail.api_base_url}/files/upload' \
  227. --header 'Authorization: Bearer {api_key}' \
  228. --form 'file=@"/path/to/file"'
  229. ```
  230. </CodeGroup>
  231. ### Response Example
  232. <CodeGroup title="Response">
  233. ```json {{ title: 'Response' }}
  234. {
  235. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  236. "name": "example.png",
  237. "size": 1024,
  238. "extension": "png",
  239. "mime_type": "image/png",
  240. "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
  241. "created_at": 1577836800,
  242. }
  243. ```
  244. </CodeGroup>
  245. </Col>
  246. </Row>
  247. ---
  248. <Heading
  249. url='/completion-messages/:task_id/stop'
  250. method='POST'
  251. title='Stop Generate'
  252. name='#stop-generatebacks'
  253. />
  254. <Row>
  255. <Col>
  256. Only supported in streaming mode.
  257. ### Path
  258. - `task_id` (string) Task ID, can be obtained from the streaming chunk return
  259. Request Body
  260. - `user` (string) Required
  261. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface.
  262. ### Response
  263. - `result` (string) Always returns "success"
  264. </Col>
  265. <Col sticky>
  266. ### Request Example
  267. <CodeGroup title="Request" tag="POST" label="/completion-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}>
  268. ```bash {{ title: 'cURL' }}
  269. curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \
  270. -H 'Authorization: Bearer {api_key}' \
  271. -H 'Content-Type: application/json' \
  272. --data-raw '{
  273. "user": "abc-123"
  274. }'
  275. ```
  276. </CodeGroup>
  277. ### Response Example
  278. <CodeGroup title="Response">
  279. ```json {{ title: 'Response' }}
  280. {
  281. "result": "success"
  282. }
  283. ```
  284. </CodeGroup>
  285. </Col>
  286. </Row>
  287. ---
  288. <Heading
  289. url='/messages/:message_id/feedbacks'
  290. method='POST'
  291. title='Message Feedback'
  292. name='#feedbacks'
  293. />
  294. <Row>
  295. <Col>
  296. End-users can provide feedback messages, facilitating application developers to optimize expected outputs.
  297. ### Path
  298. <Properties>
  299. <Property name='message_id' type='string' key='message_id'>
  300. Message ID
  301. </Property>
  302. </Properties>
  303. ### Request Body
  304. <Properties>
  305. <Property name='rating' type='string' key='rating'>
  306. Upvote as `like`, downvote as `dislike`, revoke upvote as `null`
  307. </Property>
  308. <Property name='user' type='string' key='user'>
  309. User identifier, defined by the developer's rules, must be unique within the application.
  310. </Property>
  311. </Properties>
  312. ### Response
  313. - `result` (string) Always returns "success"
  314. </Col>
  315. <Col sticky>
  316. <CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}>
  317. ```bash {{ title: 'cURL' }}
  318. curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \
  319. --header 'Authorization: Bearer {api_key}' \
  320. --header 'Content-Type: application/json' \
  321. --data-raw '{
  322. "rating": "like",
  323. "user": "abc-123"
  324. }'
  325. ```
  326. </CodeGroup>
  327. <CodeGroup title="Response">
  328. ```json {{ title: 'Response' }}
  329. {
  330. "result": "success"
  331. }
  332. ```
  333. </CodeGroup>
  334. </Col>
  335. </Row>
  336. ---
  337. <Heading
  338. url='/parameters'
  339. method='GET'
  340. title='Get Application Information'
  341. name='#parameters'
  342. />
  343. <Row>
  344. <Col>
  345. Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
  346. ### Query
  347. <Properties>
  348. <Property name='user' type='string' key='user'>
  349. User identifier, defined by the developer's rules, must be unique within the application.
  350. </Property>
  351. </Properties>
  352. ### Response
  353. - `opening_statement` (string) Opening statement
  354. - `suggested_questions` (array[string]) List of suggested questions for the opening
  355. - `suggested_questions_after_answer` (object) Suggest questions after enabling the answer.
  356. - `enabled` (bool) Whether it is enabled
  357. - `speech_to_text` (object) Speech to text
  358. - `enabled` (bool) Whether it is enabled
  359. - `retriever_resource` (object) Citation and Attribution
  360. - `enabled` (bool) Whether it is enabled
  361. - `annotation_reply` (object) Annotation reply
  362. - `enabled` (bool) Whether it is enabled
  363. - `user_input_form` (array[object]) User input form configuration
  364. - `text-input` (object) Text input control
  365. - `label` (string) Variable display label name
  366. - `variable` (string) Variable ID
  367. - `required` (bool) Whether it is required
  368. - `default` (string) Default value
  369. - `paragraph` (object) Paragraph text input control
  370. - `label` (string) Variable display label name
  371. - `variable` (string) Variable ID
  372. - `required` (bool) Whether it is required
  373. - `default` (string) Default value
  374. - `select` (object) Dropdown control
  375. - `label` (string) Variable display label name
  376. - `variable` (string) Variable ID
  377. - `required` (bool) Whether it is required
  378. - `default` (string) Default value
  379. - `options` (array[string]) Option values
  380. - `file_upload` (object) File upload configuration
  381. - `image` (object) Image settings
  382. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
  383. - `enabled` (bool) Whether it is enabled
  384. - `number_limits` (int) Image number limit, default is 3
  385. - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
  386. - `system_parameters` (object) System parameters
  387. - `file_size_limit` (int) Document upload size limit (MB)
  388. - `image_file_size_limit` (int) Image file upload size limit (MB)
  389. - `audio_file_size_limit` (int) Audio file upload size limit (MB)
  390. - `video_file_size_limit` (int) Video file upload size limit (MB)
  391. </Col>
  392. <Col sticky>
  393. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}>
  394. ```bash {{ title: 'cURL' }}
  395. curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
  396. --header 'Authorization: Bearer {api_key}'
  397. ```
  398. </CodeGroup>
  399. <CodeGroup title="Response">
  400. ```json {{ title: 'Response' }}
  401. {
  402. "opening_statement": "Hello!",
  403. "suggested_questions_after_answer": {
  404. "enabled": true
  405. },
  406. "speech_to_text": {
  407. "enabled": true
  408. },
  409. "retriever_resource": {
  410. "enabled": true
  411. },
  412. "annotation_reply": {
  413. "enabled": true
  414. },
  415. "user_input_form": [
  416. {
  417. "paragraph": {
  418. "label": "Query",
  419. "variable": "query",
  420. "required": true,
  421. "default": ""
  422. }
  423. }
  424. ],
  425. "file_upload": {
  426. "image": {
  427. "enabled": false,
  428. "number_limits": 3,
  429. "detail": "high",
  430. "transfer_methods": [
  431. "remote_url",
  432. "local_file"
  433. ]
  434. }
  435. },
  436. "system_parameters": {
  437. "file_size_limit": 15,
  438. "image_file_size_limit": 10,
  439. "audio_file_size_limit": 50,
  440. "video_file_size_limit": 100
  441. }
  442. }
  443. ```
  444. </CodeGroup>
  445. </Col>
  446. </Row>
  447. ---
  448. <Heading
  449. url='/text-to-audio'
  450. method='POST'
  451. title='text to audio'
  452. name='#audio'
  453. />
  454. <Row>
  455. <Col>
  456. Text to speech.
  457. ### Request Body
  458. <Properties>
  459. <Property name='message_id' type='str' key='text'>
  460. For text messages generated by Dify, simply pass the generated message-id directly. The backend will use the message-id to look up the corresponding content and synthesize the voice information directly. If both message_id and text are provided simultaneously, the message_id is given priority.
  461. </Property>
  462. <Property name='text' type='str' key='text'>
  463. Speech generated content。
  464. </Property>
  465. <Property name='user' type='string' key='user'>
  466. The user identifier, defined by the developer, must ensure uniqueness within the app.
  467. </Property>
  468. </Properties>
  469. </Col>
  470. <Col sticky>
  471. <CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}>
  472. ```bash {{ title: 'cURL' }}
  473. curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \
  474. --header 'Authorization: Bearer {api_key}' \
  475. --header 'Content-Type: application/json' \
  476. --data-raw '{
  477. "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
  478. "text": "Hello Dify",
  479. "user": "abc-123"
  480. }'
  481. ```
  482. </CodeGroup>
  483. <CodeGroup title="headers">
  484. ```json {{ title: 'headers' }}
  485. {
  486. "Content-Type": "audio/wav"
  487. }
  488. ```
  489. </CodeGroup>
  490. </Col>
  491. </Row>