【开源自荐】UsageRail SDK:在自己的 API 服务里做 API key 校验、按客户限流和用量计量
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 24/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- express, fastapi, javascript, node.js, python
- Domain
- content
Research direction
This issue is a project recommendation for UsageRail SDK, not a request to change code or documentation. Start by checking the repository’s contribution guidance and existing project listings; done would mean a specific, actionable contribution request is identified, since the issue itself does not name one.
Written by the indexing model from the issue text.
Description
1). 项目名称:UsageRail SDK(usagerail/sdk)
2). 项目地址:https://github.com/usagerail/sdk
3). 项目简介(100字以内):
给要收费的 API 用的中间件。请求进来先查 API key、这个客户的限流和剩余额度,放行后把请求数或 token 数记到客户名下。Node.js 和 Python 都有,MIT 协议。
4). 推荐原因:
我们是这个项目的开发团队。卖 API 的时候,发 key、按客户限流、扣额度、记用量这几件事几乎每个团队都要自己写一遍,这个 SDK 把它们放进一个中间件里,key 和限额在服务进程里对着同步下来的副本查,前面不用再架网关或代理。
- Node.js 22+:
npm install @usagerail/node,支持 Express、Hono(含 Cloudflare Workers)、Fastify、Next.js route handler。 - Python 3.10+:
pip install usagerail,支持 FastAPI、Starlette、Flask、Django,没有第三方依赖。 - 用量通常按路由模板归并(比如
/v1/items/{item_id}),同一个接口不会因为 ID 不同拆成很多行。Express 里有几种挂载方式拿不到模板,文档里列了。 - 超过限流返回 429,带
Retry-After和 IETF 草案里的 RateLimit 响应头。
用量会在后台批量报给 UsageRail 的托管服务,再写进开发者自己 Stripe 账号的账单,所以完整用起来需要配合托管服务。SDK 代码本身全部公开,仓库里也有测每次请求开销的基准脚本。
5). 项目图片:
无
6). 其他项目细节:
- 官网:https://usagerail.com
- 各框架的接入文档:https://usagerail.com/docs
- 托管服务有免费档:每个自然月通过 UsageRail 出账的金额在 1,000 美元以内就不收费。
欢迎试用和提 issue。
- Dominant language
- No language data
- Stars
- 1.9k
- Forks
- 76
- Avg merge
- 3h 36m
- Merged PRs (30d)
- 18
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenGithubs/weekly
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
OpenGithubs/weekly#263 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
OpenGithubs/weekly#230 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenGithubs/weekly#157 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
OpenGithubs/weekly#106 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
OpenGithubs/weekly#259 · 1 comment ·
Maintainers usually reply within 1 day
All issues in OpenGithubs/weekly
Similar issues
-
Correct Ente entryOpen
Difficulty 1/5 Under an hour Newbie friendliness 82/100
bitwarden/passkeys-index#168 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Add: Rajdhani TV HDOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
eryajf/learning-weekly#260 ·
-
[Submit] Agent BarnOpen
Difficulty 1/5 Under an hour Newbie friendliness 70/100