For the complete documentation index, see llms.txt. This page is also available as Markdown.

Qwen Text Embedding v4

This documentation is valid for the following list of our models:

  • alibaba/qwen-text-embedding-v4

Model Overview

A compact language model supporting over 100 languages. It features a 4B parameter architecture, a context length of up to 32K tokens, and outputs embeddings with up to 2560 dimensions. Embeddings exhibit tighter intra-cluster cohesion and sharper inter-cluster separation compared to qwen-text-embedding-v3.

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

API Schema

post
Authorizations
AuthorizationstringRequired

Bearer key

Body
modelundefined · enumRequiredPossible values:
inputany ofRequired

Input text to embed, encoded as a string or array of tokens.

string · min: 1Optional
or
string[] · min: 1Optional
dimensionsinteger · min: 64 · max: 2048Optional

The number of dimensions for the embedding. Default is 1024.

Default: 1024
Responses
200Success
application/json
objectstring · enumRequiredPossible values:
modelstringRequired
post/v1/embeddings
POST /v1/embeddings HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 75

{
  "model": "alibaba/qwen-text-embedding-v4",
  "input": "text",
  "dimensions": 1024
}
200Success
{
  "object": "object",
  "data": [
    {
      "object": "embedding",
      "index": 1,
      "embedding": [
        1
      ]
    }
  ],
  "model": "text",
  "usage": {
    "total_tokens": 1
  }
}

Code Example

This example shows how to set up an API client, send text to the embedding API, and print the response with the embedding vector. See how large a vector response the model generates from just a single short input phrase.

Response

You can find a more advanced example of using embedding vectors in our article Find Relevant Answers: Semantic Search with Text Embeddings in the Use Cases section.

Last updated

Was this helpful?