POST
/
chat
/
completions
Chat Completions qwen
curl --request POST \
  --url https://mavi-backend.memories.ai/serve/api/v2/chat/completions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "qwen:qwen3-vl-plus",
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1024,
  "top_p": 0.9,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "n": 1,
  "stream": false,
  "stop": "<string>",
  "extra_body": {
    "metadata": {
      "enable_thinking": true,
      "thinking_budget": 123,
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "name": "<string>",
          "schema": {
            "type": "object",
            "properties": {},
            "required": [
              "<string>"
            ]
          }
        }
      }
    }
  }
}
'
{
  "id": "9212f247-2372-95b3-8c9b-968368a952fc",
  "object": "completion",
  "model": "qwen3-vl-plus",
  "created_at": 1767095035,
  "status": "completed",
  "choices": [
    {
      "text": "This video shows an interesting scientific experiment conducted in a vacuum environment, titled \"Vacuum vs Orange\".\n\n**Experimental Setup and Preparation:**\n- The experiment is conducted in a transparent vacuum chamber with a red lid on top, equipped with a pressure gauge and valve.\n- Three items are placed inside the chamber:\n  1. A whole orange placed on a metal stand.\n  2. A peeled orange (or small orange) also placed on a stand.\n  3. A glass of orange juice in a wine glass.\n\n**Experimental Process:**\n1. **Vacuum begins (around 0:02)**: The operator opens the valve and starts evacuating. As the pressure inside the chamber decreases (pressure gauge needle moves), the orange juice begins to bubble and expand vigorously.\n2. **Orange juice reacts violently (around 0:14)**: The orange juice rapidly expands and overflows from the wine glass, forming a large amount of foam and flowing to the bottom of the chamber. This is due to dissolved gases in the liquid rapidly releasing under low pressure.\n3. **Fruit changes (around 0:28)**: The peeled orange surface begins to exude juice, the flesh expands and becomes moist and juicy; the whole orange surface also begins to have slight water seepage, but the changes are less obvious.\n4. **Sustained low pressure state (around 0:35-0:53)**: Orange juice continues to bubble, foam gradually stabilizes; peeled orange continues to exude juice, flesh significantly expands; whole orange surface has water droplets condensing.\n5. **Ending stage (around 0:55)**: The operator closes the valve, stops evacuating, pressure gauge needle swings back, and the pressure inside the chamber recovers. Orange juice foam gradually subsides, but the spilled liquid and exuded juice remain at the bottom of the chamber.\n\n**Experimental Results Summary:**\n- **Orange juice**: Under vacuum, due to sudden pressure drop, dissolved gases rapidly escape, causing violent boiling and overflow.\n- **Peeled orange**: Flesh exposed to low pressure environment, intracellular gas expands, causing flesh expansion and exuding large amounts of juice.\n- **Whole orange**: Protected by the peel, changes are minimal, only slight water vapor condensation on the surface.\n\n**Scientific Principle:**\nThis experiment visually demonstrates the physical phenomena of \"pressure reduction causing liquid boiling point to decrease\" and \"gas solubility decreases as pressure decreases\", commonly used in science education to vividly demonstrate the effects of vacuum environment on different forms of matter.\n\nThe entire video reveals the effects of pressure changes on matter states in a vivid and interesting way by comparing the different reactions of three forms of orange products in vacuum.",
      "index": 0
    }
  ],
  "usage": {
    "input_tokens": 34578,
    "output_tokens": 561,
    "total_tokens": 35139
  },
  "meta": {
    "provider": "qwen",
    "provider_model": "qwen3-vl-plus"
  }
}
This endpoint allows you to generate chat completions with image and video inputs using Qwen VLM model.

Request Body

ParameterTypeRequiredDefaultDescription
modelstringYes-The model to use (e.g., qwen:qwen3-vl-plus)
messagesarrayYes-Array of message objects. Each message contains:
- role: Role type, values: system, user
- content: Message content, can be a string or array. Array items can contain:
- image: Image URL or base64 encoded image
- video: Video URL only (video does not support base64)
- text: Text content
temperaturenumberNo0.7Controls randomness: 0.0-2.0, higher = more random
max_tokensintegerNo1024Maximum number of tokens to generate
top_pnumberNo0.9Nucleus sampling: 0.0-1.0, consider tokens with top_p probability mass
frequency_penaltynumberNo0.0Reduces repetition of frequent tokens: -2.0 to 2.0
presence_penaltynumberNo0.0Increases likelihood of new topics: -2.0 to 2.0
nintegerNo1Number of completions to generate
streambooleanNofalseWhether to stream the response
stopstring | array | nullNonullStop sequences. Can be a string, array of strings, or null
extra_bodyobjectNo-Additional body parameters. Contains:
- metadata: Metadata object
- enable_thinking: Boolean to enable thinking mode
- thinking_budget: Integer value for thinking budget
- response_format: Response format configuration
- type: Format type (json_schema)
- json_schema: JSON schema object
- name: Schema name
- schema: JSON schema definition

Code Example

