# Claude LLM Responses: Task Post

> **Beta:** the parser for this endpoint has not yet been checked against a live response. Field shapes may change.

`POST /v1/ai/claude/llm_responses/task_post`

Queue prompts for a Claude model at the lower queued base fee, then collect the answers.

Family: AI answers API · Mode: Task Post

## Price

Unit: answer

| Mode | Price (USD) |
|---|---|
| Standard queue | $0.00018 |
| Priority queue | $0.00054 |

Base fee per answer by queue, plus the model's token and search cost at list price.

## Description

Post up to 100 tasks; each comes back with 20100 and a task id. Answers appear in tasks_ready when done. `priority: 2` uses the priority queue at the priority base fee.

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

**Beta.** Queued tasks go through the model vendor's batch interface, which we wrote from its documentation and haven't checked against live batch responses yet. When a batch can't be submitted, the task runs on the standard interface instead; the result shape is the same either way.

## 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 |
| `priority` | integer | no | Queue for this task: `1` is the standard queue, `2` the priority queue (faster, priced higher). default `1`; one of `1`, `2` |
| `tag` | string | no | Your own label for the task, up to 255 characters. Returned by tasks_ready. max 255 |
| `pingback_url` | string | no | We send a GET to this http(s) URL when the task finishes. `$id` and `$tag` in the URL are replaced with the task id and tag. Only public hosts are called and redirects aren't followed. max 2000 |
| `postback_url` | string | no | We POST the finished task, in the task_get envelope, to this http(s) URL. Only public hosts are called and redirects aren't followed. max 2000 |
| `postback_data` | string | no | Result format sent to `postback_url`. Defaults to `advanced` when `postback_url` is set. one of `regular`, `advanced`, `html` |

### Example request

```bash
curl -X POST "https://api.dataforgaio.com/v1/ai/claude/llm_responses/task_post" \
  -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",
    "tag": "wide-feet-weekly"
  }
]'
```

## 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` | null | Always null for task_post. |
| `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,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "8cbb5b5c-8e15-5c82-9959-45f93cdad009",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.4210 sec.",
      "cost": 0,
      "result_count": 0,
      "path": [
        "v1",
        "ai",
        "claude",
        "llm_responses",
        "task_post"
      ],
      "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",
        "tag": "wide-feet-weekly"
      },
      "result": null,
      "receipt_id": null,
      "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. |

## Migrating

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

## Related

- [Claude LLM Responses: Live](https://dataforgaio.com/docs/api/ai-claude-llm-responses-live.md): One answer from a Claude model for your prompt, with the sources it cited, the searches it ran and the tokens it used.
- [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`.
