zytedata/claude-skills · Archived

scrape-zyte-api-stats

Query usage stats for Zyte API requests that have already been sent, including cost, request volume, response times, status codes, filters, grouping, and pagination. Use this skill whenever answering the request requires looking up recorded Zyte API usage, spend, request counts, response times, grouped stats, or filtered stats — including projecting future spend or usage when the projection explicitly extrapolates from actual recorded usage (e.g. "based on this month's usage so far, project mon…

First seen Jun 27, 2026

Installation

$ npx skills add zytedata/claude-skills --skill scrape-zyte-api-stats

Summary

  • Query usage stats for Zyte API requests that have already been sent, including cost, request volume, response times, status codes, filters, grouping, and pagination.
  • Use this skill whenever answering the request requires looking up recorded Zyte API usage, spend, request counts, response times, grouped stats, or filtered stats — including projecting future spend or usage when the projection explicitly extrapolates from actual recorded usage (e.g. "based on this month's usage so far, project month-end spend").
  • Do not use it when the user asks what a spider, job, or workload might, would, or could generate — those are hypothetical estimates with no recorded data to query, even if a spider exists in the project.
  • For a projection to qualify, the user must explicitly reference past or current recorded usage as the basis.
  • Also do not use for dashboard setup, documentation, configuration, or account-help questions.

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from zytedata/claude-skills · top by installs.

npx skills add zytedata/claude-skills

Browse all from zytedata/claude-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 25
License LICENSE.md
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Allowed toolsBash

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 6,363 B
  • docs SUMMARY.md 954 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 3 installs

SKILL.md

Query historical Zyte API usage stats using the wrapper bundled with this skill. The bundled scripts handle auth, project lookup, and retries without exposing API keys to the model. The stats wrapper returns the raw Stats API JSON response; the agent is responsible for presenting that data to the user.

This skill is for querying historical usage that already happened, not for forecasts, predictions, dashboard setup, documentation, or configuration help.

Always resolve organization_id by running the project lookup helper first:

  1. Run the project lookup helper:
uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/project_org_lookup.py"
  1. Read the JSON status and follow this branch logic:

- resolvedprojectwithorganization: use the returned organizationid in the stats query. If the payload also includes a projects list, the helper found multiple configured projects that all map to the same organization and already collapsed them safely. - multipleprojectsfound: if the payload includes an organizations list, ask the user to choose among those discovered safe organization options, not project names and not by typing a raw organization id or raw project id. Present each option by organizationid exactly as returned, and keep the corresponding selection value privately for rerunning the helper with --project. If no organizations list is present, fall back to the listed projects. - noprojectconfigured or organizationlookup_failed: tell the user to use /scrape-zyte-login to configure a project and credentials, then retry the query. Name /scrape-zyte-login explicitly in the final user-facing message. Do not offer a raw organization id or raw project id as a fallback in these branches.

The project lookup helper reads project IDs from the standard shub config (scrapinghub.yml in the project root, ~/.scrapinghub.yml, or environment variables) and calls the Zyte project endpoint to derive organization_id. That is allowed for this skill. Do not read or print credential values directly.

If the user chooses one of several discovered organization or project options, rerun the helper with the corresponding selection or project value:

uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/project_org_lookup.py" --project 2

Wrapper

Run the wrapper with uv, passing query parameters as a JSON object:

uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/zyte_api_stats.py" \
	--params '{"organization_id": 3}'

Use ${CLAUDESKILLDIR} as provided by the skill runtime. Do not prefix the same command with an inline CLAUDESKILLDIR=... assignment, because the script path may be expanded before that temporary assignment applies.

Build --params directly from the Stats API docs. The wrapper does not translate or validate parameter names for you.

The wrapper prints the raw Stats API JSON object. Read it and format the result for the user yourself. Keep user-facing claims grounded in the returned JSON. Do not assume fields exist beyond what the API returned.

When the user specifies an explicit relative window such as last 7 days, last 30 days, or this month, compute one concrete UTC starttime / endtime pair and pass those values in --params. Keep that workflow simple: prefer one concise computation step when needed, and avoid repeated exploratory shell retries.

When the user asks for recent usage without specifying a window, omit starttime and endtime entirely so the API's default range applies.

If the JSON response has an empty results list, tell the user there was no data for that query instead of fabricating a summary.

Use API fields such as page, pagesize, and totalresult_count to decide whether more pages exist. If you fetch another page, keep all other query parameters unchanged and only increment page.

Base claims on the wrapper output. Do not add dates, causes, feature interpretations, or other conclusions that the wrapper did not return as data. Do not infer caching, article size, site availability, outage causes, or other operational explanations from cost changes, response times, or status-code mixes unless the JSON response explicitly supports that claim.

Status codes such as 520 carry Zyte-specific semantics. Do not relabel them unless the response or docs explicitly do so.

Both scripts resolve the Scrapy Cloud API key via shub. Use --check-key only when you need to confirm auth is available:

uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/zyte_api_stats.py" --check-key

If the key is missing, tell the user to run shub login or use the scrape-zyte-login skill.

Stats API Parameters

For supported parameters, filters, grouping options, and response fields, use the official docs:

Use only the Reference section; ignore dashboard setup content.

Example with filters and grouping:

uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/zyte_api_stats.py" \
	--params '{"organization_id": 3, "start_time": "2026-03-01T00:00:00Z", "end_time": "2026-03-31T23:59:59Z", "page": 1, "groupby_time": "day", "extraction_type": "article", "extraction_from": "browserHtml"}'