Skip to main content
1

Create an API key

Sign in to the dashboard and open API keys. Create a test key first: it runs in the sandbox and costs nothing.The key shows once. Store it in an environment variable:
2

Create a task

Send a prompt, a model, a country and a language:
The API answers 201 Created with the task. It is queued, and result is null for now:
A test key costs 0. A live key costs 13000 micro-dollars ($0.013).
3

Read the result

Read the task until its status is completed or failed. In the sandbox, that takes about 15 seconds.
A completed task has a result with the answer, entities, sources, fan-outs, products and ads. See Task results.
Polling is fine to start. In production, pass a webhookUrl and let the result come to you. See Webhooks.
4

Go live

In the dashboard, open Billing:
  1. Add your billing details and a card. The first card gives your organization a free $1.00 trial credit.
  2. Top up your balance. A top-up is $5 or more.
  3. Create a live key (afg_live_...) and use it in place of the test key.
Live tasks run on the real models and cost $0.013 each. See Pricing.

Test the edge cases

In the sandbox, the prompt controls the outcome: For example, "prompt": "best CRM [fail]" lets you test your failure path.