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
npx -y skills add narevai/skills --skill narev-update-llm-pricingAssembled 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
createNarevPriceResolverforcreateObjectPriceResolverover 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
GET https://api.narev.ai/v1/reference/providersforprovider_idvalues.- 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 field | Snapshot use |
|---|---|
model_id, provider_id | Keys — often provider_id/model_id when the same model exists on multiple vendors |
pricing.prompt | Input token rate (USD per token) |
pricing.completion | Output token rate |
pricing.input_cache_read, pricing.input_cache_write | Cache tiers |
pricing.internal_reasoning | Reasoning tokens |
pricing.request, pricing.web_search | Per-request / per-search |
pricing.discount | Fraction 0–1, not a percent |
Skip rows with missing or null pricing if the API returns them.
Mapping to your registry
- Inspect the repo — key style, per-token vs per-million, which fields the app reads.
- Transform each row:
- Per-million:
inputPerMTok = pricing.prompt * 1_000_000(same for completion). Do not double-scale. - Per-token: copy
pricing.*as-is (renameprompt→price_promptif your schema uses that). - Map
provider_id→providerwhen aligning withPOST /v1/calculateor SDK maps.
- Per-million:
- Merge or replace — merge overwrites keys from this run; replace rewrites the whole file.
- 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 |
|---|---|
prompt | promptTokens |
completion | completionTokens |
input_cache_read | inputCacheReadTokens |
input_cache_write | inputCacheWriteTokens |
internal_reasoning | internalReasoningTokens |
request | request |
web_search | webSearch |
discount | discount |
import { createObjectPriceResolver } from "@ai-billing/core";
import { pricing } from "./pricing";
export const priceResolver = createObjectPriceResolver(pricing);
Workflow
- Scope — providers, target path, format, units.
- Fetch — paginate
GET /v1/price/searchor per-providerGET /v1/price/{provider_id}per lookup. - Map & write — apply table above; merge/replace; banner if generated.
- Run — project package runner; verify diff.
- Wire app — import file or
createObjectPriceResolver; optional CI schedule.
Constraints
- Price endpoints only for snapshots (
/v1/price/searchor/v1/price/{provider_id}). pricing.discountis a fraction (0.1= 10% off).- Re-run before releases that depend on accurate math.
Reference
- Endpoints and row shape:
narev-lookup-llm-pricing - Docs: https://www.narev.ai/docs/platform/api-reference/introduction
- SDK —
createObjectPriceResolver: https://narev.ai/docs/sdk/ai-billing/reference/core/typedoc/functions/createObjectPriceResolver