from openai import OpenAI

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

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
                },
                {
                    "video": "https://storage.googleapis.com/memories-test-data/test_1min.mp4"  # url only
                },
                {"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)

Response

Returns the chat completion response with structured output.
{
  "id": "9212f247-2372-95b3-8c9b-968368a952fc",
  "object": "completion",
  "model": "qwen3-vl-plus",
  "created_at": 1767095035,
  "status": "completed",
  "choices": [
    {
      "text": "This video shows an interesting scientific experiment conducted in a vacuum environment, titled \"Vacuum vs Orange\".\n\n**Experimental Setup and Preparation:**\n- The experiment is conducted in a transparent vacuum chamber with a red lid on top, equipped with a pressure gauge and valve.\n- Three items are placed inside the chamber:\n  1. A whole orange placed on a metal stand.\n  2. A peeled orange (or small orange) also placed on a stand.\n  3. A glass of orange juice in a wine glass.\n\n**Experimental Process:**\n1. **Vacuum begins (around 0:02)**: The operator opens the valve and starts evacuating. As the pressure inside the chamber decreases (pressure gauge needle moves), the orange juice begins to bubble and expand vigorously.\n2. **Orange juice reacts violently (around 0:14)**: The orange juice rapidly expands and overflows from the wine glass, forming a large amount of foam and flowing to the bottom of the chamber. This is due to dissolved gases in the liquid rapidly releasing under low pressure.\n3. **Fruit changes (around 0:28)**: The peeled orange surface begins to exude juice, the flesh expands and becomes moist and juicy; the whole orange surface also begins to have slight water seepage, but the changes are less obvious.\n4. **Sustained low pressure state (around 0:35-0:53)**: Orange juice continues to bubble, foam gradually stabilizes; peeled orange continues to exude juice, flesh significantly expands; whole orange surface has water droplets condensing.\n5. **Ending stage (around 0:55)**: The operator closes the valve, stops evacuating, pressure gauge needle swings back, and the pressure inside the chamber recovers. Orange juice foam gradually subsides, but the spilled liquid and exuded juice remain at the bottom of the chamber.\n\n**Experimental Results Summary:**\n- **Orange juice**: Under vacuum, due to sudden pressure drop, dissolved gases rapidly escape, causing violent boiling and overflow.\n- **Peeled orange**: Flesh exposed to low pressure environment, intracellular gas expands, causing flesh expansion and exuding large amounts of juice.\n- **Whole orange**: Protected by the peel, changes are minimal, only slight water vapor condensation on the surface.\n\n**Scientific Principle:**\nThis experiment visually demonstrates the physical phenomena of \"pressure reduction causing liquid boiling point to decrease\" and \"gas solubility decreases as pressure decreases\", commonly used in science education to vividly demonstrate the effects of vacuum environment on different forms of matter.\n\nThe entire video reveals the effects of pressure changes on matter states in a vivid and interesting way by comparing the different reactions of three forms of orange products in vacuum.",
      "index": 0
    }
  ],
  "usage": {
    "input_tokens": 34578,
    "output_tokens": 561,
    "total_tokens": 35139
  },
  "meta": {
    "provider": "qwen",
    "provider_model": "qwen3-vl-plus"
  }
}

Response Parameters

ParameterTypeDescription
idstringUnique identifier for the completion
objectstringObject type, always “completion”
modelstringThe model used for the completion
created_atintegerUnix timestamp of when the completion was created
statusstringStatus of the completion (e.g., “completed”)
choicesarrayArray of completion choices
choices[].textstringText content of the completion
choices[].indexintegerIndex of the choice in the choices array
usageobjectToken usage information
usage.input_tokensintegerNumber of input tokens used
usage.output_tokensintegerNumber of output tokens generated
usage.total_tokensintegerTotal number of tokens used
metaobjectMetadata about the completion
meta.providerstringProvider name (e.g., “qwen”)
meta.provider_modelstringProvider-specific model name

Authorizations

Authorization
string
header
required

Body

application/json
model
string
required

The model to use (e.g., qwen:qwen3-vl-plus)

Example:

"qwen:qwen3-vl-plus"

messages
object[]
required

Array of message objects

temperature
number
default:0.7

Controls randomness: 0.0-2.0, higher = more random

Required range: 0 <= x <= 2
max_tokens
integer
default:1024

Maximum number of tokens to generate

top_p
number
default:0.9

Nucleus sampling: 0.0-1.0

Required range: 0 <= x <= 1
frequency_penalty
number
default:0

Reduces repetition of frequent tokens: -2.0 to 2.0

Required range: -2 <= x <= 2
presence_penalty
number
default:0

Increases likelihood of new topics: -2.0 to 2.0

Required range: -2 <= x <= 2
n
integer
default:1

Number of completions to generate

stream
boolean
default:false

Whether to stream the response

stop

Stop sequences

extra_body
object

Response

200 - application/json

Chat completion response with structured output

id
string
required

Unique identifier for the completion

Example:

"9212f247-2372-95b3-8c9b-968368a952fc"

object
string
required

Object type, always 'completion'

Example:

"completion"

model
string
required

The model used for the completion

Example:

"qwen3-vl-plus"

created_at
integer
required

Unix timestamp of when the completion was created

Example:

1767095035

status
string
required

Status of the completion

Example:

"completed"

choices
object[]
required
usage
object
required
meta
object
required