AIARCOASC Docs

Edge functions

V8-isolate compute at every PoP. Cold-start free, strongly-consistent durable state via Edge Objects.

What it is

Edge functions run JavaScript or TypeScript in V8 isolates at every PoP. There's no cold-start in the traditional sense — isolates spin up in single-digit milliseconds. For state that needs strong consistency, attach a Durable Object (one strongly-consistent actor per key, with its own storage).

When to use it

  • Routing layer that decides which origin or which AI model to use per request.
  • Auth middleware that runs at the edge before hitting your origin.
  • Real-time collaboration backed by Durable Objects (one actor per room).

Quickstart

asc edge functions create router --code router.ts --route 'example.com/api/*'
client.edge.functions.create(name='router', code_path='router.ts', route='example.com/api/*')
// router.ts
export default {
  async fetch(req: Request): Promise<Response> {
    const url = new URL(req.url);
    if (url.pathname.startsWith('/api/v2/')) return fetch('https://v2.example.com' + url.pathname);
    return fetch('https://v1.example.com' + url.pathname);
  },
};

Limits & quotas

LimitDefaultBurstNotes
Free tier100K req / day
Paid$0.30 / M req + $0.02 / M ms CPU
CPU per request30 ms (free) / 50 ms (paid)Burst by 2×
Durable Object request$0.15 / M

Pricing

See pricing. Pay-as-you-go, billed monthly via Stripe.

API surface

  • POST /v1/edge/functions
  • POST /v1/edge/functions/{id}/versions

Required scope(s): edge:write. See Scopes.

Security

All access is authenticated and scoped. See Auth & scopes and Network controls.