Gemini 3.1 Pro Preview API
google/gemini-3.1-pro-preview# UberLLM: 通用LLM API
UberLLM是所有LLM的通用API。
它是OpenAI API的直接替代品,支持OpenAI、Anthropic、Claude、GPT、Gemini、DeepSeek、Veo、Kling等模型。
## 功能特性
* **通用API:** 一个API即可调用所有LLM。
* **兼容OpenAI API:** OpenAI API的直接替代品。
* **流式传输:** 支持流式响应。
* **成本优化:** 自动将请求路由到最便宜的可用模型。
* **缓存:** 缓存响应以降低延迟和成本。
* **负载均衡:** 将请求分发到多个模型以提高可靠性。
* **故障回退:** 自动使用其他模型重试失败的请求。
* **可观测性:** 监控API使用情况、延迟和错误。
* **使用限制:** 设置速率限制和支出限制。
* **自定义模型:** 添加您自己的自定义模型。
## 支持的模型
UberLLM支持所有主流LLM,包括:
* **OpenAI:** GPT-4, GPT-3.5等。
* **Anthropic:** Claude 3, Claude 2等。
* **Google:** Gemini等。
* **DeepSeek:** DeepSeek-Coder, DeepSeek-Chat等。
* **其他:** OpenRouter, Fal, kie.ai等。
## 快速入门
### 1. 注册UberLLM账户
前往[uberllm.com/signup](https://uberllm.com/signup)创建您的账户。
### 2. 获取您的API密钥
注册后,您可以在您的[仪表盘](https://uberllm.com/dashboard)中找到您的API密钥。
### 3. 安装SDK
```python
pip install uberllm
```
### 4. 使用API
```python
from uberllm import UberLLM
client = UberLLM(api_key="YOUR_UBERLLM_API_KEY")
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(response.choices[0].message.content)
```
## API参考
UberLLM的API与OpenAI的API完全兼容。
您可以使用与OpenAI相同的客户端库和SDK。
您唯一需要做的更改是将`base_url`设置为`https://api.uberllm.com/v1`。
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.uberllm.com/v1",
api_key="YOUR_UBERLLM_API_KEY",
)
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(response.choices[0].message.content)
```
## 定价
UberLLM为所有支持的模型提供有竞争力的定价。
您只需按使用量付费,无任何隐藏费用。
### 示例定价
| 模型 | 输入 (每100万token) | 输出 (每100万token) |
|---|---|---|
| GPT-4 | ⟦n⟧ | ⟦n⟧ |
| GPT-3.5 | ⟦n⟧ | ⟦n⟧ |
| Claude 3 | ⟦n⟧ | ⟦n⟧ |
| Gemini | ⟦n⟧ | ⟦n⟧ |
如需查看完整定价列表,请访问我们的[定价页面](https://uberllm.com/pricing)。
## 联系我们
如果您有任何问题或需要帮助,请随时联系我们:
* **电子邮件:** [[email protected]](mailto:[email protected])
* **Discord:** [加入我们的Discord服务器](https://discord.gg/uberllm)
* **Twitter:** [@uberllm](https://twitter.com/uberllm)通过 MartLLM 兼容 OpenAI 的 API 调用 Gemini 3.1 Pro Preview,输入 $0.1096/M 和 输出 $0.6575/M 起,由第三方服务商提供。 由 Google 打造。 1,000,000 token 上下文。 MartLLM 不对请求收取费用。用银行卡充值收取 5.5% + 0.50 美元。
模型来自 Google。 也可直接从以下渠道购买:OpenRouter, Venice AI, Google。 在这里,卖家通过自己的服务商账户提供这个模型。 为什么这么便宜? · 算力从哪里来
Gemini 3.1 Pro Preview API 多少钱?
在 2026年11月20日,通过 MartLLM,Gemini 3.1 Pro Preview 的价格为每百万输入 token $0.1096,每百万输出 token $0.6575,这比其标价 $2.00 和 $12.00 低 94.5%。市场上 54 家供应商可以提供此服务。在之前的 7 天里,其 3,295 次 streaming 请求中有一半在 6.9 秒内收到了第一个 token,典型 prompt 为 1,051 个 token。它最多可读取 1,000,000 个 token 的上下文。MartLLM 不会在此价格上加收任何费用,失败的请求不收取费用。
最便宜的 Gemini 3.1 Pro Preview API 是什么?
在 2026年11月20日,我们发现最便宜的 Gemini 3.1 Pro Preview API 是 MartLLM,每百万输入 token $0.1096,每百万输出 token $0.6575。这比我们查过的最接近的其他提供商 OpenRouter($2.00 和 $12.00)在输入和输出上都至少便宜 94.5%。Vercel AI Gateway 和 Requesty 的价格更高。MartLLM 市场上有 54 家卖家可以提供此服务。MartLLM 不对这些价格收取额外费用,并且失败的请求不计费。
价格截至 2026年11月20日 11:00 UTC。本页每小时更新一次。
| 提供商 | 输入 / 1M token | 输出 / 1M token | MartLLM 便宜了 |
|---|---|---|---|
| MartLLM | $0.1096 | $0.6575 | |
| OpenRouter | $2.00 | $12.00 | 94.5% |
| Vercel AI Gateway | $2.00 | $12.00 | 94.5% |
| Requesty | $2.00 | $12.00 | 94.5% |
MartLLM: 最佳卖家当前价格,不加收费用。 其他价格来自各提供商公开的价目表: OpenRouter, Vercel AI Gateway, Requesty
Gemini 3.1 Pro Preview 价格
每 100 万输入 token 省 $1.8904,每 100 万输出 token 省 $11.3425,官方价格为 $2.00 / $12.00。 为什么这么便宜? OpenRouter 的收费为每 100 万输入 / 输出 token $2.00 / $12.00。
- 输入
- $0.1096
- 输出
- $0.6575
- 缓存输入
- $0.011
- 输入
- $2.00
- 输出
- $12.00
- 缓存输入
- $0.20
价格更新于 UTC 11:00。
每个请求都会发给这个模型的一家可用第三方服务商;如果服务商在开始回答之前出错,请求会自动重试。 MartLLM 不对请求收取费用。用银行卡充值收取 5.5% + 0.50 美元。
如何用 OpenAI SDK 调用 Gemini 3.1 Pro Preview
使用 OpenAI SDK 时,把 base URL 设为 MartLLM,用你现有的代码就能调用 Gemini 3.1 Pro Preview。Anthropic SDK 可对接 https://api.martllm.com/v1/messages。
from openai import OpenAI
client = OpenAI(
base_url="https://api.martllm.com/v1",
api_key="ull_your_key_here",
)
resp = client.chat.completions.create(
model="google/gemini-3.1-pro-preview",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)在你的应用中使用 Gemini 3.1 Pro Preview
通过 API,Gemini 3.1 Pro Preview 在三个地址上响应,使用相同的 MartLLM 密钥和模型 ID google/gemini-3.1-pro-preview:位于https://api.martllm.com/v1/chat/completions的 OpenAI 聊天补全、位于https://api.martllm.com/v1/responses的 OpenAI Responses API 以及位于https://api.martllm.com/v1/messages的 Anthropic Messages API。
如何在Claude Code中使用Gemini 3.1 Pro Preview?
Claude Code 通过 MartLLM 的 Anthropic 兼容地址访问Gemini 3.1 Pro Preview。将ANTHROPIC_BASE_URL设置为https://api.martllm.com(末尾不带 /v1),将ANTHROPIC_AUTH_TOKEN设置为您的 MartLLM 密钥,并将ANTHROPIC_MODEL设置为google/gemini-3.1-pro-preview[1m],然后启动claude。 同样将 opus、sonnet、haiku 和 subagent 模型变量设置为google/gemini-3.1-pro-preview:未设置的槽位会继续以 Claude 的价格请求 Claude 模型。 ID 末尾的[1m]告诉 Claude Code Gemini 3.1 Pro Preview具有1M个 token 的上下文;没有它,Claude Code 会按200,000个 token 进行规划。
export ANTHROPIC_BASE_URL=https://api.martllm.com
export ANTHROPIC_AUTH_TOKEN=ull_your_key
export ANTHROPIC_MODEL='google/gemini-3.1-pro-preview[1m]'
export ANTHROPIC_DEFAULT_OPUS_MODEL='google/gemini-3.1-pro-preview'
export ANTHROPIC_DEFAULT_SONNET_MODEL='google/gemini-3.1-pro-preview'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='google/gemini-3.1-pro-preview'
export CLAUDE_CODE_SUBAGENT_MODEL='google/gemini-3.1-pro-preview'
claudeClaude Code 调用:Anthropic Messages API https://api.martllm.com/v1/messages · 完整的Claude Code指南
如何在Codex CLI中使用Gemini 3.1 Pro Preview?
Codex CLI 通过 MartLLM 的 Responses API 访问Gemini 3.1 Pro Preview。在~/.codex/config.toml中,添加一个模型提供商,将base_url设置为https://api.martllm.com/v1和wire_api = "responses",将您的 MartLLM 密钥放入UBERLLM_API_KEY环境变量中,并将model设置为google/gemini-3.1-pro-preview。 model_context_window被设置为1,000,000,即Gemini 3.1 Pro Preview的上下文大小,因为 Codex 对它所知的 OpenAI 模型列表之外的模型假定为272,000个 token。
model = "google/gemini-3.1-pro-preview"
model_provider = "uberllm"
model_context_window = 1000000
web_search = "disabled"
[model_providers.uberllm]
name = "MartLLM"
base_url = "https://api.martllm.com/v1"
env_key = "UBERLLM_API_KEY"
wire_api = "responses"Codex CLI 调用:OpenAI Responses API https://api.martllm.com/v1/responses · 完整的Codex CLI指南
如何在OpenCode中使用Gemini 3.1 Pro Preview?
OpenCode 通过 MartLLM 的 OpenAI 兼容聊天地址访问Gemini 3.1 Pro Preview。在~/.config/opencode/opencode.json中,添加一个名为uberllm的提供商,该提供商使用@ai-sdk/openai-compatible包并将baseURL设置为https://api.martllm.com/v1,在其模型下添加google/gemini-3.1-pro-preview,将您的 MartLLM 密钥放入UBERLLM_API_KEY环境变量中,然后使用/models选择uberllm/google/gemini-3.1-pro-preview。 limit这些数字是Gemini 3.1 Pro Preview的上下文大小和最大回复;OpenCode 使用它们来判断何时压缩长时间会话。
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"uberllm": {
"npm": "@ai-sdk/openai-compatible",
"name": "MartLLM",
"options": {
"baseURL": "https://api.martllm.com/v1",
"apiKey": "{env:UBERLLM_API_KEY}"
},
"models": {
"google/gemini-3.1-pro-preview": {
"name": "Gemini 3.1 Pro Preview",
"limit": {
"context": 1000000,
"output": 32768
}
}
}
}
},
"model": "uberllm/google/gemini-3.1-pro-preview"
}OpenCode 调用:OpenAI 聊天补全 https://api.martllm.com/v1/chat/completions · 完整的OpenCode指南
如何在Cursor中使用Gemini 3.1 Pro Preview?
在Cursor Settings → Models中,将您的 MartLLM 密钥粘贴到 OpenAI API Key字段中,开启 OpenAI base URL 覆盖并输入https://api.martllm.com/v1,开启Use API Key,然后将google/gemini-3.1-pro-preview添加为自定义模型并在聊天模型选择器中选择它。 这适用于 Cursor 中的聊天:Tab 补全会继续使用 Cursor 提供的模型。
- OpenAI API Key
ull_your_key- OpenAI base URL override
https://api.martllm.com/v1- Custom model
google/gemini-3.1-pro-preview
Cursor 调用:OpenAI 聊天补全 https://api.martllm.com/v1/chat/completions · 完整的Cursor指南
如何在Cline中使用Gemini 3.1 Pro Preview?
在 Cline 的设置中,将API Provider设置为OpenAI Compatible,将Base URL设置为https://api.martllm.com/v1,将您的 MartLLM 密钥粘贴到OpenAI Compatible API Key中,并将Model ID设置为google/gemini-3.1-pro-preview。 在Model Configuration下,将Context Window Size设置为1,000,000:Cline 不会自行读取模型的限制。 在同一位置,将Max Output Tokens设置为32,768。
- API Provider
OpenAI Compatible- Base URL
https://api.martllm.com/v1- OpenAI Compatible API Key
ull_your_key- Model ID
google/gemini-3.1-pro-preview- Context Window Size
1000000- Max Output Tokens
32768
Cline 调用:OpenAI 聊天补全 https://api.martllm.com/v1/chat/completions · 完整的Cline指南
如何在SillyTavern中使用Gemini 3.1 Pro Preview?
在 SillyTavern 中,打开API Connections,将API设置为Chat Completion,将Chat Completion Source设置为Custom (OpenAI-compatible),在Custom Endpoint (Base URL)中输入https://api.martllm.com/v1,将您的 MartLLM 密钥粘贴到Custom API Key中,点击Connect,然后在Enter a Model ID中输入google/gemini-3.1-pro-preview。
- API
Chat Completion- Chat Completion Source
Custom (OpenAI-compatible)- Custom Endpoint (Base URL)
https://api.martllm.com/v1- Custom API Key
ull_your_key- Enter a Model ID
google/gemini-3.1-pro-preview
SillyTavern 调用:OpenAI 聊天补全 https://api.martllm.com/v1/chat/completions · 完整的SillyTavern指南
如何在Janitor AI中使用Gemini 3.1 Pro Preview?
在 Janitor AI 中,打开一个聊天,点击齿轮图标并打开API Settings。选择Proxy并添加一个配置,将Model Name设置为google/gemini-3.1-pro-preview,将Proxy URL设置为https://api.martllm.com/v1/chat/completions,并将您的 MartLLM 密钥放入API Key中。点击Save Settings,然后刷新页面。
- Config Name
MartLLM- Model Name
google/gemini-3.1-pro-preview- Proxy URL
https://api.martllm.com/v1/chat/completions- API Key
ull_your_key
Janitor AI 调用:OpenAI 聊天补全 https://api.martllm.com/v1/chat/completions · 完整的Janitor AI指南
如何在Open WebUI中使用Gemini 3.1 Pro Preview?
在 Open WebUI 中,前往Settings → Admin → Connections并添加一个 OpenAI API 连接,将URL设置为https://api.martllm.com/v1,并将您的 MartLLM 密钥放入API Key中。在Advanced下,将google/gemini-3.1-pro-preview添加到Model IDs,并将API Type保留为Chat Completions。
- URL
https://api.martllm.com/v1- API Key
ull_your_key- Model IDs
google/gemini-3.1-pro-preview- API Type
Chat Completions
Open WebUI 调用:OpenAI 聊天补全 https://api.martllm.com/v1/chat/completions · 完整的Open WebUI指南
Gemini 3.1 Pro Preview API 常见问题
能给 Gemini 3.1 Pro Preview 请求设置费用上限吗?
可以。每个请求的费用就是服务商收取的价格;标价为每百万 token 输入 $0.378,输出 $2.268,便宜的服务商繁忙时,请求可能会更贵。在请求中带上 provider.max_price,填你愿意为每百万 token 支付的最高价:请求只会发给价格不高于它的服务商,计费也绝不会超过它。每个请求及其费用都会列在“活动”里。
如何通过 API 调用 Gemini 3.1 Pro Preview?
任何兼容 OpenAI 的 SDK 都可以:把 base URL 设为 https://api.martllm.com/v1,填入你的 MartLLM API 密钥,模型填 "google/gemini-3.1-pro-preview"。Anthropic SDK 可通过 https://api.martllm.com/v1/messages 使用。
MartLLM 上的 Gemini 3.1 Pro Preview 兼容 OpenAI 吗?
兼容。MartLLM 上的每个模型(包括 Gemini 3.1 Pro Preview)都通过同一个兼容 OpenAI 的端点提供。在你现有的客户端里设置好 base URL 和密钥即可。
为什么 Gemini 3.1 Pro Preview 在 MartLLM 上更便宜?
MartLLM 是一个市场:卖家以低于其标价的价格提供 Gemini 3.1 Pro Preview 容量,并且每个请求都会发送给能够提供服务的卖家。请求的费用是卖家收取的,MartLLM 不收取任何费用,并且每个请求的费用都会在 Activity 中列出。
还有其他费用吗?
MartLLM 不对模型价格收取任何费用。当您购买信用额度时,会收取 5.5% + $0.50 的卡片手续费。即使加上 5.5%,MartLLM 的 Gemini 3.1 Pro Preview 价格仍然低于表格中的所有其他提供商。
嵌入此价格
在你自己的网站上显示这些价格。表格会从 MartLLM 读取当前价格,因此始终保持最新。
脚本:表格自动调整高度
<script async src="https://martllm.com/embed.js" data-models="google/gemini-3.1-pro-preview" data-lang="zh"></script>普通 iframe,适用于不允许脚本的网站
<iframe src="https://martllm.com/embed/prices?models=google/gemini-3.1-pro-preview&lang=zh" title="AI 模型 API 价格" width="100%" height="127" loading="lazy" style="border:0;max-width:720px"></iframe>README 价格徽章(Markdown)
[](https://martllm.com/models/google/gemini-3.1-pro-preview?utm_source=embed&utm_medium=referral&utm_campaign=price-badge)所有选项见嵌入文档。
将 Gemini 3.1 Pro Preview 与以下模型对比
与其他服务商对比: 最便宜的 Gemini API