# Claude LLM Responses: Live

`POST /v1/ai/claude/llm_responses/live`

One answer from a Claude model for your prompt, with the sources it cited, the searches it ran and the tokens it used.

Family: AI answers API · Mode: Live

## Price

Unit: answer

| Mode | Price (USD) |
|---|---|
| Live | $0.00054 |

Base fee per answer. The model's token and search cost is added at its list price (see the table in the description).

## Description

Send up to 100 tasks, one prompt each. Each task calls the model once and returns its answer in `result[0].items[0].sections[0].text`, with citations in `annotations` when web search is on.

Use `message_chain` to continue a conversation, and `web_search_country_iso_code` or `web_search_city` to localize the search.

**Billing.** Each answer costs our base fee for the mode plus the model's token and search cost at the model's published list price, reported as `money_spent`. A failed, empty or refused answer costs $0. Before the call, the wallet check reserves the base fee plus a conservative token estimate (or your `max_cost`).

Token prices for Claude models:

| Model | Input per 1M tokens | Output per 1M tokens | Web search per 1,000 | Reasoning |
|---|---|---|---|---|
| `claude-opus-5-5` | $4.0 | $20.0 | $10.0 | yes |
| `claude-sonnet-5-5` | $2.0 | $10.0 | $10.0 | yes |
| `claude-haiku-5-5` | $0.1 | $0.5 | $10.0 | yes |
| `claude-opus-5` | $5.0 | $25.0 | $10.0 | yes |
| `claude-sonnet-5` | $2.0 | $10.0 | $10.0 | yes |
| `claude-opus-4-8` | $5.0 | $25.0 | $10.0 | no |
| `claude-sonnet-4-6` | $3.0 | $15.0 | $10.0 | no |
| `claude-haiku-4-5` | $1.0 | $5.0 | $10.0 | no |

Answers aren't cached: each call is a new sample. Prompts and answers are added to the AI-answer dataset unless your organization has opted out.

## Authentication

HTTP Basic auth: any login, with your `dg_` API key as the password. A `Bearer` token header with the key also works.

## Request

Send a JSON array of task objects (up to 100 per request).

| Field | Type | Required | Description |
|---|---|---|---|
| `user_prompt` | string | yes | The prompt, up to 500 characters. max 500 |
| `model_name` | string | no | A model id from `/v1/ai/claude/llm_responses/models`. Dated ids such as `gpt-4.1-2025-04-14` resolve to their base model. Leave it out to use the default model. default `claude-sonnet-5-5`; one of `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`, `claude-opus-5`, `claude-sonnet-5`, `claude-opus-4-8`, `claude-sonnet-4-6`, `claude-haiku-4-5` |
| `system_message` | string | no | Instructions sent before the prompt, up to 500 characters. max 500 |
| `message_chain` | array<object> | no | Earlier turns of the conversation, up to 10. They alternate `user` and `ai`, start with `user` and end with `ai`; each message is up to 500 characters. max 10 |
| `message_chain.role` | string | yes | Who said it. one of `user`, `ai` |
| `message_chain.message` | string | yes | What was said. max 500 |
| `max_output_tokens` | integer | no | Most tokens the answer may use, up to 4,096. default `2048`; min 1; max 4096 |
| `temperature` | number | no | Sampling temperature, 0.0 to 1.0. Send this or `top_p`, not both. Ignored by reasoning models. min 0; max 1 |
| `top_p` | number | no | Nucleus sampling, 0 to 1. Send this or `temperature`, not both. min 0; max 1 |
| `web_search` | boolean | no | Let the model search the web before answering. Search fees are added to `money_spent`. default `false` |
| `force_web_search` | boolean | no | Require a web search before answering. Needs `web_search: true`. default `false` |
| `web_search_country_iso_code` | string | no | Two-letter country the web search should favor. min 2; max 2 |
| `web_search_city` | string | no | City the web search should favor, up to 100 characters. max 100 |
| `max_cost` | number | no | The most this task may be charged, in USD. The wallet check reserves this amount instead of our token estimate, and the charge is capped at it. Before the model is called, `max_output_tokens` is lowered (and web search turned off, unless forced or always on) so the most the answer can cost fits; when even the prompt can't fit, the task returns 40501 at $0. min 0 |

### Example request

