Skip to main content
GET
/
ai
/
completions
Async completions
curl --request GET \
  --url https://api.agentfirst.dev/ai/completions \
  --header 'Authorization: Bearer <token>'
{
  "model": "chatgpt",
  "prompt": "best basketball shoes for 2026",
  "html": "<!DOCTYPE html><html lang=\"en-US\" ...",
  "promptHtml": "<h4 class=\"sr-only select-none\">You said: ...",
  "completionHtml": "<h4 class=\"sr-only select-none\">ChatGPT said: ...",
  "sourcesHtml": "<section aria-label=\"Sources\" ...",
  "subqueries": [
    "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"
  ],
  "device": null,
  "country": null,
  "subdivision": null,
  "city": null,
  "language (planned)": null,
  "display (planned)": null
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

id
string<uuid>
required

The identifier returned by the AI endpoint of the queued conversation to retrieve.

Example:

"1851dab8-4619-409f-893f-47dd3a180bc3"

Response

The AI completion.

model
enum<string>
required

The AI model that generated the completion.

Available options:
chatgpt,
gemini,
perplexity (coming soon),
copilot (coming soon)
Example:

"chatgpt"

prompt
string
required

The user prompt that the completion was generated for.

Example:

"best basketball shoes for 2026"

html
string
required

The rendered HTML of the entire conversation.

Example:

"<!DOCTYPE html><html lang=\"en-US\" ..."

promptHtml
string
required

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

Example:

"<h4 class=\"sr-only select-none\">You said: ..."

completionHtml
string
required

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

Example:

"<h4 class=\"sr-only select-none\">ChatGPT said: ..."

sourcesHtml
string
required

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

Example:

"<section aria-label=\"Sources\" ..."

subqueries
string[]
required

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

Example:
[
"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"
]
device
string

The name of the targeted emulated device.

Example:

null

country
string

The ISO code of the targeted country.

Example:

null

subdivision
string

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

Example:

null

city
string

The common name of the targeted city in the country.

Example:

null

language (planned)
string

The common name or ISO code of the targeted language.

Example:

null

display (planned)
string

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

Example:

null