Generate text embeddings using Google Gemini API for RAG, semantic similarity, classification, and clustering tasks. Invoke when user wants to embed text, create embeddings, or convert text to vectors with Gemini.
View on GitHubgemini-api/skills/gemini-embed/SKILL.md
February 2, 2026
Select agents to install to:
npx add-skill https://github.com/legacybridge-tech/claude-plugins/blob/main/gemini-api/skills/gemini-embed/SKILL.md -a claude-code --skill gemini-embedInstallation paths:
.claude/skills/gemini-embed/# Gemini Embeddings API
Generate text embeddings using Google Gemini API via REST.
## Prerequisites
- Environment variable `GOOGLE_API_KEY` must be set
- API endpoint: `https://generativelanguage.googleapis.com/v1beta`
- Model: `gemini-embedding-001`
## Workflow
### Phase 1: Determine Embedding Type
- **Single Embedding**: For one text input
- **Batch Embedding**: For multiple texts (more efficient)
### Phase 2: Configure Task Type (Optional)
Choose based on use case:
- `RETRIEVAL_QUERY`: For search queries
- `RETRIEVAL_DOCUMENT`: For documents to be searched
- `SEMANTIC_SIMILARITY`: For comparing text similarity
- `CLASSIFICATION`: For text classification
- `CLUSTERING`: For grouping similar texts
### Phase 3: Execute API Call
---
## 1. Single Text Embedding
### Basic Embedding
```bash
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:embedContent?key=$GOOGLE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "models/gemini-embedding-001",
"content": {
"parts": [{"text": "Hello world"}]
}
}'
```
### With Task Type
```bash
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:embedContent?key=$GOOGLE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "models/gemini-embedding-001",
"content": {
"parts": [{"text": "What is machine learning?"}]
},
"task_type": "RETRIEVAL_QUERY"
}'
```
### With Output Dimensionality Control
Truncate embeddings to a smaller size for efficiency:
```bash
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:embedContent?key=$GOOGLE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "models/gemini-embedding-001",
"content": {
"parts": [{"text": "Hello world"}]
},
"output_dimensionality": 256
}'
```
---
## 2. Batch Embedding
Process multiple texts in a single API call: