Skip to content

Analytics Tools ​

Tools for tracking usage, discovering model capabilities, monitoring quotas, estimating provider cost, and getting help.

Overview ​

Analytics tools help you understand your usage:

Analytics Tools Overview

Tool calls → Usage logs → Stats, summaries, and documentation


get_usage_stats ​

Get detailed usage statistics with time-based bucketing.

Parameters ​

ParameterTypeRequiredDescription
lookback_daysnumberNoDays to look back (1-90, default: 7)
granularitystringNoBucket size: hour, day, week
operationstringNoFilter by operation type
range_startstringNoISO start timestamp
range_endstringNoISO end timestamp
limitnumberNoMax buckets (default: 100)

Granularity Options ​

ValueBucket SizeBest For
hour1 hourRecent activity
day1 dayWeekly trends
week1 weekMonthly overview

Example: Last 30 Days ​

json
{
  "tool": "get_usage_stats",
  "params": {
    "lookback_days": 30,
    "granularity": "day"
  }
}

Response ​

Usage Statistics (Last 30 Days)

**Summary**
- Total Operations: 1,847
- Total Images: 1,523
- Storage Used: 856 MB
- Average Duration: 3.4s
- Estimated Cost: $12.34

**Daily Breakdown**
| Date       | Operations | Images | Size    |
|------------|------------|--------|---------|
| Jan 15     | 45         | 38     | 21.3 MB |
| Jan 14     | 52         | 44     | 24.8 MB |
| Jan 13     | 38         | 32     | 18.2 MB |
| ...        | ...        | ...    | ...     |

**By Operation**
- generate_image: 1,200 (65%)
- edit_image: 323 (17%)
- generate_with_character: 245 (13%)
- generate_with_product: 79 (5%)

Filter by Operation ​

json
{
  "tool": "get_usage_stats",
  "params": {
    "lookback_days": 30,
    "granularity": "day",
    "operation": "generate_image"
  }
}

Custom Date Range ​

json
{
  "tool": "get_usage_stats",
  "params": {
    "range_start": "2024-01-01T00:00:00Z",
    "range_end": "2024-01-31T23:59:59Z",
    "granularity": "day"
  }
}

get_account_summary ​

Get a comprehensive overview of your account.

Parameters ​

None required.

Example ​

json
{
  "tool": "get_account_summary",
  "params": {}
}

Response ​

Account Summary

**Account**
- Tenant: Creative Studio
- Created: January 1, 2024

**Library**
┌────────────────────┬────────┐
│ Characters         │ 12     │
│ Style Presets      │ 5      │
│ Product References │ 8      │
└────────────────────┴────────┘

Most Used:
- Character: Luna (45 uses)
- Style Preset: Cinematic (89 uses)
- Product: Water Bottle (32 uses)

**Images**
┌────────────────────┬─────────┐
│ Total Images       │ 1,523   │
│ Generations        │ 1,200   │
│ Edits              │ 323     │
│ Storage Used       │ 856 MB  │
│ Average Size       │ 562 KB  │
└────────────────────┴─────────┘

**Sessions**
┌────────────────────┬─────────┐
│ Total Sessions     │ 245     │
│ Active Sessions    │ 3       │
│ Avg Images/Session │ 6.2     │
└────────────────────┴─────────┘

**Recent Activity (30 days)**
┌────────────────────┬─────────┐
│ Images Generated   │ 342     │
│ API Calls          │ 1,847   │
│ Daily Average      │ 11.4    │
└────────────────────┴─────────┘

**Quotas**
- Storage: 856 MB / 1,024 MB (83.6%)
- Rate Limit: 60 req/min

list_models ​

List tenant-enabled image models and capability metadata.

Use this before selecting advanced settings or high-cost model options.

Parameters ​

ParameterTypeRequiredDescription
include_unavailablebooleanNoInclude models known to Go Bananas but not enabled for this tenant

Example ​

json
{
  "tool": "list_models",
  "params": {}
}

Response Includes ​

FieldDescription
defaultModelIdTenant default model
allowedModelIdsModels enabled for this tenant
models[].capabilities.maxReferenceImagesReference image limit
models[].capabilities.supportedAspectRatiosSupported aspect ratios
models[].capabilities.supportedOutputFormatsOutput formats
models[].capabilities.supportedQualityLevelsQuality controls
models[].caveatsModel-specific guidance

