gemini-openai-api
Gemini 模型通过 OpenAI 兼容 API 接入指南。包含:(1) 辅助 API 配置(summary/correction/emotion/vision),(2) extra_body 格式用于控制 thinking,(3) 响应格式处理(markdown 代码块)。当需要将 Gemini 作为辅助模型接入、配置 thinking 参数、或处理 Gemini API 返回格式时使用。
Install
mkdir -p .claude/skills/gemini-openai-api && curl -L -o skill.zip "https://mcp.directory/api/skills/download/8089" && unzip -o skill.zip -d .claude/skills/gemini-openai-api && rm skill.zipInstalls to .claude/skills/gemini-openai-api
About this skill
Gemini OpenAI 兼容 API 接入
Gemini 提供 OpenAI 兼容端点,可作为辅助 API 使用。
Base URL
https://generativelanguage.googleapis.com/v1beta/openai/
模型配置
| 用途 | 推荐模型 |
|---|---|
| Summary / Correction / Vision | gemini-3-flash-preview |
| Emotion Analysis | gemini-2.5-flash |
控制 Thinking
Gemini 2.5+ 模型需要通过 extra_body 控制 thinking 行为。
禁用 Thinking(用于 gemini-2.5-flash)
extra_body = {
"extra_body": {
"google": {
"thinking_config": {
"thinking_budget": 0
}
}
}
}
低级别 Thinking(用于 gemini-3-flash-preview)
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
api_providers.json 示例
"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"
}
常见问题
"Unknown name 'google': Cannot find field"
原因:extra_body 格式错误,缺少外层 "extra_body" 包装。
解决:使用双层嵌套格式 {"extra_body": {"google": {...}}}。
JSON 解析失败
原因:
- 响应被截断(token 限制太小)
- 响应包含 markdown 代码块
解决:
- 增加
max_completion_tokens - 添加 markdown 代码块处理逻辑
More by Project-N-E-K-O
View all skills by Project-N-E-K-O →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversUse Claude Code, Gemini CLI, Codex CLI, or any MCP client with any AI model. Acts as a multi-model proxy supporting Open
Ultra (Multi-AI Provider) unifies OpenAI, Gemini, and Azure models, tracking usage, estimating costs, and offering 9 dev
Consult LLM escalates complex reasoning tasks to advanced models with code context, git diffs, and detailed cost trackin
Generate stunning AI images with ImageGen, a unified AI image generator supporting DALL-E, Gemini & more, with smart par
AI Translation offers an advanced AI translation and machine translation service, auto-translating JSON files with perfe
Optimize your codebase for AI with Repomix—transform, compress, and secure repos for easier analysis with modern AI tool
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.