This document describes the parameters and usage of the Multimodal Search API.
API
The Multimodal Search API provides powerful image search capabilities based on text queries. It is optimized to deliver excellent performance in search relevance, cost, and latency.
API definition
Request parameters
Parameter | Type | Required | Default | Description | Example value | |
query | string | Yes | - | The search query. Must be 1 to 50 characters in length. Important For best results, limit the query to 30 characters. You can use a model to rewrite longer queries on the client side before calling the API. | lion | |
engineType | string | No | MultimodalSpeed | The search engine type. Valid values:
| MultimodalSpeedAdvanced | |
advancedParams | map<string, string> | No | - | Advanced search parameters:
| | |
Response parameters
Field | Type | Nullable | Description | Example (query: lion) | ||
requestId | string | No | The request ID. Provide this ID for troubleshooting. | 35E5608A-A737-2038-****-D9D34C6BFD9E | ||
imageItems[] | title | string | No | The title of the webpage. | The Lion's life of battle: a legendary tale of survival | |
hostPageUrl | string | No | The URL of the webpage where the image is hosted. | https://example.html | ||
imageUrl | string | No | The URL of the image. | https://imageexample.html | ||
publishedTime | string | Nullable only when | The time when the webpage was published, in ISO 8601 format. | 2024-12-18T22:24:24+08:00 | ||
height | int32 | No | The height of the image in pixels. | 1330 | ||
width | int32 | No | The width of the image in pixels. | 1000 | ||
searchInformation | searchTime | int64 | No | The search latency, in milliseconds. | 1048 | |
queryContext | originalQuery | query | string | No | The original | lion |
The server-side timeout is 5 seconds.
Examples
Request body
{
"query": "lion",
"advancedParams": {
"excludeSites": "www.360doc.com,weibo.com"
}
}Response body
{
"requestId": "********",
"imageItems": [
{
"title": "The Lion's life of battle: a legendary tale of survival",
"publishedTime": "2025-04-12T12:47:54+08:00",
"imageUrl": "http://pic.rmb.bdstatic.com/bjh/bb9193e11fbc/250412/cb5ab496c1b690c6514da34db1ecabb6.jpeg?for=bg",
"hostPageUrl": "https://quanmin.baidu.com/sv?source=share-h5&pd=qm_share_search&vid=4798422598618199036",
"height": 1280,
"width": 720
},
{
"title": "Majestic Lions of the Savanna: A Photo Gallery",
"publishedTime": "2025-09-27T03:25:26+08:00",
"imageUrl": "http://b0.bdstatic.com/ugc/_aq4Eq8b3neWg7bUSTpRMAb2d849c9780458737158f6dec8dc4bef.jpg",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_5267989015389343625",
"height": 1232,
"width": 928
},
{
"title": "Do lions really smell? The truth about their scent",
"publishedTime": "2025-10-25T22:17:00+08:00",
"imageUrl": "http://q9.itc.cn/images01/20251021/2b6c94863d7a45929c8f67590a187329.jpeg",
"hostPageUrl": "http://news.sohu.com/a/945934548_120545240",
"height": 853,
"width": 1280
},
{
"title": "Leo's Roar: A Guide to the Lion Horoscope",
"publishedTime": "2025-10-05T09:30:43+08:00",
"imageUrl": "http://pic.rmb.bdstatic.com/bjh/3f119887b814/251005/f0e1de6994276136c35f8763cd79a989.png",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4244727221681996203",
"height": 1121,
"width": 934
},
{
"title": "Curation 146 / lions",
"publishedTime": "2022-07-03T00:00:00+08:00",
"imageUrl": "http://sns-img-qc.xhscdn.com/010273016jh26jo8ja7011bs4ue7rjcpzf?imageView2/2/w/1080/format/webp",
"hostPageUrl": "http://www.xiaohongshu.com/discovery/item/62c1a8ad000000000102fff2",
"height": 1441,
"width": 1080
},
{
"title": "This playful lion cub is full of energy!",
"publishedTime": "2025-07-17T17:57:00+08:00",
"imageUrl": "http://b0.bdstatic.com/ugc/Hs065dVoGvbUAK9o9yptiAa61f2cd1e32a33239e119b885321c017.jpg",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4778610846744027573",
"height": 1664,
"width": 936
},
{
"title": "A Sleeping Lion: When will it awaken?",
"publishedTime": "2020-05-15T10:45:12+08:00",
"imageUrl": "http://gbres.dfcfw.com/Files/picture/20200515/E22CB6AF03759A8791300FD476EE8D99_w1680h1050.jpg",
"hostPageUrl": "http://guba.eastmoney.com/news,002852,930168103,4195112827546318.html",
"height": 1050,
"width": 1680
},
{
"title": "Lion subspecies: Differences and conservation status",
"publishedTime": "2025-12-13T11:52:08+08:00",
"imageUrl": "http://pic.rmb.bdstatic.com/bjh/other/7e5c29616163c88db19504ea7dffba39.png?for=bg",
"hostPageUrl": "https://quanmin.baidu.com/sv?source=share-h5&pd=qm_share_search&vid=18144687723668657466",
"height": 1664,
"width": 928
},
{
"title": "Golden Hour: A lion's mane at sunset",
"publishedTime": "2025-09-19T16:05:08+08:00",
"imageUrl": "http://b0.bdstatic.com/ugc/creative_center/RNbRETUMRKSxdLMpdzvAjAb7ae17de83fff0353bfa3828051f53b5.jpg",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4520815613738106269",
"height": 2188,
"width": 988
},
{
"title": "This playful lion cub is causing a stir!",
"publishedTime": "2025-07-17T17:57:00+08:00",
"imageUrl": "http://b0.bdstatic.com/ugc/Hs065dVoGvbUAK9o9yptiA3e638a890ea5ad2223fe6bc41cbb4821.jpg",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4778610846744027573",
"height": 1664,
"width": 936
},
{
"title": "A heartwarming moment in a lion family",
"publishedTime": "2025-08-02T21:27:14+08:00",
"imageUrl": "http://b0.bdstatic.com/ugc/Hs065dVoGvbUAK9o9yptiA986dd2160c75da1850b34393452b52ae.jpg",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_3800333561420709257",
"height": 1664,
"width": 936
},
{
"title": "Zookeeper interacts with a lion up close",
"publishedTime": "2025-08-27T00:00:00+08:00",
"imageUrl": "http://q6.itc.cn/q_70/images03/20250827/b908b4f0e1234671a3327b5d325a030b.jpeg",
"hostPageUrl": "http://www.sohu.com/a/928684234_100114195",
"height": 1280,
"width": 720
},
{
"title": "HD Lion Wallpapers | Image Community",
"publishedTime": "2023-12-24T03:23:39+08:00",
"imageUrl": "http://c-ssl.dtstatic.com/uploads/item/202102/12/20210212165128_losrw.thumb.400_0.jpg",
"hostPageUrl": "http://www.duitang.com/blogs/tag/?name=%CA%A8%D7%D3%B6%AF%CE%EF%CD%BC%C6%AC&start=144",
"height": 711,
"width": 400
},
{
"title": "The lion families of Masai Mara National Park revealed!",
"publishedTime": "2024-12-25T10:54:17+08:00",
"imageUrl": "http://miaobi-lite.bj.bcebos.com/miaobi/5mao/b%275Lit5Lic6ZuE54uuXzE3MzM4NDY3MjUuMTgzMjY2Mg%3D%3D%27/0.png",
"hostPageUrl": "http://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4908065249726726296",
"height": 1050,
"width": 1621
},
{
"title": "Understanding Loyalty: A Look at the Lion's Heart",
"publishedTime": "2024-03-16T10:31:08+08:00",
"imageUrl": "http://pic.rmb.bdstatic.com/bjh/240316/events/40074e13b9df1b66808a4b74c985e4902381.jpeg@h_1280",
"hostPageUrl": "https://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4520288067222930888",
"height": 1280,
"width": 1778
},
{
"title": "Saturday Afternoon Art Class: Crayon Drawings",
"publishedTime": "2020-11-07T00:00:00+08:00",
"imageUrl": "http://ss2.meipian.me/users/15565667/12a9d13824a1c862efac377825792599.jpg?meipian-raw/bucket/ivwen/key/dXNlcnMvMTU1NjU2NjcvMTJhOWQxMzgyNGExYzg2MmVmYWMzNzc4MjU3OTI1OTkuanBn/sign/5ff30d4d147e1d9192e168a902c52927.jpg",
"hostPageUrl": "http://www.meipian.cn/38vc9yej",
"height": 934,
"width": 640
},
{
"title": "Male lions showing affection",
"publishedTime": "2026-01-01T20:12:31+08:00",
"imageUrl": "http://i2.hdslb.com/bfs/archive/e251d2e1386aa0a84a4cf0b9e30168fa80d32a1d.jpg",
"hostPageUrl": "http://www.bilibili.com/video/BV171vDBtEeA",
"height": 1440,
"width": 2560
},
{
"title": "Wallpaper: Savanna, lion, animals, 1920x1080 full HD",
"publishedTime": "2020-11-05T12:31:16+08:00",
"imageUrl": "http://s2.best-wallpaper.net/wallpaper/iphone/1412/Savanna-lion-animals_iphone_640x960.jpg",
"hostPageUrl": "http://cn.best-wallpaper.net/savanna-lion-animals_wallpapers.html",
"height": 960,
"width": 640
},
{
"title": "Messy-maned lion at Qianling Mountain gets a bath",
"publishedTime": "2025-12-26T19:17:10+08:00",
"imageUrl": "http://i0.hdslb.com/bfs/archive/b9e47b113dae41d8589aceade346a5ee34bb0d3d.jpg",
"hostPageUrl": "http://www.bilibili.com/video/BV1MdBYBBEke",
"height": 1125,
"width": 2000
},
{
"title": "Why business is getting harder: A lesson from the savanna",
"publishedTime": "2023-09-21T08:53:07+08:00",
"imageUrl": "http://pic.rmb.bdstatic.com/bjh/114531eef1b85ed9aeb34acc4103d73f1885.jpeg@h_1280",
"hostPageUrl": "https://mbd.baidu.com/newspage/data/dtlandingsuper?nid=dt_4712827839063249262",
"height": 1280,
"width": 1918
}
],
"searchInformation": {
"searchTime": 808
},
"queryContext": {
"originalQuery": {
"query": "lion"
}
}
}Error codes
Status | Error code | Error message | Solution |
404 | InvalidAccessKeyId.NotFound | Specified access key is not found. | Check that your Access Key ID and Access Key Secret are correct. |
403 | Retrieval.NotActivate | The AI search service is not activated. | Subscribe to the service, or contact your account manager to activate it. |
403 | Retrieval.Arrears | Insufficient account balance. | Your account has an insufficient balance. Add funds to your account. |
403 | Retrieval.NotAuthorised | The sub-account is not authorized. | Grant the AliyunIQSFullAccess permission to the RAM user. For instructions, see Create a RAM user and grant permissions. |
403 | Retrieval.TestUserPeriodExpired | The test period has expired. | Your trial period has expired. The trial is valid for 15 days after you subscribe. Contact your Alibaba Cloud account manager to upgrade to a paid plan. |
429 | Retrieval.Throttling.User | Request was denied due to user flow control. | You have exceeded the request rate limit. Contact your Alibaba Cloud account manager to upgrade your plan or increase your quota. |
429 | Retrieval.TestUserQueryPerDayExceeded | The daily query limit was exceeded. | You have exceeded the daily query limit for trial users (1,000 queries/day). Contact your Alibaba Cloud account manager to upgrade to a paid plan. |
API calls
SDK calls
To make API calls with an SDK, authenticate your requests by using your Alibaba Cloud Access Key ID and Access Key Secret.
Python SDK
Prerequisites
You must have Python 3.8 or later installed.
Installation
pip3 install alibabacloud_iqs20241111==1.10.2Sample code
Synchronous call
import os
from Tea.exceptions import TeaException
from alibabacloud_iqs20241111 import models
from alibabacloud_iqs20241111.client import Client
from alibabacloud_tea_openapi import models as open_api_models
class Sample:
def __init__(self):
pass
@staticmethod
def create_client() -> Client:
config = open_api_models.Config(
# TODO: Replace with your Access Key ID and Access Key Secret. We recommend loading them from environment variables.
access_key_id=os.environ.get('YOUR_ACCESS_KEY'),
access_key_secret=os.environ.get('YOUR_ACCESS_SECRET')
)
config.endpoint = f'iqs.cn-zhangjiakou.aliyuncs.com'
return Client(config)
@staticmethod
def main() -> None:
client = Sample.create_client()
advancedParams = {
"excludeSites": "www.360doc.com,weibo.com"
}
multimodal_search_body = models.MultimodalSearchBody(
query='lion',
advanced_params=advancedParams
)
request = models.MultimodalSearchRequest(
body=multimodal_search_body
)
try:
response = client.multimodal_search(request)
print(
f"API call successful. Request ID: {response.body.request_id}, Results: {len(response.body.image_items)}, Search time (ms): {response.body.search_information.search_time}")
for index, item in enumerate(response.body.image_items):
print(f"Result {index + 1}. {'-' * 20}")
print(f" Title: {item.title}")
print(f" Image URL: {item.image_url}")
print(f" Host Page URL: {item.host_page_url}")
print(f" Published Time: {item.published_time}")
print(f" Width: {item.width}")
print(f" Height: {item.height}")
except TeaException as e:
code = e.code
request_id = e.data.get("requestId")
message = e.data.get("message")
print(f"API call failed. Request ID: {request_id}, Error code: {code}, Message: {message}")
if __name__ == '__main__':
Sample.main()
Asynchronous call
import os
import asyncio
from Tea.exceptions import TeaException
from alibabacloud_iqs20241111 import models
from alibabacloud_iqs20241111.client import Client
from alibabacloud_tea_openapi import models as open_api_models
class Sample:
def __init__(self):
pass
@staticmethod
def create_client() -> Client:
config = open_api_models.Config(
# TODO: Replace with your Access Key ID and Access Key Secret. We recommend loading them from environment variables.
access_key_id=os.environ.get('YOUR_ACCESS_KEY'),
access_key_secret=os.environ.get('YOUR_ACCESS_SECRET')
)
config.endpoint = f'iqs.cn-zhangjiakou.aliyuncs.com'
return Client(config)
async def main_async(self) -> None:
client = self.create_client()
advancedParams = {
"excludeSites": "www.360doc.com,weibo.com"
}
multimodal_search_body = models.MultimodalSearchBody(
query='lion',
advanced_params=advancedParams
)
request = models.MultimodalSearchRequest(
body=multimodal_search_body
)
try:
response = await client.multimodal_search_async(request)
print(
f"API call successful. Request ID: {response.body.request_id}, Results: {len(response.body.image_items)}, Search time (ms): {response.body.search_information.search_time}")
for index, item in enumerate(response.body.image_items):
print(f"Result {index + 1}. {'-' * 20}")
print(f" Title: {item.title}")
print(f" Image URL: {item.image_url}")
print(f" Host Page URL: {item.host_page_url}")
print(f" Published Time: {item.published_time}")
print(f" Width: {item.width}")
print(f" Height: {item.height}")
except TeaException as e:
code = e.code
request_id = e.data.get("requestId")
message = e.data.get("message")
print(f"API call failed. Request ID: {request_id}, Error code: {code}, Message: {message}")
if __name__ == '__main__':
sample = Sample()
asyncio.run(sample.main_async())
Java SDK
Prerequisites
You must have Java 8 or later installed.
Maven dependency
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>iqs20241111</artifactId>
<version>1.10.2</version>
</dependency>Sample code
package com.aliyun.iqs.example;
import com.aliyun.iqs20241111.Client;
import com.aliyun.iqs20241111.models.*;
import com.aliyun.teaopenapi.models.Config;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.HashMap;
import java.util.Map;
public class MultimodalSearchExample {
public static void main(String[] args) throws Exception {
Client client = initClient();
invoke(client, "lion", "www.360doc.com,weibo.com");
}
private static Client initClient() throws Exception {
// TODO: Replace with your Access Key ID and Access Key Secret. We recommend loading them from environment variables.
String accessKeyId = System.getenv("YOUR_ACCESS_KEY");
String accessKeySecret = System.getenv("YOUR_ACCESS_SECRET");
Config config = new Config()
.setAccessKeyId(accessKeyId)
.setAccessKeySecret(accessKeySecret);
config.setEndpoint("iqs.cn-zhangjiakou.aliyuncs.com");
return new Client(config);
}
private static void invoke(Client client, String query, String excludeSites) {
MultimodalSearchBody input = new MultimodalSearchBody();
input.setQuery(query);
Map<String, String> advancedParams = new HashMap<>();
advancedParams.put("excludeSites",excludeSites);
input.setAdvancedParams(advancedParams);
MultimodalSearchRequest request = new MultimodalSearchRequest().setBody(input);
try {
long start = System.currentTimeMillis();
MultimodalSearchResponse response = client.multimodalSearch(request);
MultimodalSearchResponseBody result = response.getBody();
long latency = System.currentTimeMillis() - start;
System.out.println("Latency: " + latency + " ms, Request ID: " + result.getRequestId());
printOutput(result);
} catch (Exception e) {
e.printStackTrace();
}
}
private static void printOutput(MultimodalSearchResponseBody output) {
// Use GsonBuilder to create a formatted Gson instance.
Gson gson = new GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.create();
// Print the formatted JSON.
String prettyJson = gson.toJson(output);
System.out.println(prettyJson);
}
}
Go SDK
Prerequisites
You must have Go 1.10.x or a later version installed.
Installation
require (
github.com/alibabacloud-go/iqs-20241111 v1.10.2
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10
)
Sample code
package main
import (
"encoding/json"
"fmt"
"log"
"os"
openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
iqs20241111 "github.com/alibabacloud-go/iqs-20241111/client"
util "github.com/alibabacloud-go/tea-utils/v2/service"
"github.com/alibabacloud-go/tea/tea"
)
const endpointURL = "iqs.cn-zhangjiakou.aliyuncs.com"
func createClient() (*iqs20241111.Client, error) {
// TODO: Replace with your Access Key ID and Access Key Secret. We recommend loading them from environment variables.
accessKeyID := os.Getenv("YOUR_ACCESS_KEY")
accessKeySecret := os.Getenv("YOUR_ACCESS_SECRET")
if accessKeyID == "" || accessKeySecret == "" {
return nil, fmt.Errorf("YOUR_ACCESS_KEY or YOUR_ACCESS_SECRET environment variable is not set")
}
config := &openapi.Config{
AccessKeyId: tea.String(accessKeyID),
AccessKeySecret: tea.String(accessKeySecret),
Endpoint: tea.String(endpointURL),
}
return iqs20241111.NewClient(config)
}
func runMultimodalSearch(client *iqs20241111.Client) error {
body := &iqs20241111.MultimodalSearchBody{
Query: tea.String("lion"),
AdvancedParams: map[string]*string{
"excludeSites": tea.String("www.360doc.com,weibo.com"),
},
}
request := &iqs20241111.MultimodalSearchRequest{
Body: body,
}
runtime := &util.RuntimeOptions{}
resp, err := client.MultimodalSearchWithOptions(request, nil, runtime)
if err != nil {
return fmt.Errorf("multimodal search failed: %w", err)
}
// Pretty-print the JSON response
jsonBytes, err := json.MarshalIndent(resp.Body, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal response to JSON: %w", err)
}
fmt.Printf("Request ID: %s\nResponse: %s\n", *resp.Body.RequestId, string(jsonBytes))
return nil
}
func main() {
client, err := createClient()
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
if err := runMultimodalSearch(client); err != nil {
log.Fatalf("Error running multimodal search: %v", err)
}
}
HTTP calls
To make HTTP calls, authenticate your requests with an API key from Information Query Service (IQS). To get an API key, see Create and view credential keys.
curl -X POST https://cloud-iqs.aliyuncs.com/search/multimodal \
--header "Authorization: Bearer $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"query": "lion"
}'
Replace $API_KEY with the API key that you created in the IQS console. For instructions, see Create and view credential keys. A new API key becomes active after approximately 5 minutes.