fittings-eia-fuel-price

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

US retail gasoline and diesel price

美国零售汽油与柴油价格

eia.fuel-price
on
https://fittings.sh
. One endpoint, weather and earth.
The current US retail price per gallon of a fuel grade for a region, from the EIA weekly petroleum price survey, with the preceding weeks of history on request.
eia.fuel-price
接口位于
https://fittings.sh
,属于天气与地球类服务下的单一接口。
该接口提供美国能源信息署(EIA)每周石油价格调查中某地区特定燃料等级的当前零售价格,可按需返回过往数周的历史数据。

The call

调用方式

GET https://fittings.sh/v1/eia/fuel-price
FieldTypeRequiredNotes
area
stringnoEIA area code or published name, e.g. 'NUS', 'California', 'PADD 2'. Default the US average
product
stringnoEIA product code or published name, e.g. 'EPMR', 'Regular Gasoline', 'No 2 Diesel'. Default regular gasoline
weeks
numbernoWeekly observations to return, 1-52, default 1
Example input:
json
{
  "area": "California",
  "product": "Regular Gasoline",
  "weeks": 4
}
GET https://fittings.sh/v1/eia/fuel-price
字段类型是否必填说明
area
stringEIA地区编码或公开名称,例如'NUS'、'California'、'PADD 2',默认返回美国平均价格
product
stringEIA产品编码或公开名称,例如'EPMR'、'Regular Gasoline'、'No 2 Diesel',默认返回普通汽油价格
weeks
number要返回的周度数据数量,范围1-52,默认返回1周
示例输入:
json
{
  "area": "California",
  "product": "Regular Gasoline",
  "weeks": 4
}

Metered

计量计费

The 402 quotes a ceiling — the price of the declared cap, 52 weeks — and settlement is for what the call actually used. A small request settles for less than it was quoted, so read the quote as an upper bound rather than a price.
x402标准会给出一个最高报价——即声明上限(52周数据)对应的价格,而结算金额则根据调用实际使用的资源计算。小请求的结算金额会低于报价,因此请将报价视为上限而非固定价格。

Cost and provenance

费用与来源

Price$0.004 per call, metered per weeks
SourceU.S. Energy Information Administration Open Data API v2, weekly retail gasoline and diesel prices - a US federal work in the public domain
Licencepublic-domain
AttributionSource: U.S. Energy Information Administration
项目详情
价格每次调用0.004美元,按返回的周数计量计费
数据来源美国能源信息署(EIA)开放数据API v2,每周零售汽油与柴油价格——属于美国联邦公有领域作品
许可证公有领域
署名要求来源:U.S. Energy Information Administration

Why call it rather than answer from memory

为何调用该接口而非依赖模型记忆

Fuel price is an input to mileage reimbursement, freight quoting and cost-of-travel estimates, and it moves every week. A model’s memory of it is wrong the day after training; EIA publishes the current number but only behind a code system - duoarea NUS, product EPMR - that nobody can guess, so this accepts the words a caller actually has.
燃料价格是里程报销、货运报价和出行成本估算的输入数据,且每周都会变动。模型训练后次日的价格记忆就会失效;EIA会发布当前价格,但仅使用无人能猜到的编码系统——地区编码NUS、产品编码EPMR——因此该接口支持调用者使用实际易懂的名称来查询。

Calling it

调用指南

A skill is loaded on its own, so this document has to be enough by itself. It does not assume the general
fittings
skill is also loaded.
call.mjs
ships alongside this file; if it is missing (this document reached you without the rest of the skill), fetch it once with
curl -sO https://fittings.sh/skill/call.mjs
.
Free, and needs no wallet. Read the schema and see what a call would cost:
bash
curl -s https://fittings.sh/catalog/eia.fuel-price | jq
Paying. The endpoint answers
402 Payment Required
with a signed quote, you sign an authorization, and a facilitator settles it — you never send a transaction and never pay gas. Before it spends anything, the client checks its own hash against the gateway and refuses rather than sign with logic the gateway has moved past:
bash
undefined
该技能为独立加载,因此本文档需包含全部必要信息,无需依赖通用的
fittings
技能。
call.mjs
文件与本文档一同发布;如果缺失(即您仅收到本文档而未获得技能的其他文件),可通过以下命令一次性获取:
curl -sO https://fittings.sh/skill/call.mjs
免费试用,无需钱包。查看接口schema并了解调用成本:
bash
curl -s https://fittings.sh/catalog/eia.fuel-price | jq
付费调用。该端点会返回
402 Payment Required
状态码及签名报价,您需签署授权信息,由服务商完成结算——您无需发送交易,也无需支付燃气费。在产生费用之前,客户端会将自身哈希值与网关校验,若网关逻辑已更新则会拒绝签署:
bash
undefined

Dry run. Prints the quote and pays nothing, because no key is set.

试运行。仅打印报价,无需支付费用,因为未设置密钥。

node call.mjs eia.fuel-price area=California product="Regular Gasoline" weeks=4
node call.mjs eia.fuel-price area=California product="Regular Gasoline" weeks=4

For real: a wallet holding USDC on Base, and nothing else.

实际调用:需使用在Base网络持有USDC的钱包,无需其他资产。

export FITTINGS_PRIVATE_KEY=0x... node call.mjs eia.fuel-price area=California product="Regular Gasoline" weeks=4

Spending is never a side effect of curiosity: with no `FITTINGS_PRIVATE_KEY`
the client fetches the quote and stops. `FITTINGS_MAX_PRICE` caps what it will
pay without asking, and defaults to $0.05.

**Use a throwaway wallet holding a few dollars, not a main one.** The key sits
in plaintext wherever the agent runs, and the whole cost of entry is USDC on
Base — no account, no API key, and no ETH, because the payer signs off-chain and
the facilitator broadcasts and pays the gas.

Writing your own client instead of using this one? `@x402/core` and
`@x402/evm` on npm, and the `fittings` skill records the two things that cost
real debugging time: the challenge is in a response header rather than the body,
and it must be re-signed from the exact request being retried.

If this is not the right service, `https://fittings.sh/catalog/search?q=...`
searches all of them for free.
export FITTINGS_PRIVATE_KEY=0x... node call.mjs eia.fuel-price area=California product="Regular Gasoline" weeks=4

好奇试用不会产生费用:未设置`FITTINGS_PRIVATE_KEY`时,客户端仅会获取报价后停止操作。`FITTINGS_MAX_PRICE`可设置无需确认的最高支付金额,默认值为0.05美元。

**请使用仅持有少量资金的临时钱包,而非主钱包**。密钥会以明文形式存储在代理运行的位置,入门成本仅为Base网络上的USDC——无需账户、无需API密钥、无需ETH,因为付款人进行链下签名,由服务商广播交易并支付燃气费。

不想使用该客户端,而是自行开发?可使用npm上的`@x402/core`和`@x402/evm`包,`fittings`技能记录了两个耗时的调试要点:挑战信息位于响应头而非响应体中,且必须针对重试的精确请求重新签名。

如果该服务不符合您的需求,可通过`https://fittings.sh/catalog/search?q=...`免费搜索所有可用服务。