Skip to main content
Responses API

Responses API Reference

Invoke Alibaba Cloud Bailian applications via the OpenAI-compatible Responses API

The Responses API provides an OpenAI-compatible interface for invoking Alibaba Cloud Bailian applications (including agent and workflow applications). You can reuse existing OpenAI codebases or rapidly integrate tools from the OpenAI ecosystem.

Invocation Methods

The Responses API supports two invocation modes:
ModeUse CaseDescription
Synchronous InvocationReal-time interaction requiring immediate resultsWait for the full response to return after sending the request
Asynchronous InvocationLong-running tasks (e.g., report generation, multi-step tool calls)Submit the request and receive a task ID; retrieve results later via polling or callbacks

Endpoint URLs

  • SDK base_url: https://dashscope.aliyuncs.com/api/v2/apps/agent/{APP_ID}/compatible-mode/v1/
  • HTTP Endpoint: POST https://dashscope.aliyuncs.com/api/v2/apps/agent/{APP_ID}/compatible-mode/v1/responses
Replace {APP_ID} with your actual application ID.

Prerequisites

  • Obtain an API Key and configure it in your environment variables
  • Create an Alibaba Cloud Bailian application and obtain its application ID
  • If using the SDK, install the OpenAI Python SDK

Quick Start

from openai import OpenAI
import os

api_key = os.getenv("DASHSCOPE_API_KEY")
app_id = 'APP_ID'  # Replace with your actual application ID
base_url = f'https://dashscope.aliyuncs.com/api/v2/apps/agent/{app_id}/compatible-mode/v1/'

client = OpenAI(
    api_key=api_key,
    base_url=base_url
)

response = client.responses.create(
    input="Who are you?",
)

print(response.model_dump_json(indent=2))
Overview
Managed Agent API
Sandbox API
Memory API
Flow Agent API
RAG API
Connector API
Framework Integration
Assistant API (Deprecating)
  • Overview