# 如何解决 Gemini 嵌入的 401 错误

**URL:** https://meta.discourse.org/t/how-to-fix-401-errors-with-gemini-embeddings/407828
**Category:** Support
**Tags:** embedding, ai
**Created:** [2026年七月16日 18:59 UTC](https://meta.discourse.org/t/how-to-fix-401-errors-with-gemini-embeddings/407828 "2026-07-16T18:59:35Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2026年七月16日 19:15 UTC](https://meta.discourse.org/t/how-to-fix-401-errors-with-gemini-embeddings/407828/2 "2026-07-16T19:15:29Z")

</div>

[quote=“m\_terenui, post:1, topic:407828”]  
我曾在模型配置中使用以下 URL 来通过 Gemini 进行嵌入（但遇到了错误）：  
`https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:embedContent`

查阅网上的文档后，我发现 URL 应遵循如下模式：  
`https://{zone}-aiplatform.googleapis.com/v1/projects/{google cloud project reference}/locations/{zone}/publishers/google/models/gemini-embedding-001:embedContent`  
[/quote]\n  
这是 `Google AI Studio` 与 `Gemini 企业智能体平台（前身为 Vertex AI）` 的区别。

对于嵌入功能，我们仅兼容前者。

我们刚刚收到一个 PR，使我们的 LLM 推理功能也能兼容后者，因为此前我们在 LLM 方面也只兼容前者。

---

_[View the full topic](https://meta.discourse.org/t/how-to-fix-401-errors-with-gemini-embeddings/407828)._
