v9

latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-01211389.1 KB

Completion

Retrieve an LLM completion or queue a conversation for later retrieval.

get/ai

Query parameters

idstring uuid
Example:1851dab8-4619-409f-893f-47dd3a180bc3

The identifier returned by this endpoint of the queued conversation to retrieve; if given, all other params are ignored; either an ID or prompt is required.

promptstring
Example:best basketball shoes for 2026

The question or instruction to use as a chat prompt; the prompt requires form or URL encoding (with any space character being replaced by a + character or %20 sequence); either a prompt or ID is required.

model'chatgpt' | 'gemini' | 'perplexity'
Example:gemini

The AI model to chat with.

devicestring

The name as returned by the devices resource of the device to emulate chatting on (these names are case insensitive but must include form- or URL-encoded spaces and punctuation marks); device emulation is unused by default.

countrystring

The two-letter ISO code of the country to chat from (these codes are case insensitive); a random country is used by default.

subdivisionstring

The alphanumeric second part (proceeding the separator) of a first-level subdivision code in the (prerequisite) country to chat from (these codes are case insensitive); a random subdivision is used by default.

citystring

The commonly spelled name of the city in the (prerequisite) country to chat from (these names are temporarily case sensitive and required to include form- or URL-encoded spaces and punctuation marks); a random city is used by default.

languagestring

[Planned] The commonly spelled name or two-letter ISO code of the language to chat in (these names and codes are case insensitive but required to include form- or URL-encoded spaces and punctuation marks); the language is unset by default.

displaystring

[Planned] The commonly spelled name or two-letter ISO code of the chat interface’s display language (these names and codes are case insensitive but required to include form- or URL-encoded spaces and punctuation marks); the display language is unset by default or set to the language if given.

format'json' | 'rendered' | 'raw (planned)'
Example:rendered

The format to output to.

expirationinteger

The age in days of when to consider a cached completion expired, where 0 disables caching.

mode'sync' | 'async'
Example:sync

The synchronous or asynchronous mode of completion retrieval (retrieve an async completion by providing the returned ID).

callbackstring
Example:https%3A%2F%2Fwebhook.site%2F02e249f8-1faf-4fab-bcf5-78ce683e85a8

The encoded HTTP or HTTPS callback URL or Amazon SQS queue URL or ARN to notify when the (prerequisite) async completion has been retrieved; any SQS queue must grant sqs:SendMessage permission to the arn:aws:iam::180363035301:role/api-instance AWS principal.

Response

The AI completion.

model'chatgpt' | 'gemini' | 'perplexity' required

The AI model that generated the completion.

querystring required

The user prompt that the completion was generated for.

htmlstring required

The rendered HTML of the entire conversation.

promptstring required

The rendered HTML of just the prompt portion of the conversation.

completionstring required

The rendered HTML of just the completion portion of the conversation.

sourcesstring required

The rendered HTML of just the sources portion of the conversation.

adsstring required

The rendered HTML of just the ads portion of the conversation.

ssestring required

[ChatGPT only] The server-sent events JSON that was used to populate the conversation HTML.

fanoutsstring[] required

[ChatGPT only] The fanout queries that the model searched to generate the completion; only some models expose these queries.

devicestring

The name of the targeted emulated device.

countrystring

The ISO code of the targeted country.

subdivisionstring

The partial ISO code of the targeted subdivision in the country.

citystring

The common name of the targeted city in the country.

languagestring

[Planned] The common name or ISO code of the targeted language.

displaystring

[Planned] The common name or ISO code of the targeted display language.

Example response

{
  "model": "chatgpt",
  "query": "best basketball shoes for 2026",
  "html": "<!DOCTYPE html><html lang=\"en-US\" ...",
  "prompt": "<h4 class=\"sr-only select-none\">You said: ...",
  "completion": "<h4 class=\"sr-only select-none\">ChatGPT said: ...",
  "sources": "<section aria-label=\"Sources\" ...",
  "ads": "<div class=\"border-token-border-default mt-2 border-t py-4 text-sm\" ...",
  "sse": "{\"type\": \"conversation_detail_metadata\" ...",
  "fanouts": [
    "best basketball shoes 2026",
    "top rated basketball shoes 2026 reviews",
    "best performance basketball shoes 2026",
    "best basketball shoes for guards 2026",
    "best basketball shoes for wide feet 2026",
    "best outdoor basketball shoes 2026",
    "most popular basketball shoes 2026"
  ]
}