Each model is listed with its provider, tier, reference-image limit, aspect ratios, output formats, quality levels and (for Gemini) resolution tiers. With include_unavailable: true, models your workspace has not enabled are listed too, marked not enabled. Six models exist today: gemini-flash-lite-image (the default), gemini-flash-image, gemini-pro-image, openai-gpt-image-2, openai-gpt-image-2.5-flare and openai-gpt-image-2.5-sunburst.

The response ends with a tip to run check_quota with model_id, quality, resolution_tier and estimated_images before expensive runs.


check_quota ​

Lightweight pre-flight check before generating. It verifies storage quota, rate-limit headroom and provider service health, and estimates provider cost. Call it before large batches, OpenAI high-quality generations, or 2K/4K work. It never generates anything.

Parameters ​

ParameterTypeRequiredDescription
estimated_imagesnumberNoImages you plan to generate, 1–100 (default: 1)
model_idstringNoModel you plan to use (any of the six model IDs). Defaults to the workspace default
qualitystringNoOpenAI quality for the estimate: low, medium, high, xhigh, max, auto (default auto)
resolution_tierstringNoGemini tier for the estimate: 0.5k, 1k, 2k, 4k (default 1k)
output_formatstringNopng, jpeg or webp
sizestringNoOpenAI size: auto or WIDTHxHEIGHT, e.g. 1536x1024; larger sizes scale the estimate
estimated_referencesnumberNoReference images you expect to send, 0–16; adds a cost warning

Example ​

json
{
  "tool": "check_quota",
  "params": {
    "estimated_images": 4,
    "model_id": "openai-gpt-image-2",
    "quality": "high",
    "size": "2048x1024"
  }
}

Response Includes ​

The MCP tool returns this as formatted text; GET /api/quota-check returns the same information as the JSON fields below.

FieldDescription
canGenerateWhether the planned run can go ahead
reasonsWhy not, when canGenerate is false
details.storageUsed, quota and remaining MB
details.rateLimitRemaining requests, limit per minute, reset time
details.serviceHealthCircuit-breaker state (closed, open, half_open) and time until retry
details.estimatedCostEstimated USD, confidence (low or medium), assumptions and warnings

Estimates, not bills

The cost estimate is a heuristic. For GPT Image 2 it uses a 1024×1024 low/medium/high figure (auto, xhigh and max show as variable). For GPT Image 2.5 no dollar figure is given, because billing is token-based. check_quota does not check your OpenAI account's billing or rate limits.

The REST equivalent is GET /api/quota-check.


get_help ​

Get documentation for tools, categories, or workflows.

Parameters ​

ParameterTypeRequiredDescription
tool_namestringNoSpecific tool to document
categorystringNoTool category
workflowstringNoWorkflow guide

Categories ​

CategoryTools Covered
generationImage creation tools
editingImage modification tools
charactersCharacter consistency system
productsProduct marketing tools
stylesBrand style presets
analyticsUsage tracking, model discovery, quota checks
allComplete listing

Workflows ​

WorkflowDescription
consistent_charactersMulti-scene character generation
conversational_editingIterative image refinement
product_marketingProduct campaign generation
style_brandingConsistent brand styling

Example: Tool Help ​

json
{
  "tool": "get_help",
  "params": {
    "tool_name": "generate_image"
  }
}

Response ​

# generate_image

Generate new images from text prompts using Gemini or OpenAI image models.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| prompt | string | Yes | Text description |
| negative_prompt | string | No | What to avoid |
| aspect_ratio | string | No | Image dimensions |
| n | number | No | Number of images (1-4) |
| model_id | string | No | Model selection |
| system_instruction | string | No | Style guidance |
| reference_images | string[] | No | Reference R2 keys (advanced) |

## Examples

Basic:
{
  "prompt": "a sunset over mountains"
}

With options:
{
  "prompt": "a sunset over mountains",
  "aspect_ratio": "landscape",
  "n": 2,
  "negative_prompt": "blurry, low quality"
}

## Related Tools
- edit_image: Edit generated images
- continue_editing: Conversational editing
- generate_with_character: Use saved characters

Example: Category Help ​

json
{
  "tool": "get_help",
  "params": {
    "category": "characters"
  }
}

Response ​

# Character Tools

Tools for managing persistent characters.

## Available Tools

1. **create_character**
   Save a character design for reuse

2. **update_character**
   Modify existing character

