Skip to main content
POST
/
v1beta
/
models
/
{model}
:embedContent
curl --request POST \
  --url https://api.foxapi.cc/v1beta/models/{model}:embedContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "content": {
    "parts": [
      {
        "text": "What is deep learning?"
      }
    ]
  }
}
'
{
  "embedding": {
    "values": [
      0.0123,
      -0.0456,
      0.0789,
      0.0234,
      -0.0567
    ]
  }
}

Authorizations

Authorization
string
header
required

All APIs require Bearer Token authentication

Add to request header:

Authorization: Bearer YOUR_API_KEY

Path Parameters

model
string
required

Embedding model name, e.g. gemini-embedding-2-preview

Example:

"gemini-embedding-2-preview"

Body

application/json
content
object
required

The content to embed

taskType
enum<string>

Embedding task type that influences the optimization direction of the embedding vector

Available options:
RETRIEVAL_QUERY,
RETRIEVAL_DOCUMENT,
SEMANTIC_SIMILARITY,
CLASSIFICATION,
CLUSTERING,
QUESTION_ANSWERING,
FACT_VERIFICATION,
CODE_RETRIEVAL_QUERY
title
string

Document title, only effective when taskType is RETRIEVAL_DOCUMENT

outputDimensionality
integer

Output vector dimensionality for dimension reduction. Default is 3072

Response

Embed Content response

embedding
object

Embedding result