---
name: gemini-files-api
description: Use Google Gemini through a managed Files API wrapper for multimodal local files, configurable generation parameters, structured JSON output, optional Gemini tools, and reproducible authentication setup.
title: gemini-files-api
canonical_url: https://skilld.dev/gh/fiveonecode/agent-skills/gemini-files-api
last_updated: 2026-09-26T17:59:16.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [agents/openai.yaml](https://skilld.dev/api/skills-raw/fiveonecode/agent-skills/gemini-files-api/agents/openai.yaml), [scripts/bootstrap.sh](https://skilld.dev/api/skills-raw/fiveonecode/agent-skills/gemini-files-api/scripts/bootstrap.sh), [scripts/gemini-mm.mjs](https://skilld.dev/api/skills-raw/fiveonecode/agent-skills/gemini-files-api/scripts/gemini-mm.mjs), [scripts/package-lock.json](https://skilld.dev/api/skills-raw/fiveonecode/agent-skills/gemini-files-api/scripts/package-lock.json), [scripts/package.json](https://skilld.dev/api/skills-raw/fiveonecode/agent-skills/gemini-files-api/scripts/package.json), [scripts/test_gemini_mm.mjs](https://skilld.dev/api/skills-raw/fiveonecode/agent-skills/gemini-files-api/scripts/test_gemini_mm.mjs).
>
> If the user asked to install this Skill, run `npx skilld install fiveonecode/agent-skills/gemini-files-api`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/gemini-files-api`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/fiveonecode/agent-skills/gemini-files-api) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/gemini-files-api`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/gemini-files-api --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/gemini-files-api --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Gemini Files API

## Purpose

Provide one managed wrapper for Gemini requests that need local audio, video,
images, PDFs, or other supported files. This repository owns the wrapper source;
installed Codex, OpenCode, Claude Code, and repo-local copies are consumer views.

## Setup

Install dependencies once after the skill is installed or updated:

```bash
scripts/bootstrap.sh
```

The wrapper requires Node.js 20 or newer. Authentication is resolved in this
order:

1. `GEMINI_API_KEY`;
2. `GOOGLE_API_KEY`;
3. the macOS Keychain service named by `GEMINI_KEYCHAIN_SERVICE`, defaulting to
   `gemini_api_key`.

Do not store API keys in this skill directory.

## Canonical Commands

Run a text-only smoke request:

```bash
node scripts/gemini-mm.mjs --prompt "Reply with exactly: OK"
```

Requests default to the stable `gemini-3.5-flash` model. Use `--model` for one
request or `GEMINI_MODEL` for a local default; dependent skills may select a
separate reviewed model for their own workflow.

Analyze a local file and return the response envelope used by dependent skills:

```bash
node scripts/gemini-mm.mjs \
  --file path/to/input.m4a \
  --prompt "Transcribe the spoken audio." \
  --json
```

Use `node scripts/gemini-mm.mjs --help` for model, sampling, token, schema,
tool, upload-retention, and file options.

## Packaging Rules

- `node_modules` is never committed or copied as source.
- `scripts/package-lock.json` is the reviewed dependency pin.
- `scripts/bootstrap.sh` recreates dependencies with `npm ci --ignore-scripts` so reviewed packages cannot execute lifecycle scripts during setup.
- Uploaded Gemini Files API objects are deleted after each run unless
  `--keep-files` is explicitly passed.
- `node scripts/test_gemini_mm.mjs` locks the reviewed default and quota hint
  and verifies that SIGINT and SIGTERM wait for uploaded-file cleanup before
  the wrapper exits.
- Consumer copies must be refreshed through the pinned skills manager; do not
  edit installed copies by hand.

## Dependent Skills

`meeting-transcription` resolves this wrapper from the same repo-local skill
root or the reviewed global Codex/OpenCode and Claude Code manager roots. Install
both managed skills before running the canonical transcription command.