3. **delete_character**
   Remove from library

4. **list_characters**
   Browse character library

5. **get_character**
   Get character details

6. **generate_with_character**
   Generate scene with character

7. **generate_with_multiple_characters**
   Multi-character scenes (2-5)

## Quick Start

1. Create a character:
   create_character({
     character_name: "Luna",
     base_prompt: "young woman with red hair..."
   })

2. Generate scenes:
   generate_with_character({
     character_name: "Luna",
     scene_prompt: "in a magical forest"
   })

## Related
- See workflow: consistent_characters

Example: Workflow Help ​

json
{
  "tool": "get_help",
  "params": {
    "workflow": "conversational_editing"
  }
}

Response ​

# Conversational Editing Workflow

Edit images naturally through conversation.

## How It Works

1. **Generate Initial Image**
   "Generate a sunset over mountains"
   → Creates image #342

2. **Edit Conversationally**
   "Add some clouds"
   → continue_editing edits #342, creates #343

3. **Keep Refining**
   "Make the colors more vibrant"
   → continue_editing edits #343, creates #344

## Session State

The session tracks your last image:
- last_image_id updates after each operation
- continue_editing automatically uses it
- No need to specify image IDs

## Tips

- Use natural language
- Build up changes incrementally
- Check current image with get_image_info
- View history with get_session_history

## Tools Used

- generate_image: Initial creation
- continue_editing: Subsequent edits
- edit_image: Edit specific image by ID
- get_session_history: View all images

Usage Tracking ​

All operations are automatically tracked:

What's Tracked ​

FieldDescription
operationTool name called
images_generatedNumber of images created
total_size_bytesStorage consumed
duration_msProcessing time
api_calls_madeExternal API calls
estimated_cost_centsApproximate cost
timestampWhen operation occurred

Operation Types ​

OperationWhen Tracked
generate_imageNew image generation
edit_imageImage editing
generate_with_characterCharacter scene
generate_with_productProduct marketing
create_characterCharacter creation
create_product_referenceProduct upload
*_failedFailed operations

Quota Monitoring ​

Use check_quota before large batches, OpenAI high-quality generations, or 2K/4K work.

Storage Quota ​

Storage Quota Monitoring

Usage levels: Normal (0-70%), Warning (70-90%), Critical (90-100%), Blocked (>100%)

Monitor with get_account_summary:

Quotas:
- Storage: 856 MB / 1,024 MB (83.6%)  ⚠️ Warning

Rate Limits ​

Default limits:

  • 60 requests per minute
  • 10 concurrent requests
  • 4 images per request

When exceeded, operations return:

json
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded",
    "details": {
      "retry_after": 30
    }
  }
}

Cost Estimation ​

Approximate provider output costs (before reference-image input tokens and platform/storage costs):

Model1K / 2K4KNotes
Nano Banana 2 Lite~$0.0336—Fixed at 1K
Nano Banana 2 (Flash)~$0.067 / ~$0.101~$0.1510.5K is about ~$0.045
Go Bananas! Pro~$0.134~$0.2401K and 2K share the same published output bucket
OpenAI GPT Image 2Token-pricedToken-pricedcheck_quota uses low/medium/high heuristics; actual cost depends on text/image input and output tokens
OpenAI GPT Image 2.5 (Flare, Sunburst)Token-pricedToken-pricedcheck_quota gives no dollar figure for these models

Monthly example:

1,000 Flash 1K generations = ~$67
500 Pro 1K generations = ~$67
Total: ~$134/month before input/reference-image charges

Plus Cloudflare costs:

  • Workers: $5/month (paid plan)
  • R2: $0.015/GB stored
  • D1: Pay-as-you-go

Best Practices ​

Regular Monitoring ​

Check usage weekly:

json
{
  "tool": "get_usage_stats",
  "params": {
    "lookback_days": 7,
    "granularity": "day"
  }
}

Track by Project ​

Use custom session IDs:

json
{
  "tool": "generate_image",
  "params": {
    "prompt": "...",
    "session_id": "project-x-2024"
  }
}

Then filter:

json
{
  "tool": "search_images",
  "params": {
    "filters": {
      "session_id": "project-x-2024"
    }
  }
}

Clean Up Regularly ​

Delete unused images to free quota:

Search for old test images
Delete unused generations
Archive completed projects

Next Steps ​

Released under the MIT License.