model-debugging
It isolates service failures from user-related errors by analyzing log data from Cloudflare and Tinybird.
Install
mkdir -p .claude/skills/model-debugging && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4062" && unzip -o skill.zip -d .claude/skills/model-debugging && rm skill.zipInstalls to .claude/skills/model-debugging
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Debug and diagnose model errors in Pollinations services. Analyze logs, find error patterns, identify affected users. For taking action on user tiers, see tier-management skill.Key capabilities
- →Isolate 500-level backend errors
- →Identify 4xx authentication/billing patterns
- →Analyze request ID flows in logs
- →Filter Tinybird/Cloudflare error data
- →Correlate IP/user patterns with failures
How it works
It cross-references log metadata and status codes to filter out expected client-side errors (401/402) from genuine infrastructure performance issues.
Inputs & outputs
When to use model-debugging
- →Analyze backend failure patterns
- →Identify users affected by errors
- →Diagnose model service request failures
About this skill
Model Debugging Skill
Use this skill when:
- Investigating model failures, high error rates, or service issues
- Finding users affected by errors (402 billing, 403 permissions, 500 backend)
- Analyzing Tinybird/Cloudflare logs for patterns
- Diagnosing specific request failures
Understanding Model Monitor Error Rates
Why does the Model Monitor show high error rates when models work fine manually?
The Model Monitor at https://monitor.pollinations.ai shows all real-world traffic, including:
- 401 errors: Anonymous users without API keys (most common)
- 402 errors: Users with insufficient pollen balance or exhausted API key budget
- 403 errors: Users denied access to specific models (API key restrictions)
- 400 errors: Invalid request parameters (e.g.,
openai-audiowithoutmodalitiesparam) - 429 errors: Rate-limited requests
- 500/504 errors: Actual backend failures (investigate these)
When you test manually with a valid secret key (sk_), you bypass auth/quota issues, so models appear to work fine.
Key insight: High 401/402/403/400 rates are expected from real-world usage. Focus investigation on 500/504 errors.
Data Flow Architecture
User Request → enter.pollinations.ai (Cloudflare Worker)
↓
Logs to Cloudflare Workers Observability
↓
Events stored in D1 database
↓
Batched to Tinybird (async, 100-500 events)
↓
Model Monitor queries Tinybird (model_health.pipe)
Structured Logging: enter.pollinations.ai uses LogTape with:
requestId: Unique per request (passed to downstream viax-request-idheader)status,body: Full error response from downstream services- Context:
method,routePath,userAgent,ipAddress
Quick Diagnostics
1. Check Model Monitor
View current model health at: https://monitor.pollinations.ai
2. Query Recent Errors from D1 Database
# Via enter.pollinations.ai worker (requires wrangler)
cd enter.pollinations.ai
npx wrangler d1 execute pollinations-db --remote --command "SELECT model_requested, response_status, error_message, COUNT(*) as count FROM event WHERE response_status >= 400 AND created_at > datetime('now', '-1 hour') GROUP BY model_requested, response_status, error_message ORDER BY count DESC LIMIT 20"
3. Capture Live Logs
enter.pollinations.ai (Cloudflare Worker)
cd enter.pollinations.ai
wrangler tail --format json | tee logs.jsonl
# Or with formatting:
wrangler tail --format json | npx tsx scripts/format-logs.ts
gen.pollinations.ai (image + text gateway)
Image and text generation now run inside the gen Cloudflare Worker (the legacy EC2 image-pollinations and text-pollinations services are decommissioned). Use wrangler tail from gen.pollinations.ai/:
cd gen.pollinations.ai
wrangler tail --format json | tee gen-logs.jsonl
Legacy anonymous image (OVH)
Anonymous traffic to image.pollinations.ai still terminates on the OVH host:
# Real-time logs
ssh -i ~/.ssh/id_rsa_ovh [email protected] "sudo journalctl -u image-pollinations -f"
# Last 3 minutes
ssh -i ~/.ssh/id_rsa_ovh [email protected] "sudo journalctl -u image-pollinations --since '3 minutes ago' --no-pager" > legacy-image-logs.txt
Common Error Patterns
Azure Content Safety DNS Failure
Error: getaddrinfo ENOTFOUND gptimagemain1-resource.cognitiveservices.azure.com
Cause: Azure Content Safety resource deleted or misconfigured
Impact: Fail-open (content proceeds without safety check)
Fix: Create new Azure Content Safety resource and update .env:
AZURE_CONTENT_SAFETY_ENDPOINT=https://<new-resource>.cognitiveservices.azure.com/
AZURE_CONTENT_SAFETY_API_KEY=<new-key>
Azure Kontext Content Filter
Error: Content rejected due to sexual/hate/violence content detection
Cause: Azure's content moderation blocking prompts/images
Impact: 400 error returned to user
Fix: User error - prompt violates content policy
Vertex AI Invalid Image
Error: Provided image is not valid
Cause: User passing unsupported image URL (e.g., Google Drive links)
Impact: 400 error returned to user
Fix: User error - need direct image URL
Translation Service Down
Error: No active translate servers available
Cause: Translation service unavailable
Impact: Prompts not translated (non-fatal)
Fix: Check translation service status
OpenAI Audio Invalid Voice
Error: Invalid value for audio.voice
Cause: User requesting unsupported voice name
Impact: 400 error returned to user
Fix: User error - use supported voices: alloy, echo, fable, onyx, nova, shimmer, coral, verse, ballad, ash, sage, etc.
Oversized Text Seed Surfaced as 500
Error: 'seed' must be Integer, invalid request error, or a generic upstream 500
Cause: A client sent a seed above signed INT32 max (2147483647) to a strict provider
Impact: The provider may misclassify invalid client input as 500, inflating model health errors
Fix: Reject oversized seeds as 400 at gateway validation; group incidents by user, API key, and request shape before treating them as a model outage
Veo No Video Data
Error: No video data in response
Cause: Vertex AI returned empty video response
Impact: 500 error
Fix: Check Vertex AI quota/status, may be transient
Environment Variables to Check
Image and text env vars now live in the gen Worker secrets (gen.pollinations.ai/secrets/{dev,staging,prod}.vars.json, SOPS-encrypted). Decrypt to inspect:
sops -d gen.pollinations.ai/secrets/prod.vars.json | jq 'keys[] | select(test("AZURE|GOOGLE|CLOUDFLARE|OPENAI"))'
Key variables:
AZURE_CONTENT_SAFETY_ENDPOINT- Azure Content Safety API endpointAZURE_CONTENT_SAFETY_API_KEY- Azure Content Safety API keyGOOGLE_PROJECT_ID- Google Cloud project for Vertex AIAZURE_MYCELI_PROD_SWEDEN_API_KEY- Shared Azure API key (Kontext, GPT Image, GPT Image 1.5)
Updating Secrets
Secrets are stored encrypted with SOPS:
gen.pollinations.ai/secrets/{dev,staging,prod}.vars.jsonenter.pollinations.ai/secrets/{dev,staging,prod}.vars.json
To update:
# Decrypt, edit, re-encrypt
sops gen.pollinations.ai/secrets/prod.vars.json
# Deploy to the gen Worker (secrets ship with the deploy)
cd gen.pollinations.ai && npm run deploy
Log Analysis Commands
# Count errors by type (against captured wrangler-tail JSON)
jq -r '.logs[]?.message[]? // .message? // empty' gen-logs.jsonl | grep -oE "(Azure Flux Kontext|Vertex AI|No active translate|getaddrinfo ENOTFOUND)" | sort | uniq -c | sort -rn
# Find content filter rejections
jq -r '.logs[]?.message[]? // .message? // empty' gen-logs.jsonl | grep -i "Content rejected" | sort | uniq -c
Model-Specific Debugging
| Model | Backend | Common Issues |
|---|---|---|
flux | Azure/Replicate | Rate limits, content filter |
kontext | Azure Flux Kontext | Content filter (strict) |
nanobanana | Vertex AI Gemini | Invalid image URLs, content filter |
seedream-pro | ByteDance ARK | NSFW filter, API key issues |
veo | Vertex AI | Quota, empty responses |
openai-audio | Azure OpenAI | Invalid voice names |
deepseek | DeepSeek API | Rate limits, API key |
Cloudflare Workers Observability API
The enter.pollinations.ai worker has structured logging enabled. You can query logs programmatically via the Cloudflare Workers Observability API.
Prerequisites
1. Get Account ID
# From wrangler.toml
grep account_id enter.pollinations.ai/wrangler.toml
2. Create API Token with Workers Observability Permission
Via Cloudflare Dashboard:
- Go to https://dash.cloudflare.com/profile/api-tokens
- Click Create Token
- Click Create Custom Token
- Configure:
- Token name:
Workers Observability Read - Permissions:
- Account → Workers Scripts → Read
- Account → Workers Observability → Edit (required for query API)
- Account Resources: Include → Your Account
- Token name:
- Click Continue to summary → Create Token
- Copy the token immediately (shown only once)
3. Store Token Securely
The token is stored in SOPS-encrypted secrets:
- Location:
enter.pollinations.ai/secrets/env.json - Key:
CLOUDFLARE_OBSERVABILITY_TOKEN
To add/update:
# Step 1: Decrypt to temp file
cd /path/to/pollinations
sops -d enter.pollinations.ai/secrets/env.json > /tmp/env.json
# Step 2: Add the token (use jq)
jq '. + {"CLOUDFLARE_OBSERVABILITY_TOKEN": "your_token"}' /tmp/env.json > /tmp/env_updated.json
# Step 3: Re-encrypt (must rename to match .sops.yaml pattern)
cp /tmp/env_updated.json /tmp/env.json
sops -e /tmp/env.json > enter.pollinations.ai/secrets/env.json
# Step 4: Cleanup
rm /tmp/env.json /tmp/env_updated.json
# Verify
sops -d enter.pollinations.ai/secrets/env.json | jq 'keys'
Note: The .sops.yaml config requires filenames matching env.json$ pattern.
API Endpoint
POST https://api.cloudflare.com/client/v4/accounts/{account_id}/workers/observability/telemetry/query
Query Examples
Setup: Get Credentials from SOPS
# Extract credentials from encrypted secrets
ACCOUNT_ID=$(sops -d enter.pollinations.ai/secrets/env.json | jq -r '.CLOUDFLARE_ACCOUNT_ID')
API_TOKEN=$(sops -d enter.pollinations.ai/secrets/env.json | jq -r '.CLOUDFLARE_OBSERVABILITY_TOKEN')
List Available Log Keys (Working)
This endpoint works and shows what fields are available:
curl -s "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/observability/telemetry/keys" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"timeframe": {"from": '$(( $(date +%s) - 86400 ))'000, "to": '$(date +%
---
*Content truncated.*
When not to use it
- →Tier-management or billing adjustments
- →Direct user support
Limitations
- →Dependent on log visibility in Tinybird/Cloudflare
- →Cannot resolve billing/tier issues directly
How it compares
It distinguishes between real-world usage noise and actionable backend system failures.
Compared to similar skills
model-debugging side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| model-debugging (this skill) | 1 | 2mo | Caution | Advanced |
| langsmith-observability | 4 | 7mo | Review | Intermediate |
| error-diagnostics-smart-debug | 5 | 3mo | No flags | Advanced |
| debugging-toolkit-smart-debug | 4 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by pollinations
View all by pollinations →You might also like
langsmith-observability
davila7
LLM observability platform for tracing, evaluation, and monitoring. Use when debugging LLM applications, evaluating model outputs against datasets, monitoring production systems, or building systematic testing pipelines for AI applications.
error-diagnostics-smart-debug
sickn33
Use when working with error diagnostics smart debug
debugging-toolkit-smart-debug
sickn33
Use when working with debugging toolkit smart debug
jaeger-analysis
incidentfox
Jaeger distributed tracing analysis. Use when investigating request latency, tracing errors across services, finding slow spans, or understanding service dependencies.
agentation
benjitaylor
Add Agentation visual feedback toolbar to a Next.js project
log-analyzer
mikopbx
Анализ логов Docker контейнера для диагностики проблем и мониторинга здоровья системы. Использовать при отладке ошибок, отслеживании процессов воркеров, исследовании проблем API или мониторинге поведения системы после тестов.