Skip to main content
OpenAI Responses

Retrieve a response

Retrieve a completed model response by its response ID

GET
https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1/responses/{response_id}
Python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
    # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
    base_url="https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1",
)

response = client.responses.retrieve("resp_xxx")
print(response)
{
  "background": false,
  "completed_at": 1778676420,
  "created_at": 1778676418,
  "frequency_penalty": 0,
  "id": "resp_801bc2c4-93d9-910f-b35d-5274f5a737c1",
  "metadata": {},
  "model": "qwen-plus",
  "object": "response",
  "output": [
    {
      "content": [
        {
          "annotations": [],
          "text": "Hello! Nice to meet you. How can I help you today?",
          "type": "output_text"
        }
      ],
      "id": "msg_8c54756c-9b65-4a95-81d7-4276d91406db",
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "parallel_tool_calls": true,
  "presence_penalty": 0,
  "service_tier": "default",
  "status": "completed",
  "store": true,
  "temperature": 1,
  "tool_choice": "auto",
  "tools": [],
  "tool_usage": {},
  "top_logprobs": 0,
  "top_p": 1,
  "usage": {
    "input_tokens": 45,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 63,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 108
  }
}

Authorizations

string
header
required

DashScope API key.

Path Parameters

string
required

The ID of the response to retrieve, in the format resp_xxx. You can obtain it from the create-response API. Only response IDs returned by requests created with store=true can be retrieved.

Response

200-application/json
string

The unique ID for this response. It is valid for 7 days. You can use this parameter in the previous_response_id parameter to create a multi-turn conversation.

number

The Unix timestamp in seconds for this request.

enum<string>

The object type. The value is response.

response
enum<string>

The status of the response generation.

completed,failed,in_progress,cancelled,queued,incomplete
string

The ID of the model that is used to generate the response.

object[]

An array of output items generated by the model. The type and order of elements in the array depend on the model's response.

boolean

Whether parallel tool calls are enabled.

string

The value of the tool_choice parameter from the echo request. Valid values are auto, none, and required.

object[]

The complete content of the tools parameter from the echo request. The structure is the same as the tools parameter in the request body.

object | null

The error object that is returned when the model fails to generate a response. This field is null on success.

object

Tool usage statistics for this request, recorded separately from model token usage in usage. When no tools are called, this field defaults to an empty object {}.

object

The token consumption information for this request.