Skip to main content

Step 1: Register Modellix

Log in to the Modellix console.

Step 2: Get API Key

In the Modellix console, go to “API Key” and create an API Key.
The API Key is only displayed once after creation, so be sure to save it first.

Step 3: Use the API

Find the model you want to use in Model API, and call the API using your API Key. For example:
curl --request POST \
  --url https://api.modellix.ai/api/v1/text-to-image/alibaba/qwen-image-plus/async \
  --header 'Authorization: Bearer <your_api_key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "A cute cat playing in a garden on a sunny day"
}
'
Since model calls are asynchronous tasks, after a successful call, you will first receive a task_id as shown below:
{
  "code": 0,
  "message": "success",
  "data": {
    "status": "pending",
    "task_id": "task-abc123",
    "model_id": "qwen-image-plus",
    "duration": 150
  }
}

Step 4: Get the Result

You can query the task result later using the task_id. For example:
curl --request GET \
  --url https://api.modellix.ai/api/v1/tasks/{task_id} \
  --header 'Authorization: Bearer <your_api_key>'
After a successful query, you will get the generated result. For example:
{
  "code": 0,
  "message": "success",
  "data": {
    "status": "success",
    "task_id": "task-abc123",
    "model_id": "qwen-image-plus",
    "duration": 3500,
    "result": {
      "resources": [
        {
          "url": "https://cdn.example.com/images/abc123.png",
          "type": "image",
          "width": 1024,
          "height": 1024,
          "format": "png",
          "role": "primary"
        }
      ],
      "metadata": {
        "image_count": 1,
        "request_id": "req-123456"
      },
      "extensions": {
        "submit_time": "2024-01-01T10:00:00Z",
        "end_time": "2024-01-01T10:00:03Z"
      }
    }
  }
}
The model’s generated results will all be placed in the result object.
You can find the generated image URL in the result. For example:
{
  "url": "https://cdn.example.com/images/abc123.png"
}

Step 5: Enjoy the Result

You have now successfully used the Modellix model API and obtained the generated result.
Generated results are only saved for 24 hours, so please make sure to save them promptly.