{
 "kind": "api",
 "slug": "openai-embeddings",
 "path": "apis/openai-embeddings/",
 "name": "OpenAI Embeddings",
 "logo": "https://agentgid.com/media/avatars/openai.png",
 "maker": "OpenAI",
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "Embeddings and rerank",
   "apis/embeddings/"
  ]
 ],
 "lead": "Text turned into numbers for search.",
 "chips": [
  {
   "label": "Embeddings and rerank",
   "path": "apis/embeddings/"
  },
  {
   "label": "Partial System Degradation · live status",
   "live": false
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Add meaning-based search to my site: on the server, embed each article with OpenAI text-embedding-3-small (key from OPENAI_API_KEY), store the vectors in Postgres with pgvector, embed the search query the same way and return the 5 closest articles."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://developers.openai.com/api/docs/guides/embeddings"
  },
  {
   "label": "Pricing",
   "href": "https://developers.openai.com/api/docs/pricing"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/openai/openai-python"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Paid",
   "status": "info",
   "sub": "from $0.02/1M tokens",
   "quote": null,
   "note": "No free tier on the pricing page. As reported on the official pricing page, checked Oct 10, 2026.",
   "src": "https://developers.openai.com/api/docs/pricing"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "With conditions",
   "status": "cond",
   "sub": "Does not train on your data",
   "quote": "You are responsible for ensuring that the content you input to our API does not violate any applicable law or our Terms of Use.",
   "note": "You own inputs and outputs; your content must follow the law and OpenAI's Terms of Use.",
   "src": "https://developers.openai.com/api/docs/guides/embeddings.md"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key, server only",
   "status": "info",
   "sub": "Env var OPENAI_API_KEY",
   "quote": "Load API keys from an environment variable or key management service on the server.",
   "note": "OpenAI API key sent as a Bearer header from your server (Authorization: Bearer $OPENAI_API_KEY)",
   "src": "https://developers.openai.com/api/reference/overview.md"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "info",
   "sub": "llms.txt · SDK",
   "quote": "This MCP server is documentation-only. It does not call the OpenAI API on your behalf.",
   "note": " Our agent check: 4 of 6 (Nov 13, 2026).",
   "src": "https://developers.openai.com/learn/docs-mcp.md"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Oct 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What OpenAI Embeddings does",
   "parts": [
    {
     "t": "prose",
     "text": "OpenAI Embeddings is a paid online service that turns a piece of text into a long list of numbers that captures its meaning. Texts about the same thing get similar numbers, so your app can find related articles, products or questions even when the words differ. You keep the numbers in your own database and compare them when someone searches."
    },
    {
     "t": "list",
     "items": [
      "OpenAI Embeddings is one of 5 APIs in the Embeddings and rerank category on AgentGid.",
      "It is not among the 4 that can be started for free.",
      "Its official SDK is the 1st most downloaded in the category (156M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Search that understands meaning",
       "text": "A help center where \"can't log in\" also finds the article called \"Reset your password\", because the meaning matches, not the words.",
       "idea": false
      },
      {
       "title": "\"You may also like\" suggestions",
       "text": "Show products, recipes or articles whose descriptions are close to the one a visitor is reading.",
       "idea": false
      },
      {
       "title": "Sort support tickets by topic",
       "text": "Put each new ticket into the closest category, such as billing, delivery or login, by comparing it with a short description of each category.",
       "idea": false
      },
      {
       "title": "Check the bill before a big import",
       "text": "Count the tokens of all your texts on your own computer first, and see what embedding them will cost before you send anything.",
       "idea": false
      },
      {
       "title": "Save space with shorter vectors",
       "text": "Ask for fewer numbers per text when you store millions of items, so your database stays smaller and searches stay fast.",
       "idea": false
      },
      {
       "title": "Spot duplicate questions",
       "text": "Before a new forum question or idea is posted, show the closest existing ones so people join the old thread instead.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "OpenAI Embeddings popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "156M",
       "l": "SDK downloads a week",
       "d": "+23.7% on the 4-week average",
       "up": true
      },
      {
       "n": "32.2K",
       "l": "GitHub stars, openai/openai-python"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "None"
      },
      {
       "l": "Cheapest plan",
       "v": "No monthly plan"
      },
      {
       "l": "Usage price",
       "v": "$0.02/1M tokens (text-embedding-3-small); $0.13/1M (text-embedding-3-large); $0.10/1M (text-embedding-ada-002)"
      },
      {
       "l": "Plans",
       "v": "Pay-as-you-go per input token; part of the general OpenAI API account."
      }
     ]
    },
    {
     "t": "h3",
     "text": "What one action costs"
    },
    {
     "t": "table",
     "head": [
      "Action",
      "Price"
     ],
     "num": true,
     "rows": [
      [
       "1M input tokens, text-embedding-3-small",
       "$0.02"
      ],
      [
       "1M input tokens, text-embedding-3-large",
       "$0.13"
      ],
      [
       "1M input tokens, text-embedding-ada-002 (older model)",
       "$0.10"
      ]
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Oct 10, 2026. Prices change: confirm before you buy.",
     "link": "developers.openai.com/api/docs/pricing",
     "href": "https://developers.openai.com/api/docs/pricing"
    }
   ]
  },
  {
   "id": "limits",
   "nav": null,
   "spy_as": "pricing",
   "h2": "Limits",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "All plans",
       "v": "8,192 tokens per text; at most 2,048 texts in one request",
       "src": "https://developers.openai.com/api/reference/resources/embeddings/methods/create.md"
      },
      {
       "l": "All plans",
       "v": "300,000 tokens in total per request",
       "src": "https://developers.openai.com/api/reference/resources/embeddings/methods/create.md"
      },
      {
       "l": "Usage tiers (Free, Build, Launch, Grow)",
       "v": "Requests and tokens per minute depend on your tier and the model; see the limits page in your account",
       "src": "https://developers.openai.com/api/docs/guides/rate-limits.md"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official docs.",
     "link": "developers.openai.com/api/reference/resources/embeddings/methods/create.md",
     "href": "https://developers.openai.com/api/reference/resources/embeddings/methods/create.md"
    }
   ]
  },
  {
   "id": "status",
   "nav": "Status",
   "h2": "Status and incidents",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Right now",
       "v": "Partial System Degradation",
       "status": "cond",
       "sub": "Partial System Degradation"
      },
      {
       "l": "Last 30 days",
       "v": "21 incidents, 2 of them major"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official status page, checked Nov 26, 2026.",
     "link": "status.openai.com",
     "href": "https://status.openai.com"
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "OpenAI API key sent as a Bearer header from your server (Authorization: Bearer $OPENAI_API_KEY)"
      },
      {
       "l": "Environment variable",
       "v": "OPENAI_API_KEY",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "No, keep it on your server",
       "status": "no"
      },
      {
       "l": "Card at sign-up",
       "v": "Not stated on the pages we read"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Steps only a person can do"
    },
    {
     "t": "list",
     "items": [
      "Sign in to the OpenAI platform and create an API key. Put it in .env as OPENAI_API_KEY (kept out of git) and read it on the server only.",
      "Add a payment method and buy prepaid credits. No code change; run the token-count script first to see the cost of the first import."
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "It is a paid online service, not open source. You own the text you send and the numbers you get back, so you may use and even share them. Your text must not break the law or OpenAI's terms of use."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "With conditions",
       "status": "cond",
       "sub": "You own inputs and outputs; your content must follow the law and OpenAI's Terms of Use.",
       "quote": "You are responsible for ensuring that the content you input to our API does not violate any applicable law or our Terms of Use.",
       "src": "https://developers.openai.com/api/docs/guides/embeddings.md"
      },
      {
       "l": "redistribute-files",
       "v": "With conditions",
       "status": "cond",
       "sub": "The docs say you may share your embeddings online, because you own them; the source texts keep their own rights.",
       "quote": "Yes, customers own their input and output from our models, including in the case of embeddings.",
       "src": "https://developers.openai.com/api/docs/guides/embeddings.md"
      },
      {
       "l": "client-work",
       "v": "With conditions",
       "status": "cond",
       "sub": "Give each client app its own project and service account key instead of a developer's personal key.",
       "quote": "Don't share one developer's key across a team or use that person's identity as the permanent identity of a production application.",
       "src": "https://developers.openai.com/api/docs/guides/api-keys.md"
      },
      {
       "l": "Trains on what you send",
       "v": "“As of March 1, 2023, data sent to the OpenAI API is not used to train or improve OpenAI models (unless you explicitly opt in to share data with us).”",
       "quote": null,
       "src": "https://developers.openai.com/api/docs/guides/your-data.md"
      },
      {
       "l": "Keeps your data",
       "v": "Embedding requests are kept in abuse monitoring logs up to 30 days and are not stored as application state; Zero Data Retention eligible for approved customers.",
       "quote": "/v1/embeddings No 30 days None Yes No",
       "src": "https://developers.openai.com/api/docs/guides/your-data.md"
      },
      {
       "l": "Where data is stored",
       "v": "Data residency per project for eligible customers (via sales).",
       "quote": "Data residency controls are a project configuration option that allow you to configure the location of infrastructure OpenAI uses to provide services.",
       "src": "https://developers.openai.com/api/docs/guides/your-data.md"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "401 Incorrect API key provided",
       "v": "The key sent with the request is wrong or was revoked.",
       "sub": "Check the key; do not retry unchanged."
      },
      {
       "l": "429 Rate limit reached for requests",
       "v": "Too many requests or tokens per minute, common during a big import.",
       "sub": "Retry with backoff after Retry-After, send texts in batches, or use the Batch API for large imports."
      },
      {
       "l": "429 credit_balance_exhausted",
       "v": "No prepaid credits left.",
       "sub": "Top up credits; retrying does not help."
      },
      {
       "l": "500 Server error",
       "v": "A problem on OpenAI's side.",
       "sub": "Retry after a short wait."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "4 of 6: llms.txt yes, OpenAPI no, SDK yes, MCP no, status page yes, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "OpenAI Docs MCP (documentation only)",
       "sub": "claude mcp add --transport http openaiDeveloperDocs https://developers.openai.com/mcp"
      },
      {
       "l": "npm",
       "v": "npm install openai",
       "code": true
      },
      {
       "l": "PyPI",
       "v": "pip install openai",
       "code": true
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "OpenAI Embeddings",
       "me": true,
       "facts": [
        "from $0.02/1M tokens",
        "No free tier"
       ]
      },
      {
       "name": "Voyage AI",
       "why": "Pick Voyage AI when you need embeddings tuned for code or for images, plus rerankers that reorder search results.",
       "path": "apis/voyage-ai/",
       "facts": [
        "from $0.02/1M tokens",
        "Free tier"
       ]
      },
      {
       "name": "BGE (FlagEmbedding)",
       "why": "Pick BGE when you want open-source embedding models that run on your own server with no per-token bill.",
       "path": "apis/bge-embeddings/",
       "facts": [
        "Free (open source)",
        "No free tier"
       ]
      },
      {
       "name": "Mixedbread",
       "why": "Pick Mixedbread when you want a ready search and indexing service over your files instead of handling raw vectors.",
       "path": "apis/mixedbread-ai/",
       "facts": [
        "from $0.5 per 1M content tokens",
        "Free tier"
       ]
      }
     ],
     "more": "All embeddings and rerank APIs",
     "more_path": "apis/embeddings/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add meaning-based search to my site: on the server, embed each article with OpenAI text-embedding-3-small (key from OPENAI_API_KEY), store the vectors in Postgres with pgvector, embed the search query the same way and return the 5 closest articles."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Create an OpenAI API key and keep it in OPENAI_API_KEY on the server.",
       "code": "export OPENAI_API_KEY=\"your_api_key_here\"",
       "src": "https://developers.openai.com/api/docs/quickstart.md"
      },
      {
       "text": "Install the official package (pip install openai or npm install openai) and send your text with the model name.",
       "code": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.embeddings.create(\n    input=\"Your text string goes here\", model=\"text-embedding-3-small\"\n)\n\nprint(response.data[0].embedding)\n",
       "src": "https://developers.openai.com/api/docs/guides/embeddings.md"
      },
      {
       "text": "Store each vector in a vector database (for example Postgres with pgvector) and search it by similarity.",
       "code": null,
       "src": "https://developers.openai.com/api/docs/guides/embeddings.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "curl https://api.openai.com/v1/embeddings \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"input\": \"Hello world\",\n    \"model\": \"text-embedding-3-small\",\n    \"encoding_format\": \"float\",\n    \"dimensions\": 3\n  }'\n",
       "intro": null
      },
      {
       "tab": "Response",
       "code": "{\n  \"object\": \"list\",\n  \"data\": [\n    {\n      \"object\": \"embedding\",\n      \"embedding\": [\n        0.26726124,\n        0.53452248,\n        0.80178373\n      ],\n      \"index\": 0\n    }\n  ],\n  \"model\": \"text-embedding-3-small\",\n  \"usage\": {\n    \"prompt_tokens\": 2,\n    \"total_tokens\": 2\n  }\n}\n"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Mixing vectors from text-embedding-3-small and text-embedding-3-large (or another vendor) in one search table",
       "fix": "Use one model for all stored texts and for the search query; re-embed everything when you change models",
       "why": "Distances between vectors from different models mean nothing."
      },
      {
       "dont": "Storing 3072-number vectors from text-embedding-3-large in a pgvector column and adding a normal HNSW index",
       "fix": "Request dimensions of 2000 or fewer, or index the column as halfvec",
       "why": "pgvector indexes plain vectors only up to 2,000 numbers, and text-embedding-3-large returns 3072 by default."
      },
      {
       "dont": "Sending a whole book chapter, an empty string, or 5,000 texts in one request",
       "fix": "Split texts under 8,192 tokens, skip empty ones, and send at most 2,048 texts (300,000 tokens) per request",
       "why": "The endpoint rejects inputs over these limits."
      },
      {
       "dont": "Counting tokens with a different tokenizer or by splitting on spaces",
       "fix": "tiktoken.get_encoding(\"cl100k_base\")",
       "why": "The docs name cl100k_base for the third-generation embedding models."
      },
      {
       "dont": "Comparing a query vector with every stored vector in a loop in your app code",
       "fix": "Keep vectors in a vector database (for example pgvector) and let it find the nearest ones",
       "why": "The docs recommend a vector database for searching many vectors quickly."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "What does it cost?",
       "a": "Billed per input token. List prices per 1M tokens are $0.02 for text-embedding-3-small and $0.13 for text-embedding-3-large.",
       "evidence": {
        "url": "https://developers.openai.com/api/docs/pricing.md",
        "quote": "Embedding text-embedding-3-small $0.02"
       }
      },
      {
       "q": "How many numbers does one text become?",
       "a": "1536 for text-embedding-3-small and 3072 for text-embedding-3-large by default; you can ask for fewer.",
       "evidence": {
        "url": "https://developers.openai.com/api/docs/guides/embeddings.md",
        "quote": "By default, the length of the embedding vector is 1536 for text-embedding-3-small or 3072 for text-embedding-3-large."
       }
      },
      {
       "q": "Can I share or publish the vectors I get?",
       "a": "Yes. The docs say customers own their input and output, including embeddings.",
       "evidence": {
        "url": "https://developers.openai.com/api/docs/guides/embeddings.md",
        "quote": "Yes, customers own their input and output from our models, including in the case of embeddings."
       }
      },
      {
       "q": "How do I compare two vectors?",
       "a": "The docs recommend cosine similarity; since the vectors have length 1, a dot product gives the same result faster.",
       "evidence": {
        "url": "https://developers.openai.com/api/docs/guides/embeddings.md",
        "quote": "We recommend cosine similarity."
       }
      },
      {
       "q": "Does OpenAI keep or train on the texts I embed?",
       "a": "It does not train on them; safety logs for embedding requests are kept up to 30 days.",
       "evidence": {
        "url": "https://developers.openai.com/api/docs/guides/your-data.md",
        "quote": "/v1/embeddings No 30 days None Yes No"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "OpenAI"
  ],
  [
   "Category",
   "Embeddings and rerank"
  ],
  [
   "Status",
   "Partial System Degradation · 21 incidents in 30 days"
  ],
  [
   "Price",
   "from $0.02/1M tokens"
  ],
  [
   "Official SDK",
   "npm openai, PyPI openai"
  ],
  [
   "Latest SDK",
   "3.48.0 on npm"
  ],
  [
   "Agent check",
   "4 of 6"
  ],
  [
   "Pricing checked",
   "Oct 10, 2026"
  ]
 ],
 "good": [
  "You need an OpenAI account, prepaid credits and a secret key that stays on your server.",
  "Each text may be at most 8,192 tokens, so split long documents into parts first.",
  "The models know nothing about events after September 2021, which rarely matters for search but can in edge cases."
 ],
 "checked_line": "Read by AgentGid from 19 official pages, card checked Nov 10, 2026; usage numbers update daily."
}