agentsclimarketplace

Narev update llm pricing

Skill narevai/skills/skills/narev-update-llm-pricing

Pin LLM pricing in the repo: fetch rows from narev-lookup-llm-pricing (price/search or price per provider), map pricing.prompt/completion into your schema, write a committed file. Use for snapshots — not for endpoint contracts (use lookup-llm-pricing).From its SKILL.md

Install
npx -y skills add narevai/skills --skill narev-update-llm-pricing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.4 KB, as published. Nobody here has run it

Update LLM pricing in the local repo

Turn live price API output into a checked-in file for offline or deterministic billing.

HTTP contracts → narev-lookup-llm-pricing (seven endpoints only). This skill covers fetch + map + write.

When to use this skill

  • Refresh a committed pricing registry from Narev.
  • Swap createNarevPriceResolver for createObjectPriceResolver over a local map.
  • Add a snapshot script or scheduled CI job.

Live lookup or one-call USD → narev-lookup-llm-pricing (POST /v1/calculate).

What to fetch

Use only lookup’s price endpoints (not calculate for bulk data):

Option A — full catalog (simplest)

Paginate GET https://api.narev.ai/v1/price/search with page and page_size (max 1000) until page > meta.total_pages. Optional q to narrow scope.

Option B — per provider

  1. GET https://api.narev.ai/v1/reference/providers for provider_id values.
  2. For each provider (or a scoped subset), paginate GET https://api.narev.ai/v1/price/{provider_id}.

Do not use GET /v1/models/pricing, GET /models/pricing, or bulk POST /v1/calculate.

What each row means

From { data: PriceEntry[], meta }:

API fieldSnapshot use
model_id, provider_idKeys — often provider_id/model_id when the same model exists on multiple vendors
pricing.promptInput token rate (USD per token)
pricing.completionOutput token rate
pricing.input_cache_read, pricing.input_cache_writeCache tiers
pricing.internal_reasoningReasoning tokens
pricing.request, pricing.web_searchPer-request / per-search
pricing.discountFraction 0–1, not a percent

Skip rows with missing or null pricing if the API returns them.

Mapping to your registry

  1. Inspect the repo — key style, per-token vs per-million, which fields the app reads.
  2. Transform each row:
    • Per-million: inputPerMTok = pricing.prompt * 1_000_000 (same for completion). Do not double-scale.
    • Per-token: copy pricing.* as-is (rename prompt → price_prompt if your schema uses that).
    • Map provider_id → provider when aligning with POST /v1/calculate or SDK maps.
  3. Merge or replace — merge overwrites keys from this run; replace rewrites the whole file.
  4. Script hygiene — generated banner, non-zero exit on HTTP errors, document run command, inspect diff.

@ai-billing/core (optional)

createObjectPriceResolver expects ModelPricing in USD per token:

Price API (pricing)SDK ModelPricing
promptpromptTokens
completioncompletionTokens
input_cache_readinputCacheReadTokens
input_cache_writeinputCacheWriteTokens
internal_reasoninginternalReasoningTokens
requestrequest
web_searchwebSearch
discountdiscount
import { createObjectPriceResolver } from "@ai-billing/core";
import { pricing } from "./pricing";

export const priceResolver = createObjectPriceResolver(pricing);

Workflow

  1. Scope — providers, target path, format, units.
  2. Fetch — paginate GET /v1/price/search or per-provider GET /v1/price/{provider_id} per lookup.
  3. Map & write — apply table above; merge/replace; banner if generated.
  4. Run — project package runner; verify diff.
  5. Wire app — import file or createObjectPriceResolver; optional CI schedule.

Constraints

  • Price endpoints only for snapshots (/v1/price/search or /v1/price/{provider_id}).
  • pricing.discount is a fraction (0.1 = 10% off).
  • Re-run before releases that depend on accurate math.

Reference

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.