Gemini RETIRED TRIVIAL

text-embedding-004 — Retired

Deprecated
Shutdown
2026-01-14
Status
retired
Replacement
gemini-embedding-001

Quick fix — copy & paste

Choose your language. The "before" block matches the deprecated call; the "after" block is the drop-in replacement.

Breaks on 2026-01-14
# Gemini: text-embedding-004 (retired)
model = "text-embedding-004"
Use this instead
# Replacement
model = "gemini-embedding-001"

This migration was generated automatically from the model rename. If your code does more than swap a model id, double-check request/response shapes against the official Gemini migration guide.

Error messages

Seeing one of these? You're in the right place.

  • model_not_found: text-embedding-004
  • The model `text-embedding-004` has been deprecated
  • The model `text-embedding-004` does not exist or you do not have access to it

Replacement options

Other Gemini deprecations

What this means for your code

text-embedding-004 is an embedding model that converts text into a vector for similarity search and RAG. Embeddings from different models are not interchangeable — you cannot mix vectors from the old model with vectors from the new model in the same index. Migration requires re-embedding your entire corpus.

text-embedding-004 was retired by Gemini on 2026-01-14. API calls now return an error and the model is no longer accessible. New code should use gemini-embedding-001; legacy code that still references this model id needs to be updated immediately.

Find every call in your codebase

Before you change anything, locate every place the deprecated model id is referenced. Search source files, environment files, feature flags, and config repos. Use these commands from your project root:

Python projects

grep -rn '"text-embedding-004"' --include="*.py" .

JavaScript / TypeScript projects

grep -rn '"text-embedding-004"' --include="*.{js,ts,tsx,jsx}" .

Anywhere (configs, scripts, infra)

grep -rn "text-embedding-004" .

Migration checklist

Steps in order. Skip any that don't apply, but read the whole list — for embedding models, the non-obvious steps are usually the ones that break in production.

  1. 1. Update the model id used in embedding generation
  2. 2. Re-embed your entire corpus with the new model — this is non-optional
  3. 3. Verify the new vector dimension matches your vector store's index configuration
  4. 4. Update similarity thresholds — different models have different distance distributions
  5. 5. Plan a cutover window where both old and new indices coexist before switching reads

Will this migration cost more?

Switching from text-embedding-004 to gemini-embedding-001 could change your costs significantly. Calculate the exact difference for your prompts.

Open the cost calculator →