Built from the official docs: openrouter.ai · Qwen4 Max - API Pricing & Benchmarks · checked 20 November 2026
Through OpenRouter
Get an API key
Sign up at OpenRouter and create an API key to authenticate your requests.
https://openrouter.ai/Call the API directly with cURL
Send an HTTP POST to the OpenRouter responses endpoint with the model slug qwen/qwen4-max. The HTTP-Referer and X-OpenRouter-Title headers are optional and only affect leaderboard attribution.
curl https://openrouter.ai/api/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <OPENROUTER_API_KEY>" \ -d '{ "model": "qwen/qwen4-max", "input": "What is the meaning of life?" }'Or use the OpenAI SDK as a drop-in
Point the OpenAI SDK at the OpenRouter base URL to call the model without changing your code structure.
pip install openaiCall the model from Python
Set the base URL to OpenRouter, pass your key, and request the qwen/qwen4-max model.
from openai import OpenAI client = OpenAI( base_url="https://openrouter.ai/api/v1", api_key="<OPENROUTER_API_KEY>", ) response = client.responses.create( model="qwen/qwen4-max", input="What is the meaning of life?" ) print(response.output_text)
Check it worked
The response JSON has status "completed" and contains a message item whose content includes an output_text with the model's reply.