FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
unkey
unkeyratelimit
Rate limit your serverless functions
Public
Like
ratelimit
Home
Code
4
README.md
H
example.ts
H
proxy.ts
sdk.ts
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
https://unkey--c253d77c707411f0a8c70224a6c84d84.web.val.run
README.md

Ratelimit with unkey

Unkey’s ratelimit API provides a global low latency solution to limit your functions and protect upstream services.

Val Town users get limited free usage of unkey's rate limiting service, so you can import and start rate limiting immediately. No need to set up an unkey account or copy & paste an API key.

Usage

Create val
import { ratelimit } from "https://www.val.town/x/unkey/ratelimit/code/sdk.ts"; export default async function (req: Request): Promise<Response> { const rl = await ratelimit({ identifier: "someone", limit: 5, duration: 60000, }); if (!rl.success) { return Response.json("back off", { status: 429 }); } // Perform expensive operation here return new Response("ok"); }

Limitations

TODO - explain how much "free rate limiting" Val Town users get

If you need higher limits, sign up for your own unkey account here.

HTTP
  • example.ts
    unkey--c2…84.web.val.run
  • proxy.ts
    unkey--7ee04b06707411f0a0d60224a6c84d84.web.val.run
Code
README.md
H
example.ts
H
proxy.ts
sdk.ts
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesCLIAI agentsCode intelligenceSlack integrationsGTMPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.