Send a request to the text generation application.
API Key authentication. For all API requests, include your API Key in the Authorization HTTP Header, prefixed with Bearer. Example: Authorization: Bearer {API_KEY}. 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.
Request body to create a completion message.
Allows the entry of various variable values defined by the App. Contains key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. Refer to the user_input_form field in the Get App Parameters response to discover the variable names and types expected by your app.
User identifier, unique within the application. This identifier scopes data access — messages and files are only visible when queried with the same user value.
The input text to be processed. This is a legacy parameter; in newer apps, the query should be passed inside the inputs object.
Mode of response return. streaming (recommended) uses SSE. blocking returns after completion (may be interrupted for long processes). Cloudflare timeout is 100 s. When omitted, defaults to blocking behavior.
streaming, blocking File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via Upload File and use the returned id as upload_file_id with transfer_method: local_file.
Successful response. The content type and structure depend on the response_mode parameter in the request.
response_mode is blocking, returns application/json with a CompletionResponse object.response_mode is streaming, returns text/event-stream with a stream of ChunkCompletionEvent objects.Event type, fixed as message.
Task ID for request tracking and the Stop Completion Message Generation API.
Unique ID of this response event.
Unique message ID. Use this as the message_id parameter when calling feedback or suggested questions endpoints.
App mode, fixed as completion.
Complete response content.
Metadata including usage and retriever resources.
Message creation timestamp (Unix epoch seconds).