Skip to content

cluster-only has no --model flag, auto-detects wrong Gemini model and hits free-tier rate limits #1277

Closed

Description

@sub4biz

Version

0.8.38

Steps to reproduce

  1. Run extract with an explicit model:

    graphify extract . --backend gemini --model gemini-3.1-flash-lite --token-budget 30000 --max-concurrency 1
    

    → Succeeds. No rate limit errors. Uses gemini-3.1-flash-lite (free tier: 500 RPD).

  2. Run cluster-only on the resulting graph:

    graphify cluster-only <path>
    

    → Immediately hits 429 rate limit errors on nearly every batch.

What happened

cluster-only auto-detects gemini-3-flash for community labeling, ignoring the model that was explicitly specified (and worked) during extract.

Free tier limits:

  • gemini-3-flash: 5 RPM and 20 RPD
  • gemini-3.1-flash-lite: 500 RPD

With 135 labeling batches and a 20 RPD daily cap, the process fails repeatedly:

[graphify label] batch 7/135 (100 communities) failed: Error code: 429
  quotaId: GenerateRequestsPerMinutePerProjectPerModel-FreeTier, quotaValue: 5, model: gemini-3-flash

[graphify label] batch N/135 (100 communities) failed: Error code: 429
  quotaId: GenerateRequestsPerDayPerProjectPerModel-FreeTier, quotaValue: 20, model: gemini-3-flash

The process eventually completes via retries, but takes significantly longer than necessary and is unreliable on the free tier.

Expected behavior

Either:

  • a) cluster-only and label accept a --model flag (same as extract) so the user can specify the model explicitly.
  • b) The model used during extract is persisted (e.g. in .graphify_analysis.json) and reused automatically by cluster-only.

Workaround

None. The label command has the same gap (no --model flag). Passing --no-label avoids the rate limit errors but leaves all communities as Community N — which defeats the purpose.

Notes

  • cluster-only documentation shows --backend=<name> but no --model flag.
  • The label command has the same gap.
  • extract ran 48 semantic chunks against the same API key with zero rate limit errors because it used gemini-3.1-flash-lite. The model switch in cluster-only is the sole cause of the failures.

Environment

  • OS: Windows 11
  • graphify: 0.8.38
  • Install method: uv tool install graphifyy[gemini]
  • Graph size: 121,500 nodes, 13,409 communities, 135 labeling batches

Activity

  1. carter-smalls commented on Jun 12, 2026

    @carter-smalls

    This looks like Gemini rate-limit conditions. Running npx ai-doctor might point out missing Retry-After handling and unsafe retry logic.

  2. sub4biz commented on Jun 12, 2026

    @sub4biz
    Author

    This looks like Gemini rate-limit conditions. Running npx ai-doctor might point out missing Retry-After handling and unsafe retry logic.

    Thanks for the suggestion. The Retry-After header is already being respected - the observed retry delays (48s, 45s, 42s…) match exactly what the API returned, so retry logic is working correctly.

    The root cause is model selection, not retry handling: cluster-only auto-detects gemini-3-flash (free tier: 5 RPM / 20 RPD), while extract was run explicitly with gemini-3.1-flash-lite (free tier: 500 RPD). With 135 labeling batches, the daily quota is exhausted regardless of how retries are handled. The fix needed is a --model flag for cluster-only (or persisting the model from extract), not changes to retry logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions