Ask AI Chat
AI Chat API allows you to run your own prompt via API.
Prompt (required) - It will be your query - please be as descriptive as possible to get an accurate output
assistantType (default: general) - Allow values are - general, researcher, marketer, sales, recruiter
mediaIds (required) - You can pass multiple mediaIds to run your prompt OR pass a single mediaId in an array
Request rules. prompt is the only field you must send. assistantTemplateId becomes required when you set assistantType to custom; for every other value it is optional. You do not have to send folderId or mediaIds: a body with only prompt is accepted. Send one of them anyway, or the assistant has no material to read.
Streaming. Send isStream: true to get the answer as Server-Sent Events instead of one JSON body. The response comes back as text/event-stream with Cache-Control: no-cache and Connection: keep-alive. Every frame is written as data: <json> followed by a blank line, with no event: or id: field, so read them as default message events. The stream ends on an end frame, or an error frame if it failed, and there is no [DONE] sentinel. The end frame carries promptId, messageId and references, the same references array the non-streaming response returns, so a streaming client can show the sources without a second request. isStream: true cannot be combined with isIndividualPrompt: true; that returns 400 with errorCode STREAMING_NOT_SUPPORTED_FOR_INDIVIDUAL.
Audio and video analysis. Send analysisMediaId and analysisInput together to have the model take in the recording itself rather than only its transcript. analysisMediaId must be one of mediaIds. This is a premium feature billed in credits per hour of media on top of the normal chat cost, so price it with GET /prompt/analysisQuote before you commit to a run. When the file turns out to be ineligible the chat still answers from the transcript rather than failing, and no analysis credits are charged.
Request
- Base URL: https://api.speakai.co/v1
- URL: https://api.speakai.co/v1/prompt
- Auth: API key in header x-speakai-key and API key in header x-access-token
Request body
Response
OK
Changes
No recorded changes to this operation across all 2 revisions of this API.