- Home
- Skills
- Project N E K O
- N.E.K.O
- Gemini Openai Api
gemini-openai-api_skill
- Python
810
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill project-n-e-k-o/n.e.k.o --skill gemini-openai-api- SKILL.md3.0 KB
Overview
This skill documents how to integrate Gemini models through an OpenAI-compatible API for use as an auxiliary model. It covers recommended models for common tasks, how to control Gemini 'thinking' with extra_body, and how to normalize Gemini responses that may be wrapped in Markdown code blocks. The guidance is focused on practical configuration and parsing steps for JavaScript or Python OpenAI-compatible clients.
How this skill works
The skill explains the OpenAI-compatible base URL and maps task types to Gemini models (summary/correction/vision vs. emotion). It shows how to pass Gemini-specific runtime controls by nesting a google object inside an outer extra_body parameter, and how to detect and strip Markdown code fences around JSON responses. It also points to where to add provider and extra_body mappings in application config files.
When to use it
- When you need to add Gemini as a secondary/assist model behind an OpenAI-compatible client.
- When you must control or disable the model's internal 'thinking' behaviors (Gemini 2.5+).
- When Gemini responses include JSON wrapped in Markdown code blocks and need parsing.
- When configuring provider entries and model mappings in application config files.
- When selecting a task-appropriate Gemini model (summary, emotion, vision).
Best practices
- Use the base URL https://generativelanguage.googleapis.com/v1beta/openai/ for OpenAI-compatible requests.
- Always wrap Gemini runtime settings as {"extra_body": {"google": {...}}} — the outer key is required by the client.
- Choose gemini-3-flash-preview for summary/correction/vision and gemini-2.5-flash for emotion analysis.
- Disable or lower 'thinking' for predictable, deterministic outputs (set thinking_budget=0 or thinking_level='low').
- Handle Markdown code fences before JSON parse: strip leading/trailing ``` blocks and then JSON.parse.
Example use cases
- Adding Gemini to a multi-provider assistant where Gemini handles summarization and vision tasks.
- Setting thinking_budget=0 for swift short responses from gemini-2.5-flash in realtime UIs.
- Lowering include_thoughts and thinking_level for gemini-3-flash-preview to avoid internal chains of thought.
- Preprocessing model output to remove ```json code fences before converting to structured data.
- Registering gemini in config/api_providers.json and mapping EXTRA_BODY_GEMINI in config/__init__.py.
FAQ
That error means extra_body was formatted incorrectly. Use the required double-nested shape: {"extra_body": {"google": {...}}} so the client forwards the google object correctly.
JSON.parse fails on the model response. What should I check?
First ensure max_completion_tokens is large enough to avoid truncation. Second, strip any Markdown code fences (...) that may wrap the JSON before parsing.