> ## Documentation Index
> Fetch the complete documentation index at: https://api-tools.memories.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen Image

> Generate chat completions using Qwen ILM model with image inputs.

<Info>
  **Product**: Visual Intelligence — Image Model APIs (atomic)
  **Use case**: Call an Image Language Model (Gemini / GPT / Nova / Qwen) directly with your own prompt. Full control over model and parameters.
  **Host**: `https://mavi-backend.memories.ai/serve/api/v2`
  **Auth**: `Authorization: sk-mavi-...` (no `Bearer` prefix)
</Info>

This endpoint allows you to generate chat completions with image inputs using Qwen ILM model.

<Info>
  **Endpoint:** `POST https://mavi-backend.memories.ai/serve/api/v2/iu/chat/completions`

  Image Understanding (ILM) endpoints use the `/iu` path prefix. Video Understanding (VLM) endpoints use `/vu` instead.
</Info>

## Supported Models

All models require the `qwen:` prefix when used in the `model` parameter (e.g., `qwen:qwen3-vl-plus`).

### Qwen 3 VL Plus (Premium - Tiered Pricing)

| Model                        | Input Price                                                            | Output Price                                                           |
| ---------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| **qwen3-vl-plus**            | \$0.00021/1K (≤32K), \$0.00031/1K (32K-128K), \$0.00063/1K (128K-256K) | \$0.00168/1K (≤32K), \$0.00252/1K (32K-128K), \$0.00503/1K (128K-256K) |
| **qwen3-vl-plus-2025-12-19** | \$0.00021/1K (≤32K), \$0.00031/1K (32K-128K), \$0.00063/1K (128K-256K) | \$0.00168/1K (≤32K), \$0.00252/1K (32K-128K), \$0.00503/1K (128K-256K) |
| **qwen3-vl-plus-2025-09-23** | \$0.00021/1K (≤32K), \$0.00031/1K (32K-128K), \$0.00063/1K (128K-256K) | \$0.00168/1K (≤32K), \$0.00252/1K (32K-128K), \$0.00503/1K (128K-256K) |

### Qwen 3 VL Flash (Cost-Effective - Tiered Pricing)

| Model                         | Input Price                                                               | Output Price                                                           |
| ----------------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| **qwen3-vl-flash**            | \$0.000052/1K (≤32K), \$0.000079/1K (32K-128K), \$0.000126/1K (128K-256K) | \$0.00042/1K (≤32K), \$0.00063/1K (32K-128K), \$0.00101/1K (128K-256K) |
| **qwen3-vl-flash-2025-10-15** | \$0.000052/1K (≤32K), \$0.000079/1K (32K-128K), \$0.000126/1K (128K-256K) | \$0.00042/1K (≤32K), \$0.00063/1K (32K-128K), \$0.00101/1K (128K-256K) |

### Qwen VL Max (Legacy)

| Model                      | Input Price         | Output Price        |
| -------------------------- | ------------------- | ------------------- |
| **qwen-vl-max**            | \$0.00084/1K tokens | \$0.00335/1K tokens |
| **qwen-vl-max-latest**     | \$0.00084/1K tokens | \$0.00335/1K tokens |
| **qwen-vl-max-2025-08-13** | \$0.00084/1K tokens | \$0.00335/1K tokens |
| **qwen-vl-max-2025-04-08** | \$0.00084/1K tokens | \$0.00335/1K tokens |

### Qwen VL Plus (Legacy)

| Model                       | Input Price         | Output Price        |
| --------------------------- | ------------------- | ------------------- |
| **qwen-vl-plus**            | \$0.00022/1K tokens | \$0.00066/1K tokens |
| **qwen-vl-plus-latest**     | \$0.00022/1K tokens | \$0.00066/1K tokens |
| **qwen-vl-plus-2025-08-15** | \$0.00022/1K tokens | \$0.00066/1K tokens |
| **qwen-vl-plus-2025-05-07** | \$0.00022/1K tokens | \$0.00066/1K tokens |
| **qwen-vl-plus-2025-01-25** | \$0.00022/1K tokens | \$0.00066/1K tokens |

<Note>
  **Pricing Notes:**

  * All prices are per 1,000 tokens and converted from CNY at exchange rate of 7.0
  * **Tip:** To compare with other providers (who price per 1M tokens), multiply these prices by 1,000. For example, \$0.00021/1K = \$0.21/1M tokens
  * Qwen 3 VL models support tiered pricing: ≤32K, 32K-128K, 128K-256K token ranges
  * Legacy models (Qwen VL Max/Plus) use flat-rate pricing
  * Remember to include the `qwen:` prefix: `"model": "qwen:qwen3-vl-plus"`
</Note>

### Request Body

