Image and Video Understanding
Use MOSS-VL to understand images or video and return text in a Responses API object. Every request must include both a text instruction and media.
Scenario information
POST /v1/responses
Endpoint
moss-vl-1.0
Model name
Use cases
- Understanding the content of a single image
- Comparing and summarizing multiple images
- Image OCR and document content understanding
- Video summarization, event understanding, and question answering
Call steps
Create an API Key
Open the Developer Center, create an API Key, and save it as an environment variable. Do not write it into client-side code or commit it to a repository.
Environment variable MOSS_API_KEY="<your_api_key_here>"Prepare the request input
Prepare a text instruction and select the
file_idfor the image or video. For a local image or video, first use the Upload File endpoint to obtain afile_id. Do not mix images and video in the same request.{ "model": "moss-vl-1.0", "input": [ { "role": "user", "content": [ { "type": "input_text", "text": "Describe the main content of this image." }, { "type": "input_image", "file_id": "<image_file_id>" } ] } ], "max_output_tokens": 1024 }Send your first request
Send a JSON request to
/v1/responses. The endpoint synchronously returns a Responses API object with text output.If you use the image understanding example, save the image request body from step 2 as
request.jsonbefore sending the request.curl https://api.mosi.cn/v1/responses \ -H "Authorization: Bearer $MOSS_API_KEY" \ -H "Content-Type: application/json" \ -d @request.jsonRead the response
After the request completes, read
output[].content[].text. If the response returnsstatus=incomplete, the output may have been truncated bymax_output_tokens.Core result fields { "status": "completed", "output": [ { "type": "message", "role": "assistant", "content": [ { "type": "output_text", "text": "There are four nuts in the image." } ] } ] }Verify success
Success means the response status is
completedandoutput[].content[].textcontains text generated by the model.
Notes
- A single request currently accepts up to 5 images or 1 video.
- Images and video cannot currently be mixed in the same request.
- The main examples in this scenario guide use
file_idbecause it provides a more stable request flow. - You can also use
image_url/video_urlto provide a public or object storage URL, but the URL must be accessible to the service. If you are unsure whether the URL is stable, upload the file first and use itsfile_id.