一键导入
gemini-api-models
Use when selecting a Gemini model, checking rate limits or quotas, configuring the gemini-rust crate, or debugging model name mismatches.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when selecting a Gemini model, checking rate limits or quotas, configuring the gemini-rust crate, or debugging model name mismatches.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create new Kiro skills (Agent Skills). Use when asked to create a skill, write a SKILL.md, add a new workflow to .kiro/skills/, or package agent instructions as a reusable skill.
Use when creating a release, bumping the version, tagging a commit, or working with the GitHub Actions release workflow for rs-summarizer.
Use when editing or creating Askama HTML templates, adding template variables, fixing compile-time template errors, or working with HTMX attributes in templates.
Use when working with tokio::spawn background tasks, the summarization pipeline, task state transitions, or the mark_error/mark_summary_done pattern.
Use when building, running, linting with clippy, formatting with rustfmt, or running cargo commands for the rs-summarizer project.
Use when updating Cargo dependencies, checking for new crate versions, evaluating semver bumps, or deciding whether to upgrade a specific crate.
| name | gemini-api-models |
| description | Use when selecting a Gemini model, checking rate limits or quotas, configuring the gemini-rust crate, or debugging model name mismatches. |
rs-summarizer uses the gemini-rust crate to interact with Google's Gemini API for text generation and embeddings. Model names must exactly match the API identifiers.
Models are referenced via Model::Custom(format!("models/{}", name)). The name field in ModelOption is the part after models/.
let gemini_model = Model::Custom(format!("models/{}", model.name));
let client = Gemini::with_model(&self.api_key, gemini_model)?;
| Config Name | API ID | RPM | RPD | Notes |
|---|---|---|---|---|
gemini-3.5-flash | models/gemini-3.5-flash | 5 | 20 | Default selection |
gemma-4-31b-it | models/gemma-4-31b-it | 15 | 1500 | Free, no system prompt |
gemma-4-26b-a4b-it | models/gemma-4-26b-a4b-it | 15 | 1500 | Free, no system prompt |
gemini-3.1-flash-lite | models/gemini-3.1-flash-lite | 15 | 500 | Stable version, high quota |
gemini-2.5-flash | models/gemini-2.5-flash | 5 | 20 | Solid all-rounder |
gemini-2.5-flash-lite | models/gemini-2.5-flash-lite | 10 | 20 | Lightweight |
gemini-3-flash-preview | models/gemini-3-flash-preview | 5 | 20 | Preview version |
| Config Name | API ID | RPM | RPD |
|---|---|---|---|
gemini-embedding-001 | models/gemini-embedding-001 | 100 | 1000 |
Important: Do NOT use Model::TextEmbedding004 — that maps to models/text-embedding-004 which doesn't exist. Use Model::Custom instead.
Gemini models support system prompts via .with_system_prompt().
Gemma models do NOT support system prompts ("Developer instruction is not enabled"). The code conditionally skips the system prompt:
let mut builder = client.generate_content();
if !model.name.starts_with("gemma") {
builder = builder.with_system_prompt("...");
}
let mut stream = builder.with_user_message(&prompt).execute_stream().await?;
Text generation uses .execute_stream() which returns an async stream of chunks. Each chunk may contain:
response.text() — the generated text fragmentresponse.usage_metadata — token counts (typically only in the last chunk)fn is_rate_limit_error(err_str: &str) -> bool {
err_str.contains("ResourceExhausted")
|| err_str.contains("429")
|| err_str.contains("RESOURCE_EXHAUSTED")
}
To discover correct model IDs:
curl -s "https://generativelanguage.googleapis.com/v1beta/models?key=$GEMINI_API_KEY" | \
python3 -c "import sys,json; [print(m['name']) for m in json.load(sys.stdin)['models'] if 'generateContent' in m.get('supportedGenerationMethods',[])]"
src/services/summary.rs — Text generation with streamingsrc/services/embedding.rs — Embedding computationsrc/main.rs — Model option configurationsrc/state.rs — ModelOption struct definition