Docs Native format /v1beta/models/gemini-embedding-001:embedContent
API reference

text embedding

https://ai.google.dev/gemini-api/docs/embeddings?hl=zh-cnrest_3 Official documentation

POST/v1beta/models/gemini-embedding-001:embedContent

Body Parametersapplication/json

content* object

The content to embed.

properties
parts array

List of content parts; may include text, inline_data / inlineData, etc.

output_dimensionality integer

Optional dimensionality reduction of the output embedding.

taskType string

Optional task type that the embedding will be used for.

Responses

200 application/json
response-200 object
properties
embeddings object

List of embedding vectors

400 Bad request or validation failed application/json
response-400 object
properties
error* object
401 Missing or invalid API Key application/json
response-401 object
Request Body Example
1{
2"content": {
3"parts": [
4{
5"text": "What is the meaning of life?"
6}
7]
8},
9"output_dimensionality": 768,
10"taskType": "SEMANTIC_SIMILARITY"
11}
Code Sample cURL
1curl -X POST "https://api.digislash.com/v1beta/models/gemini-embedding-001:embedContent" \
2-H "Authorization: Bearer <API Key>" \
3-H "Content-Type: application/json" \
4-d '{
5"content": {
6"parts": [
7{
8"text": "What is the meaning of life?"
9}
10]
11},
12"output_dimensionality": 768,
13"taskType": "SEMANTIC_SIMILARITY"
14}'
Response
1▼{
2▼"embedding": {
3▶"values": [ 5 items ]
4}
5}