Cursor
- Open Cursor Settings, then Models.
- Enable OpenAI API Key and paste your gateway key.
- Enable Override OpenAI Base URL and enter
https://qwenapigateway.com/v1. - Add a custom model such as
qwen3.6-flashorqwen3.6-plus.
This service provides OpenAI-compatible access to selected Qwen-family models. Use your service base URL and API key from the dashboard. In most OpenAI-compatible tools, setup comes down to three values: base URL, API key, and model name.
https://qwenapigateway.com/v1
Create an API key in Dashboard API keys, then send it as a bearer token.
Authorization: Bearer qgw_sk_live_xxx
from openai import OpenAI
client = OpenAI(
api_key="qgw_sk_live_xxx",
base_url="https://qwenapigateway.com/v1",
)
response = client.chat.completions.create(
model="qwen3.6-flash",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
Use these settings anywhere a tool asks for an OpenAI-compatible provider. Keep the key private and create a separate gateway key for each tool so you can rotate one integration without breaking the others.
Base URL: https://qwenapigateway.com/v1
API key: qgw_sk_live_xxx
Model: qwen3.6-flash
https://qwenapigateway.com/v1.qwen3.6-flash or qwen3.6-plus.https://qwenapigateway.com/v1.qwen3.6-flash.https://qwenapigateway.com/v1.model.base_url to https://qwenapigateway.com/v1.qwen3.6-flash.OPENAI_API_KEY=qgw_sk_live_xxx
OPENAI_BASE_URL=https://qwenapigateway.com/v1
OPENAI_MODEL=qwen3.6-flash
For related setup patterns, see Alibaba Cloud's guides for Cursor, Cline, and OpenAI-compatible Qwen API calls. Use this gateway's base URL and API key in place of the Alibaba Cloud endpoint and key.
GET /v1/models
POST /v1/chat/completions
Requests use a standard chat-completions shape. Supported models, context limits, and public prices are listed on the Pricing page. For complete request and response examples across the wider Qwen ecosystem, see the official Qwen API reference and the OpenAI-compatible Qwen guide.
Usage is metered by input, explicit cache creation, explicit cache reads, implicit cache reads, and output tokens. Public prices are shown on the Pricing page and charges are applied against your account balance.
Common request failures include authentication issues, insufficient balance, unsupported request sizes, temporary model unavailability, and rate limiting. For detailed error codes regarding the models, see the Qwen error messages reference.
Streaming responses use Server-Sent Events. The gateway requests final usage from the model provider so your account is billed from the provider's final token report, not from partial streamed text.
from openai import OpenAI
client = OpenAI(
api_key="qgw_sk_live_xxx",
base_url="https://qwenapigateway.com/v1",
)
stream = client.chat.completions.create(
model="qwen3.6-flash",
messages=[{"role": "user", "content": "Write a short greeting"}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)
elif chunk.usage:
print(f"\nTotal tokens: {chunk.usage.total_tokens}")
curl --no-buffer https://qwenapigateway.com/v1/chat/completions \
-H "Authorization: Bearer qgw_sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.6-flash",
"messages": [{"role": "user", "content": "Write a short greeting"}],
"stream": true,
"stream_options": {"include_usage": true}
}'