```bash
curl -X POST "https://api.dataforgaio.com/v1/ai/claude/llm_responses/live" \
  -u "api:$DATAFORGAIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
  {
    "user_prompt": "Which running shoe brands are best for wide feet?",
    "model_name": "claude-sonnet-4-6",
    "web_search": true,
    "web_search_country_iso_code": "US"
  }
]'
```

## Response

| Field | Type | Description |
|---|---|---|
| `version` | string | Response format version, for example `0.1.20261203`. |
| `status_code` | integer | Status of the request as a whole. 20000 when it was accepted; each task has its own `status_code`. |
| `status_message` | string | Plain-language request status. |
| `time` | string | Time the whole request took, for example `1.8410 sec.` |
| `cost` | number | Sum of every task's `cost`, in USD. |
| `tasks_count` | integer | Number of tasks in `tasks`. |
| `tasks_error` | integer | Tasks whose `status_code` is 40000 or higher. |
| `tasks` | array<object> | One entry per task you sent, in the order you sent them. |
| `tasks.id` | string | Task id (a UUID). For task_post, use it with task_get. |
| `tasks.status_code` | integer | Outcome of this task. 20000 means data came back; 20100 means queued. See the status codes table. |
| `tasks.status_message` | string | Plain-language status. For 40501 it names the field that failed. |
| `tasks.time` | string | Time this task took on our side, for example `1.8203 sec.` |
| `tasks.cost` | number | What this task was charged, in USD. 0 when it returned no data. |
| `tasks.result_count` | integer | Number of entries in `result`. |
| `tasks.path` | array<string> | The route this task ran on, split into segments, starting with `v1`. |
| `tasks.data` | object | The task you sent, echoed back. Utility routes echo their query parameters. |
| `tasks.result` | array<object>\|null | One answer. |
| `tasks.result.model_name` | string | The model that answered. |
| `tasks.result.input_tokens` | integer | Prompt tokens the model read, including search results it was given. |
| `tasks.result.output_tokens` | integer | Tokens in the answer. |
| `tasks.result.reasoning_tokens` | integer | Reasoning tokens, for reasoning models; 0 otherwise. |
| `tasks.result.web_search` | boolean | Whether the model was allowed to search the web. |
| `tasks.result.money_spent` | number | Token and search cost at the model's list price, in USD. The task's `cost` is this plus our base fee. |
| `tasks.result.datetime` | string | When the answer was produced, `YYYY-MM-DD HH:MM:SS +00:00`. |
| `tasks.result.items` | array<object> | The answer. One `message` item. |
| `tasks.result.items.type` | string | Always `message`. |
| `tasks.result.items.sections` | array<object> | Parts of the message. One `text` section. |
| `tasks.result.items.sections.type` | string | Always `text`. |
| `tasks.result.items.sections.text` | string | The answer text, as the model wrote it (often Markdown). |
| `tasks.result.items.sections.annotations` | array<object>\|null | Sources the answer cited. Null when web search was off. |
| `tasks.result.items.sections.annotations.title` | string\|null | Title of the cited page. |
| `tasks.result.items.sections.annotations.url` | string\|null | URL of the cited page. |
| `tasks.result.items.sections.annotations.start_index` | integer\|null | Start of the cited span in `text`, when the model reports it. |
| `tasks.result.items.sections.annotations.end_index` | integer\|null | End of the cited span in `text`. |
| `tasks.result.items.sections.annotations.text` | string\|null | The cited passage, when the model reports it. |
| `tasks.result.fan_out_queries` | array<string>\|null | Search queries the model ran. Null when web search was off. |
| `tasks.result.search_results` | array<object>\|null | Pages the searches returned, cited or not. Null when web search was off. |
| `tasks.result.search_results.title` | string\|null | Page title. |
| `tasks.result.search_results.url` | string\|null | Page URL. |
| `tasks.result.search_results.date` | string\|null | Publication date, when reported. |
| `tasks.result.search_results.snippet` | string\|null | Snippet, when reported. |
| `tasks.receipt_id` | string\|null | Id of the ledger receipt for this task: what was fetched, at which level, and what was charged. Null for utility routes and failed checks. |
| `tasks.fetch_level` | string\|null | The fetch level that delivered the data: `standard`, `rendered` or `protected`. Null when the route doesn't fetch pages or nothing was fetched. one of `standard`, `rendered`, `protected` |
| `tasks.upgraded` | boolean | True when Auto-upgrade moved the request past the included level (or, for SERP, to the live path) and the charge reflects that. |
| `tasks.upgrade_reason` | string\|null | Why the request upgraded, in our level names and HTTP facts, for example `403 at standard; challenge page at rendered`. Null when it didn't upgrade. |
| `tasks.cache_hit` | boolean | True when the data came from the shared result cache instead of a new fetch. |

