Skip to content

Gemini Embedding 2

Multilingual text embeddings for search, retrieval and clustering.

  • by Google
  • Embeddings
  • $0.20 per M tokens
On this page

1.Call

OpenAI-compatible embeddings; works with the official OpenAI SDKs. Every response carries an x-request-id trace ID.

curl https://api.ewest.ai/v1/embeddings \
  -H "Authorization: Bearer $EWEST_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ewest/gemini-embedding", "input": ["How do I reset my password?", "Billing questions"]}'

# → {"data": [{"embedding": [0.012, -0.034, …], "index": 0}, …], "usage": {…}}

2.Authentication

Send your API key in the Authorization: Bearer header, as the examples above do (clients built for the Anthropic API can use x-api-key). Create keys under API keys. Keep the key on your server, never in browser code. More in the authentication guide.

3.Schema

What you send and what comes back, for ewest/gemini-embedding. The output tables are read from the API's OpenAPI description.

Input

POST /v1/embeddings
  • modelstringRequired
    The model id, ewest/gemini-embedding.
  • inputstring or arrayRequired
    Text to embed, or a list of texts. Up to 8,192 tokens each.

Output

Returns an embedding vector. POST /v1/embeddings answers 200: One vector per input, in input order.

  • objectstringAlways
    Always list.
  • modelstringAlways
    The model that produced the embeddings.
  • dataarray of objectAlways
    One embedding per input, in order.
  • data[].objectstringSometimes
    Always embedding.
  • data[].indexintegerAlways
    Position of the input this embedding belongs to.
  • data[].embeddingarray of number, or string (base64)Always
    The vector: a list of numbers, or a base64 string with encoding_format: "base64".
  • usageobjectSometimes
    Token usage of the request.
  • usage.prompt_tokensintegerSometimes
    Tokens in the input.
  • usage.total_tokensintegerSometimes
    Total tokens billed.

Sample response

The vector is shortened here; ewest/gemini-embedding returns 3,072 numbers per input.

{
  "object": "list",
  "model": "ewest/gemini-embedding",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [-0.0064, 0.011, 0.0149, 0.0042]
    }
  ],
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}

4.Details

Input limit
8,192 tokens per input
Dimensions
3072
API
OpenAI-compatible embeddings