| Parameter          | Type                    | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------ | ----------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| model              | string                  | Yes      | -       | The model to use (e.g., `qwen:qwen3-vl-plus`)                                                                                                                                                                                                                                                                                                                                                                                           |
| messages           | array                   | Yes      | -       | Array of message objects. Each message contains:<br />- `role`: Role type, values: `system`, `user`<br />- `content`: Message content, can be a string or array. Array items can contain:<br />  - `image`: Image URL or base64 encoded image<br />  - `text`: Text content                                                                                                                                                             |
| temperature        | number                  | No       | 0.7     | Controls randomness: 0.0-2.0, higher = more random                                                                                                                                                                                                                                                                                                                                                                                      |
| max\_tokens        | integer                 | No       | 1024    | Maximum number of tokens to generate                                                                                                                                                                                                                                                                                                                                                                                                    |
| top\_p             | number                  | No       | 0.9     | Nucleus sampling: 0.0-1.0, consider tokens with top\_p probability mass                                                                                                                                                                                                                                                                                                                                                                 |
| frequency\_penalty | number                  | No       | 0.0     | Reduces repetition of frequent tokens: -2.0 to 2.0                                                                                                                                                                                                                                                                                                                                                                                      |
| presence\_penalty  | number                  | No       | 0.0     | Increases likelihood of new topics: -2.0 to 2.0                                                                                                                                                                                                                                                                                                                                                                                         |
| n                  | integer                 | No       | 1       | Number of completions to generate                                                                                                                                                                                                                                                                                                                                                                                                       |
| stream             | boolean                 | No       | false   | Whether to stream the response                                                                                                                                                                                                                                                                                                                                                                                                          |
| stop               | string \| array \| null | No       | null    | Stop sequences. Can be a string, array of strings, or null                                                                                                                                                                                                                                                                                                                                                                              |
| extra\_body        | object                  | No       | -       | Additional body parameters. Contains:<br />- `metadata`: Metadata object<br />  - `enable_thinking`: Boolean to enable thinking mode<br />  - `thinking_budget`: Integer value for thinking budget<br />  - `response_format`: Response format configuration<br />    - `type`: Format type (`json_schema`)<br />    - `json_schema`: JSON schema object<br />      - `name`: Schema name<br />      - `schema`: JSON schema definition |