### Example response

```json
{
  "version": "0.1.20261203",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.4210 sec.",
  "cost": 0.02044,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "8cbb5b5c-8e15-5c82-9959-45f93cdad009",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.4210 sec.",
      "cost": 0.02044,
      "result_count": 1,
      "path": [
        "v1",
        "ai",
        "claude",
        "llm_responses",
        "live"
      ],
      "data": {
        "user_prompt": "Which running shoe brands are best for wide feet?",
        "model_name": "claude-sonnet-4-6",
        "web_search": true,
        "web_search_country_iso_code": "US"
      },
      "result": [
        {
          "model_name": "claude-sonnet-4-6",
          "input_tokens": 1240,
          "output_tokens": 412,
          "reasoning_tokens": 0,
          "web_search": true,
          "money_spent": 0.0199,
          "datetime": "2026-12-03 10:42:18 +00:00",
          "items": [
            {
              "type": "message",
              "sections": [
                {
                  "type": "text",
                  "text": "For wide feet, look at brands that make most models in a wide (2E) fit, such as Summit Trail and Ridgeway. Try shoes on late in the day, when your feet are largest.",
                  "annotations": [
                    {
                      "title": "Best running shoes for wide feet",
                      "url": "https://www.example-reviews.com/gear/wide-running-shoes",
                      "start_index": 0,
                      "end_index": 98,
                      "text": "brands that make most models in a wide (2E) fit"
                    }
                  ]
                }
              ]
            }
          ],
          "fan_out_queries": [
            "best running shoes for wide feet"
          ],
          "search_results": [
            {
              "title": "Best running shoes for wide feet",
              "url": "https://www.example-reviews.com/gear/wide-running-shoes",
              "date": "2026-11-20",
              "snippet": "We measured toe-box width on 40 shoes."
            }
          ]
        }
      ],
      "receipt_id": "744695e7-dd8a-5016-bb2b-2d314ea9ef81",
      "fetch_level": null,
      "upgraded": false,
      "upgrade_reason": null,
      "cache_hit": false
    }
  ]
}
```

## Errors

| Code | When |
|---|---|
| 40100 | No credentials were sent (HTTP 401). |
| 40101 | The API key is missing, malformed or revoked (HTTP 401). |
| 40202 | Too many requests for this key (HTTP 429, with `Retry-After`). |
| 40503 | The body isn't a JSON array of task objects, or the method isn't POST (HTTP 400 or 405). |
| 40006 | More than 100 tasks in one POST (HTTP 400). |
| 40210 | Wallet balance below the worst case this POST could cost (HTTP 402). |
| 40501 | A task field failed validation. Returned per task; other tasks still run. |
| 50000 | The task returned no data because of an error on our side or upstream. $0. |
| 40501 | `user_prompt` missing or too long, unknown `model_name`, `temperature` and `top_p` both sent, a value out of range, or a malformed `message_chain`. |
| 50000 | The model returned no answer, or the engine isn't available right now. $0. |

## Migrating

Replaces DataForSEO `/v3/ai_optimization/claude/llm_responses/live`. Same request body and response envelope; change the base URL and the key.

## Related

- [Claude LLM Responses: Task Post](https://dataforgaio.com/docs/api/ai-claude-llm-responses-task-post.md): Queue prompts for a Claude model at the lower queued base fee, then collect the answers.
- [Claude LLM Responses: Tasks Ready](https://dataforgaio.com/docs/api/ai-claude-llm-responses-tasks-ready.md): List finished answers you haven't collected yet.
- [Claude LLM Responses: Tasks Fixed](https://dataforgaio.com/docs/api/ai-claude-llm-responses-tasks-fixed.md): Same list as tasks_ready, kept for clients that call tasks_fixed.
- [Claude LLM Responses: Task Get](https://dataforgaio.com/docs/api/ai-claude-llm-responses-task-get.md): Read one queued answer.
- [Claude LLM Responses: Models](https://dataforgaio.com/docs/api/ai-claude-llm-responses-models.md): The Claude model ids you can send as `model_name`.
