Create Embeddings
Generate vector embeddings with an OpenAI-compatible response format.
Models: google/gemini-embedding-2 supports text, image, audio, and video. cohere/embed-v4.0 supports text and one image. OpenAI and Qwen embedding models are text-only.
Input: Pass a string, an array of up to 32 strings, or supported multimodal content parts (text, image_url, input_audio, video_url) in the input field.
Retrieval roles: Use task_type with Gemini text input; it is converted to the model's recommended prompt instruction. Use input_type (query or document) with Cohere.
Billing: Gemini task instructions count toward prompt token usage. Cohere image requests expose one combined usage count, so text accompanying an image is billed at the image-input rate.
Gemini migration: google/gemini-embedding-2 uses the GA embedding space. Do not mix preview-era and GA vectors; re-embed stored google/gemini-embedding-2 data before comparing it with new results.
Dimensions: Defaults are model-specific. Qwen supports up to 4096; Gemini and OpenAI large up to 3072; OpenAI small up to 1536; Cohere supports 256, 512, 1024, or 1536.
Request
- Base URL: https://gen.pollinations.ai
- URL: https://gen.pollinations.ai/v1/embeddings
- Auth: HTTP bearer
Request body
Example request
{
"model": "google/gemini-embedding-2",
"input": {
"image_url": {
"url": "https://example.com/image.jpg"
}
},
"dimensions": 768,
"task_type": "RETRIEVAL_QUERY",
"input_type": "query",
"encoding_format": "float"
}Response
Success
Changes
No recorded changes to this operation across all 1 revision of this API.