con un clic
gemini-openai-api
// Gemini 模型通过 OpenAI 兼容 API 接入指南。包含:(1) 辅助 API 配置(summary/correction/emotion/vision),(2) extra_body 格式用于控制 thinking,(3) 响应格式处理(markdown 代码块)。当需要将 Gemini 作为辅助模型接入、配置 thinking 参数、或处理 Gemini API 返回格式时使用。
// Gemini 模型通过 OpenAI 兼容 API 接入指南。包含:(1) 辅助 API 配置(summary/correction/emotion/vision),(2) extra_body 格式用于控制 thinking,(3) 响应格式处理(markdown 代码块)。当需要将 Gemini 作为辅助模型接入、配置 thinking 参数、或处理 Gemini API 返回格式时使用。
i18n (internationalization) toolkit for projects using i18next. Provides three main functions: (1) i18n-check - Detect hardcoded Chinese text in HTML/JS files, (2) i18n-fix - Replace hardcoded text with i18n markers, (3) i18n-sync - Align translation keys across multiple languages (zh-CN, zh-TW, en, ja, ko, ru, es, pt). Use when working on internationalization tasks, detecting untranslated strings, or syncing locale files.
应对 WebGL 端 MMD 物理 (Ammo.js) 炸模、穿模、卡顿等极限边缘工况的终极调优指南与 Hack 技巧。
When masking httpx.AsyncClient with unittest.mock in Pytest, AsyncMock must be used instead of MagicMock for async methods like post/get to prevent TypeError when awaited.
Best practices for extracting data from modern React/Vue SSR pages (like Next.js or Nuxt.js) by targeting hydration state blocks (__NEXT_DATA__, __NUXT__) using regex and `jmespath`, avoiding brittle DOM selector scraping.
Convention for reporting errors from multiprocessing TTS workers to the main process frontend. Use this skill when modifying, adding, or debugging TTS workers in tts_client.py to ensure connection errors, quotas, and API limits correctly display Toast notifications to the user rather than failing silently.
Dealing with delayed DOM generation, lazy loading, and optimistic state synchronization in vanilla JavaScript without a reactive framework.
| name | gemini-openai-api |
| description | Gemini 模型通过 OpenAI 兼容 API 接入指南。包含:(1) 辅助 API 配置(summary/correction/emotion/vision),(2) extra_body 格式用于控制 thinking,(3) 响应格式处理(markdown 代码块)。当需要将 Gemini 作为辅助模型接入、配置 thinking 参数、或处理 Gemini API 返回格式时使用。 |
Gemini 提供 OpenAI 兼容端点,可作为辅助 API 使用。
[!IMPORTANT] memory/ + utils/ 下不要传
temperature。项目级约定:所有走utils.llm_client.create_chat_llm/ChatOpenAI的调用一律不下发temperature字段(默认None= 不写进请求体)。守门见scripts/check_no_temperature.py。extra_body(控制 thinking)/max_completion_tokens/timeout/max_retries这类参数继续按需配置,但 不要为了"调风格"再加temperature=...。
https://generativelanguage.googleapis.com/v1beta/openai/
| 用途 | 推荐模型 |
|---|---|
| Summary / Correction / Vision | gemini-3-flash-preview |
| Emotion Analysis | gemini-2.5-flash |
Gemini 2.5+ 模型需要通过 extra_body 控制 thinking 行为。
extra_body = {
"extra_body": {
"google": {
"thinking_config": {
"thinking_budget": 0
}
}
}
}
extra_body = {
"extra_body": {
"google": {
"thinking_config": {
"thinking_level": "low",
"include_thoughts": False
}
}
}
}
[!IMPORTANT] extra_body 需要双层嵌套:外层
"extra_body"是传给 OpenAI client 的参数名,内层{"google": {...}}是 Gemini 的实际配置。
Gemini 可能返回 markdown 代码块包装的 JSON:
```json
{"emotion": "happy", "confidence": 0.8}
处理方法:
```python
if result_text.startswith("```"):
lines = result_text.split("\n")
if lines[0].startswith("```"):
lines = lines[1:]
if lines and lines[-1].strip() == "```":
lines = lines[:-1]
result_text = "\n".join(lines).strip()
config/api_providers.json - 添加 gemini 到 assist_api_providersconfig/__init__.py - 添加 EXTRA_BODY_GEMINI 和 MODELS_EXTRA_BODY_MAP"gemini": {
"key": "gemini",
"name": "Gemini(Google)",
"description": "Google AI 辅助模型,国内无法使用",
"openrouter_url": "https://generativelanguage.googleapis.com/v1beta/openai/",
"summary_model": "gemini-3-flash-preview",
"correction_model": "gemini-3-flash-preview",
"emotion_model": "gemini-2.5-flash",
"vision_model": "gemini-3-flash-preview"
}
原因:extra_body 格式错误,缺少外层 "extra_body" 包装。
解决:使用双层嵌套格式 {"extra_body": {"google": {...}}}。
原因:
解决:
max_completion_tokens