---
title: "Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing."
method: GET
path: "/v1/chat/deferred-completion/{request_id}"
tags: ["v1"]
---

# Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing.

`GET /v1/chat/deferred-completion/{request_id}`

## Path parameters

- `request_id` string, required

## Response `200`

Success

- ChatResponse — The chat response body for `/v1/chat/completions` endpoint.
  - `choices` Choice[], required — A list of response choices from the model. The length corresponds to the `n` in request body (default to 1).
    - `finish_reason` string, nullable — Finish reason. `"stop"` means the inference has reached a model-defined or user-supplied stop sequence in `stop`. `"length"` means the inference result has reached models' maximum allowed token length or user defined value in `max_tokens`. `"end_turn"` or `null` in streaming mode when the chunk is not the last.
    - `index` integer, required — Index of the choice within the response choices, starting from 0.
    - `logprobs` LogProbs
      - `content` TokenLogProb[], nullable — An array the log probabilities of each output token returned.
        - `bytes` integer[], nullable — The ASCII encoding of the output character.
        - `logprob` number, float, required — The log probability of returning this token.
        - `token` string, required — The token.
        - `top_logprobs` TopLogProb[], required — An array of the most likely tokens to return at this token position.
          - `bytes` integer[], nullable — The ASCII encoding of the output character.
          - `logprob` number, float, required — The log probability of returning this token.
          - `token` string, required — The token.
    - `message` ChoiceMessage, required
      - `content` string, nullable — The content of the message.
      - `reasoning_content` string, nullable — The reasoning trace generated by the model.
      - `refusal` string, nullable — The reason given by model if the model is unable to generate a response. null if model is able to generate.
      - `role` string, required — The role that the message belongs to, the response from model is always `"assistant"`.
      - `tool_calls` ToolCall[], nullable — A list of tool calls asked by model for user to perform.
        - `function` Function, required
          - `arguments` string, required
          - `name` string, required
        - `id` string, required — A unique ID of the tool call generated by xAI. After performing tool call's function, user provides this ID with tool call's result in the subsequent request to xAI. xAI can then match the tool call result sent with tool call request.
        - `index` integer, nullable — Index of the tool call.
        - `type` string, nullable — Type of tool call, should be `"function"` or `"web_search_call"` or `"x_search_call"` or `"code_interpreter_call"` or `"mcp_call"`
  - `citations` string[], nullable — List of all the external pages used by the model to answer.
  - `created` integer, required — The chat completion creation time in Unix timestamp.
  - `id` string, required — A unique ID for the chat response.
  - `model` string, required — Model ID used to create chat completion.
  - `object` string, required — The object type, which is always `"chat.completion"`.
  - `output_files` OutputFile[], nullable — Files generated during the response (e.g., by the code execution tool). Only populated when `code_execution_files_output` is included.
    - `file_id` string, required — The file ID from the Files API. Use this to download the file.
    - `name` string, required — The display name of the file.
  - `service_tier` 'default' | 'priority', required — Processing tier for a request. Determines scheduling priority and billing.
  - `system_fingerprint` string, nullable — System fingerprint, used to indicate xAI system configuration changes.
  - `usage` Usage
    - `completion_tokens` integer, required — Total completion token used.
    - `completion_tokens_details` CompletionUsageDetail, required — Details of completion usage.
      - `accepted_prediction_tokens` integer, required — The number of tokens in the prediction that appeared in the completion.
      - `audio_tokens` integer, required — Audio input tokens generated by the model.
      - `reasoning_tokens` integer, required — Tokens generated by the model for reasoning.
      - `rejected_prediction_tokens` integer, required — The number of tokens in the prediction that did not appear in the completion.
    - `cost_in_usd_ticks` integer, required — Accurate cost of this request in USD ticks, where "tick" is defined as follows: TICKS_IN_USD_CENT: i64 = 100_000_000 which means there is 10'000'000'000 ticks in one *dollar*.
    - `num_sources_used` integer, required — Number of individual live search source used.
    - `prompt_tokens` integer, required — Total prompt token used.
    - `prompt_tokens_details` PromptUsageDetail, required — Details of prompt usage.
      - `audio_tokens` integer, required — Audio prompt token used.
      - `cached_tokens` integer, required — Token cached by xAI from previous requests and reused for this request.
      - `image_tokens` integer, required — Image prompt token used.
      - `text_tokens` integer, required — Total text prompt token used (cached + non-cached text tokens).
    - `total_tokens` integer, required — Total token used, the sum of prompt token and completion token amount.

## Other responses

- `202` — Accepted. The request is processing, but haven't been completed. You can retry at a later time.
- `400` — Bad request. The request is invalid or an invalid API key is provided.
- `404` — Not found. No deferred completion could be found with the given request_id.

---

[API](https://skmtc.net/x/apis/xai-s-rest-api.md) · [All operations](https://skmtc.net/x/apis/xai-s-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/x/xai-s-rest-api/versions/8f6014272113/schema)