### Code Example

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-mavi-...",
      base_url="https://mavi-backend.memories.ai/serve/api/v2/iu"
  )

  resp = client.chat.completions.create(
      model="qwen:qwen3-vl-plus",
      messages=[
          {"role": "system", "content": "You are a multimodal assistant. Keep your answers concise."},
          {
              "role": "user",
              "content": [
                  {
                      "image": "https://storage.googleapis.com/memories-test-data/gun5.png"  # url or base64
                  },
                  {"text": "What is the content of this image?"}
              ]
          }
      ],
      temperature=0.7,  # Controls randomness: 0.0-2.0, higher = more random
      max_tokens=1024,  # Maximum number of tokens to generate
      top_p=0.9,  # Nucleus sampling: 0.0-1.0, consider tokens with top_p probability mass
      frequency_penalty=0.0,  # -2.0 to 2.0, reduces repetition of frequent tokens
      presence_penalty=0.0,  # -2.0 to 2.0, increases likelihood of new topics
      n=1,  # Number of completions to generate
      stream=False,  # Whether to stream the response
      stop=None,  # Stop sequences (list of strings)
      extra_body={
          "metadata": {
              "enable_thinking": True,
              "thinking_budget": 1024,
              "response_format": {
                  "type": "json_schema",
                  "json_schema": {
                      "name": "answer",
                      "schema": {
                          "type": "object",
                          "properties": {
                              "result": {"type": "string"}
                          },
                          "required": ["result"]
                      }
                  }
              }
          }
      }
  )
  print(resp)
  ```
</CodeGroup>

### Response

Returns the chat completion response with structured output.

<ResponseExample>
  ```json theme={null}
  {
    "id": "6612267a-d08f-9ea0-a254-7bcea6339f49",
    "object": "completion",
    "model": "qwen3-vl-plus",
    "created_at": 1767094289,
    "status": "completed",
    "choices": [
      {
        "text": "This image is from the game Half-Life 2, showing a game scene from a first-person perspective.\n\nIn the scene, the player holds a \"Gravity Gun\" in each hand, aiming at the wall ahead. A yellow \"Mandatory Reminder\" sign hangs on the wall, printed with the U.S. national emblem pattern and inscribed with \"AMENDMENT 35\" (35th Amendment), with text below reading: \"No person shall be found with fewer than thirteen times their own body weight of federally provisioned munitions.\" - This is clearly a fictional absurd law within the game.\n\nThe bottom left corner of the screen shows the player's \"HEALTH\" and \"SUIT\" both at 100. The bottom right corner displays ammunition information \"IDC ANYMORE AMMO\", suggesting ample or infinite ammunition.\n\nThe entire scene is full of dark humor and dystopian style, one of the iconic scenes from Half-Life 2, often used by players as memes or screenshots for sharing.",
        "index": 0
      }
    ],
    "usage": {
      "input_tokens": 235,
      "output_tokens": 229,
      "total_tokens": 464
    },
    "meta": {
      "provider": "qwen",
      "provider_model": "qwen3-vl-plus"
    }
  }
  ```
</ResponseExample>

### Response Parameters

| Parameter            | Type    | Description                                       |
| -------------------- | ------- | ------------------------------------------------- |
| id                   | string  | Unique identifier for the completion              |
| object               | string  | Object type, always "completion"                  |
| model                | string  | The model used for the completion                 |
| created\_at          | integer | Unix timestamp of when the completion was created |
| status               | string  | Status of the completion (e.g., "completed")      |
| choices              | array   | Array of completion choices                       |
| choices\[].text      | string  | Text content of the completion                    |
| choices\[].index     | integer | Index of the choice in the choices array          |
| usage                | object  | Token usage information                           |
| usage.input\_tokens  | integer | Number of input tokens used                       |
| usage.output\_tokens | integer | Number of output tokens generated                 |
| usage.total\_tokens  | integer | Total number of tokens used                       |
| meta                 | object  | Metadata about the completion                     |
| meta.provider        | string  | Provider name (e.g., "qwen")                      |
| meta.provider\_model | string  | Provider-specific model name                      |


## OpenAPI

````yaml visual-intelligence/qwen/openapi.json POST /iu/chat/completions
openapi: 3.1.0
info:
  title: Qwen API Reference
  description: REST APIs for Qwen ILM and VLM models
  version: v1.0.0
servers:
  - url: https://mavi-backend.memories.ai/serve/api/v2
security:
  - ApiKeyAuth: []
paths:
  /iu/chat/completions:
    post:
      summary: Chat Completions qwen ilm
      description: >-
        Generate chat completions using Qwen ILM or VLM models with image and
        video inputs.
      operationId: chat_completions_qwen_ilm
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: The model to use (e.g., qwen:qwen3-vl-plus)
                  example: qwen:qwen3-vl-plus
                messages:
                  type: array
                  description: Array of message objects
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                      content:
                        oneOf:
                          - type: string
                          - type: array
                            items:
                              oneOf:
                                - type: object
                                  name: image
                                  properties:
                                    image:
                                      type: string
                                      description: URL or base64 encoded image
                                - type: object
                                  name: image
                                  properties:
                                    text:
                                      type: string
                                  required:
                                    - text
                    required:
                      - role
                      - content
                temperature:
                  type: number
                  description: 'Controls randomness: 0.0-2.0, higher = more random'
                  minimum: 0
                  maximum: 2
                  default: 0.7
                max_tokens:
                  type: integer
                  description: Maximum number of tokens to generate
                  default: 1024
                top_p:
                  type: number
                  description: 'Nucleus sampling: 0.0-1.0'
                  minimum: 0
                  maximum: 1
                  default: 0.9
                frequency_penalty:
                  type: number
                  description: 'Reduces repetition of frequent tokens: -2.0 to 2.0'
                  minimum: -2
                  maximum: 2
                  default: 0
                presence_penalty:
                  type: number
                  description: 'Increases likelihood of new topics: -2.0 to 2.0'
                  minimum: -2
                  maximum: 2
                  default: 0
                'n':
                  type: integer
                  description: Number of completions to generate
                  default: 1
                stream:
                  type: boolean
                  description: Whether to stream the response
                  default: false
                stop:
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: string
                    - type: 'null'
                  description: Stop sequences
                extra_body:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        enable_thinking:
                          type: boolean
                        thinking_budget:
                          type: integer
                        response_format:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - json_schema
                            json_schema:
                              type: object
                              properties:
                                name:
                                  type: string
                                schema:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - object
                                    properties:
                                      type: object
                                    required:
                                      type: array
                                      items:
                                        type: string
              required:
                - model
                - messages
      responses:
        '200':
          description: Chat completion response with structured output
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 6612267a-d08f-9ea0-a254-7bcea6339f49
                    description: Unique identifier for the completion
                  object:
                    type: string
                    example: completion
                    description: Object type, always 'completion'
                  model:
                    type: string
                    example: qwen3-vl-plus
                    description: The model used for the completion
                  created_at:
                    type: integer
                    example: 1767094289
                    description: Unix timestamp of when the completion was created
                  status:
                    type: string
                    example: completed
                    description: Status of the completion
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                          description: Text content of the completion
                          example: >-
                            This image is from the game Half-Life 2, showing a
                            game scene from a first-person perspective.
                        index:
                          type: integer
                          description: Index of the choice in the choices array
                          example: 0
                      required:
                        - text
                        - index
                  usage:
                    type: object
                    properties:
                      input_tokens:
                        type: integer
                        description: Number of input tokens used
                        example: 235
                      output_tokens:
                        type: integer
                        description: Number of output tokens generated
                        example: 229
                      total_tokens:
                        type: integer
                        description: Total number of tokens used
                        example: 464
                    required:
                      - input_tokens
                      - output_tokens
                      - total_tokens
                  meta:
                    type: object
                    properties:
                      provider:
                        type: string
                        description: Provider name
                        example: qwen
                      provider_model:
                        type: string
                        description: Provider-specific model name
                        example: qwen3-vl-plus
                    required:
                      - provider
                      - provider_model
                required:
                  - id
                  - object
                  - model
                  - created_at
                  - status
                  - choices
                  - usage
                  - meta
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````