Skip to main content
GET
/
ai
Completion
curl --request GET \
  --url https://api.agentfirst.dev/ai \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.agentfirst.dev/ai"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.agentfirst.dev/ai', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.agentfirst.dev/ai",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.agentfirst.dev/ai"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.agentfirst.dev/ai")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.agentfirst.dev/ai")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "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"
  ],
  "device": null,
  "country": null,
  "subdivision": null,
  "city": null,
  "language": null,
  "display": null
}
{
"id": "1851dab8-4619-409f-893f-47dd3a180bc3"
}
"Authorization header must be provided"
"Credit balance is 0; top up at https://agentfirst.dev/#pricing"
"Captcha was detected"
"Character counts must be no more than 255"
"Unknown error occurred"
"Service is autoscaling; please retry in 60 seconds"
"Request(s) timed out"

Authorizations

Authorization
string
header
required

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

Query Parameters

id
string<uuid>

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.

Example:

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

prompt
string

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.

Maximum string length: 2047
Example:

"best basketball shoes for 2026"

model
enum<string>
default:chatgpt

The AI model to chat with.

Available options:
chatgpt,
gemini,
perplexity,
copilot
Example:

"gemini"

device
string

The name as returned by the devices resource [blocked] 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.

Example:

null

country
string

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

Example:

null

subdivision
string

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.

Example:

null

city
string

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.

Example:

null

language
string

[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.

Example:

null

display
string

[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.

Example:

null

format
enum<string>
default:json

The format to output to.

Available options:
json,
rendered,
raw (planned)
Example:

"rendered"

expiration
integer
default:1

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

Required range: 0 <= x <= 1
Example:

0

mode
enum<string>
default:sync

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

Available options:
sync,
async
Example:

"sync"

callback
string

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.

Maximum string length: 2047
Example:

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

Response

The AI completion.

model
enum<string>
required

The AI model that generated the completion.

Available options:
chatgpt,
gemini,
perplexity,
copilot
Example:

"chatgpt"

query
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\" ..."

prompt
string
required

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

Example:

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

completion
string
required

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

Example:

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

sources
string
required

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

Example:

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

ads
string
required

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

Example:

"<div class=\"border-token-border-default mt-2 border-t py-4 text-sm\" ..."

sse
string
required

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

Example:

"{\"type\": \"conversation_detail_metadata\" ..."

fanouts
string[]
required

[ChatGPT only] 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
string

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

Example:

null

display
string

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

Example:

null