gemini
Google Gemini API for multimodal generative AI. Use when user mentions "Gemini", "Google AI", "Gemini Pro", "Gemini Flash", or "Google generative AI" (do NOT use for Vertex AI enterprise endpoints).
What this skill does
## Troubleshooting
If requests fail, run `zero doctor check-connector --env-name GEMINI_TOKEN` or `zero doctor check-connector --url https://generativelanguage.googleapis.com/v1beta/models --method GET`
## How to Use
All examples below assume you have `GEMINI_TOKEN` set.
Base URL: `https://generativelanguage.googleapis.com/v1beta`
Authentication uses the `x-goog-api-key` header (preferred over `?key=` query parameter for safer logging).
### 1. Basic Text Generation
Generate text from a prompt:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "Hello, who are you?"}]}]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].text'
```
**Available models:**
- `gemini-2.5-pro`: Most capable reasoning model (1M context)
- `gemini-2.5-flash`: Fast, cost-efficient, balanced quality (1M context)
- `gemini-2.5-flash-lite`: Lowest latency, highest throughput (1M context)
- `gemini-2.0-flash`: Previous generation flash model
- `gemini-1.5-pro`: Legacy long-context model (2M context)
### 2. Chat with System Instruction
Steer the model with a system instruction:
Write to `/tmp/gemini_request.json`:
```json
{
"system_instruction": {"parts": [{"text": "You are a helpful assistant that responds in JSON format."}]},
"contents": [{"parts": [{"text": "List 3 programming languages with their main use cases."}]}]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].text'
```
### 3. Multi-Turn Conversation
Pass prior turns by alternating `user` and `model` roles:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [
{"role": "user", "parts": [{"text": "My name is Ethan."}]},
{"role": "model", "parts": [{"text": "Nice to meet you, Ethan."}]},
{"role": "user", "parts": [{"text": "What did I just tell you?"}]}
]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].text'
```
### 4. Streaming Response
Use the `streamGenerateContent` endpoint with `?alt=sse` for Server-Sent Events:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "Write a haiku about programming."}]}]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json
```
### 5. JSON Mode
Force structured JSON output via `responseMimeType` and an optional schema:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "Give me info about Paris: name, country, population."}]}],
"generationConfig": {
"responseMimeType": "application/json",
"responseSchema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"country": {"type": "string"},
"population": {"type": "integer"}
},
"required": ["name", "country", "population"]
}
}
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].text'
```
### 6. Vision (Image Analysis)
Pass an inline image as base64:
```bash
IMAGE_B64=$(curl -s "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg" | base64 -w0)
cat > /tmp/gemini_request.json <<EOF
{
"contents": [{
"parts": [
{"text": "What is in this image?"},
{"inline_data": {"mime_type": "image/jpeg", "data": "$IMAGE_B64"}}
]
}]
}
EOF
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].text'
```
For files larger than ~20 MB, upload via the Files API first and reference by `file_uri` instead of `inline_data`.
### 7. Function Calling (Tools)
Declare callable functions; the model responds with a `functionCall` part:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "What is the weather in Tokyo?"}]}],
"tools": [{
"function_declarations": [{
"name": "get_weather",
"description": "Get current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}]
}]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].functionCall'
```
### 8. Generate Embeddings
Use the `embedContent` endpoint with an embedding model:
Write to `/tmp/gemini_request.json`:
```json
{
"content": {"parts": [{"text": "The quick brown fox jumps over the lazy dog."}]}
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/text-embedding-004:embedContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.embedding.values[:5]'
```
This extracts the first 5 dimensions of the embedding vector.
**Embedding models:**
- `text-embedding-004`: 768 dimensions, general-purpose
- `gemini-embedding-001`: Latest Gemini embedding model
### 9. Count Tokens
Estimate token cost before sending:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "How many tokens is this prompt?"}]}]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:countTokens" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.totalTokens'
```
### 10. Safety and Generation Settings
Tune output with `generationConfig` and relax/tighten safety filters:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "Write a short story about a robot learning to paint."}]}],
"generationConfig": {
"temperature": 0.7,
"topP": 0.95,
"maxOutputTokens": 500
},
"safetySettings": [
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_ONLY_HIGH"}
]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.candidates[0].content.parts[0].text'
```
### 11. List Available Models
Get all models accessible to your key:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models" -H "x-goog-api-key: $GEMINI_TOKEN" | jq -r '.models[].name' | head -20
```
### 12. Check Token Usage
Every response includes `usageMetadata`:
Write to `/tmp/gemini_request.json`:
```json
{
"contents": [{"parts": [{"text": "Hi!"}]}]
}
```
Then run:
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: $GEMINI_TOKEN" -d @/tmp/gemini_request.json | jq '.usageMetadata'
```
Response includes:
- `promptTokenCount`: Input token count
- `candidatesTokenCount`: Output token count
- `totalTokenCount`Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.