Skip to main content
POST
/
async
/
chat
/
completions
Create Async Chat Completion
curl --request POST \
  --url https://api.example.com/async/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "request": {
    "model": "<string>",
    "messages": [
      {
        "role": "system",
        "content": "<string>",
        "reasoning_steps": [
          {
            "thought": "<string>",
            "type": "<string>",
            "web_search": {
              "search_results": [
                {
                  "title": "<string>",
                  "url": "<string>",
                  "date": "<string>",
                  "last_updated": "<string>",
                  "snippet": "",
                  "source": "web"
                }
              ],
              "search_keywords": [
                "<string>"
              ]
            },
            "fetch_url_content": {
              "contents": [
                {
                  "title": "<string>",
                  "url": "<string>",
                  "date": "<string>",
                  "last_updated": "<string>",
                  "snippet": "",
                  "source": "web"
                }
              ]
            },
            "execute_python": {
              "code": "<string>",
              "result": "<string>"
            }
          }
        ],
        "tool_calls": [
          {
            "id": "<string>",
            "type": "<string>",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ],
        "tool_call_id": "<string>"
      }
    ],
    "max_tokens": 64000,
    "n": 5,
    "stream": false,
    "stop": "<string>",
    "cum_logprobs": true,
    "logprobs": true,
    "top_logprobs": 123,
    "best_of": 123,
    "response_metadata": {},
    "response_format": {
      "type": "<string>"
    },
    "diverse_first_token": true,
    "_inputs": [
      123
    ],
    "_prompt_token_length": 123,
    "tools": [
      {
        "type": "<string>",
        "function": {
          "name": "<string>",
          "description": "<string>",
          "parameters": {
            "type": "<string>",
            "properties": {},
            "required": [
              "<string>"
            ],
            "additional_properties": true
          },
          "strict": true
        }
      }
    ],
    "tool_choice": "none",
    "parallel_tool_calls": true,
    "web_search_options": {
      "search_context_size": "low",
      "search_type": "fast",
      "user_location": {
        "latitude": 123,
        "longitude": 123,
        "country": "<string>",
        "city": "<string>",
        "region": "<string>"
      },
      "image_results_enhanced_relevance": false
    },
    "search_mode": "web",
    "return_images": true,
    "return_related_questions": true,
    "num_search_results": 10,
    "num_images": 5,
    "enable_search_classifier": true,
    "disable_search": true,
    "search_domain_filter": [
      "<string>"
    ],
    "search_language_filter": [
      "<string>"
    ],
    "search_tenant": "<string>",
    "ranking_model": "<string>",
    "latitude": 123,
    "longitude": 123,
    "country": "<string>",
    "search_recency_filter": "hour",
    "search_after_date_filter": "<string>",
    "search_before_date_filter": "<string>",
    "last_updated_before_filter": "<string>",
    "last_updated_after_filter": "<string>",
    "image_format_filter": [
      "<string>"
    ],
    "image_domain_filter": [
      "<string>"
    ],
    "safe_search": true,
    "file_workspace_id": "<string>",
    "updated_before_timestamp": 123,
    "updated_after_timestamp": 123,
    "search_internal_properties": {},
    "use_threads": true,
    "thread_id": "<string>",
    "stream_mode": "full",
    "_debug_pro_search": false,
    "has_image_url": false,
    "reasoning_effort": "minimal",
    "language_preference": "<string>",
    "user_original_query": "<string>",
    "_force_new_agent": true
  }
}
'
{
  "id": "<string>",
  "model": "<string>",
  "created_at": 123,
  "status": "CREATED",
  "started_at": 123,
  "completed_at": 123,
  "response": {
    "id": "<string>",
    "model": "<string>",
    "created": 123,
    "choices": [
      {
        "index": 123,
        "message": {
          "role": "system",
          "content": "<string>",
          "reasoning_steps": [
            {
              "thought": "<string>",
              "type": "<string>",
              "web_search": {
                "search_results": [
                  {
                    "title": "<string>",
                    "url": "<string>",
                    "date": "<string>",
                    "last_updated": "<string>",
                    "snippet": "",
                    "source": "web"
                  }
                ],
                "search_keywords": [
                  "<string>"
                ]
              },
              "fetch_url_content": {
                "contents": [
                  {
                    "title": "<string>",
                    "url": "<string>",
                    "date": "<string>",
                    "last_updated": "<string>",
                    "snippet": "",
                    "source": "web"
                  }
                ]
              },
              "execute_python": {
                "code": "<string>",
                "result": "<string>"
              }
            }
          ],
          "tool_calls": [
            {
              "id": "<string>",
              "type": "<string>",
              "function": {
                "name": "<string>",
                "arguments": "<string>"
              }
            }
          ],
          "tool_call_id": "<string>"
        },
        "delta": {
          "role": "system",
          "content": "<string>",
          "reasoning_steps": [
            {
              "thought": "<string>",
              "type": "<string>",
              "web_search": {
                "search_results": [
                  {
                    "title": "<string>",
                    "url": "<string>",
                    "date": "<string>",
                    "last_updated": "<string>",
                    "snippet": "",
                    "source": "web"
                  }
                ],
                "search_keywords": [
                  "<string>"
                ]
              },
              "fetch_url_content": {
                "contents": [
                  {
                    "title": "<string>",
                    "url": "<string>",
                    "date": "<string>",
                    "last_updated": "<string>",
                    "snippet": "",
                    "source": "web"
                  }
                ]
              },
              "execute_python": {
                "code": "<string>",
                "result": "<string>"
              }
            }
          ],
          "tool_calls": [
            {
              "id": "<string>",
              "type": "<string>",
              "function": {
                "name": "<string>",
                "arguments": "<string>"
              }
            }
          ],
          "tool_call_id": "<string>"
        },
        "finish_reason": "stop"
      }
    ],
    "usage": {
      "prompt_tokens": 123,
      "completion_tokens": 123,
      "total_tokens": 123,
      "cost": {
        "input_tokens_cost": 123,
        "output_tokens_cost": 123,
        "total_cost": 123,
        "reasoning_tokens_cost": 123,
        "request_cost": 123,
        "citation_tokens_cost": 123,
        "search_queries_cost": 123
      },
      "search_context_size": "<string>",
      "citation_tokens": 123,
      "num_search_queries": 123,
      "reasoning_tokens": 123
    },
    "object": "chat.completion",
    "citations": [
      "<string>"
    ],
    "search_results": [
      {
        "title": "<string>",
        "url": "<string>",
        "date": "<string>",
        "last_updated": "<string>",
        "snippet": "",
        "source": "web"
      }
    ],
    "type": "message",
    "status": "PENDING"
  },
  "failed_at": 123,
  "error_message": "<string>"
}

Authorizations

Authorization
string
header
required

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

Body

application/json
request
ApiChatCompletionsRequest · object
required
idempotency_key
string | null

Response

Successful Response

id
string
required
model
string
required
created_at
integer
required
status
enum<string>
required

Status enum for async processing.

Available options:
CREATED,
IN_PROGRESS,
COMPLETED,
FAILED
started_at
integer | null
completed_at
integer | null
response
CompletionResponse · object
failed_at
integer | null
error_message
string | null