Limits and runtimes
Where the SDK runs, and the sizes, counts, and times it checks before a call is sent.
Runtimes
The SDK runs on servers, in any of these:
| Runtime | Version |
|---|---|
| Node | 20.3 or newer |
| Bun | Current releases |
| Deno | Current releases, with --allow-env to read environment variables and --allow-net to make calls |
| Cloudflare Workers | Current releases. Pass the key and project to createSpace() from env |
It ships as ES modules and as CommonJS, so both import and require work, and it includes its own TypeScript types.
Another server runtime may work when it has the same web APIs, such as fetch, AbortSignal.any, and Web Crypto. Without fetch, pass one in the fetch option, or createSpace() fails with unsupported_runtime.
Only on servers
The SDK holds an API key, and anyone who can see a key can use it. In a web page, every call that needs a key fails with browser_not_allowed before anything is sent. Call the SDK from your backend, and send your web page only what it needs, such as a download link from url().
The client
| Limit | Value |
|---|---|
timeoutMs, for one try of a call | 1,000 to 600,000 ms. 30,000 by default |
| Chat calls | 600,000 ms for one try, unless the call passes timeoutMs |
retries | 0 to 5. 2 by default |
Longest wait set by Retry-After | 30 seconds |
userAgent | 200 characters |
Storage
space.fs checks these before it sends anything. Storage’s own limits, such as storage in one project and buckets in one project, are in Storage limits.
| Limit | Value |
|---|---|
| Largest file | 100,000,000 bytes, exported as maxFileBytes |
| Key | 1,024 bytes, not starting or ending with /, without //, a folder named . or .., or control characters |
| Bucket name | 3 to 63 lowercase letters, digits, and single hyphens, starting and ending with a letter or digit |
pageSize for list() | 1 to 1,000. 1,000 by default |
| Preset name | 1 to 64 characters |
write() holds the whole file in memory while it sends it. A stream is read to its end first, and fails with file_too_large as soon as it passes the largest size.
AI
space.ai checks these before it sends anything. Your plan’s limits, such as units a month and requests a minute, are in AI limits.
| Limit | Value |
|---|---|
| Messages in one call | 1 to 1,000 |
| Tools in one call | 1 to 128 |
stop | Up to 4 strings |
temperature | 0 to 2 |
topP | 0 to 1 |
presencePenalty and frequencyPenalty | -2 to 2 |
user | 256 characters |
Scheduler
space.schedule checks these before it sends anything. The scheduler’s own limits, such as jobs in one project, are in Scheduler limits.
| Limit | Value |
|---|---|
| Job name | 1 to 100 characters. every() shortens its own name to fit |
| Job description | 500 characters |
| Target URL | https, up to 2,048 characters, without a # part |
| Retries after the first attempt | 0 to 5 |
| Longest time to keep retrying | 86,400 seconds |
| Wait between retries | 1 to 3,600 seconds |
| Doublings of the wait | 0 to 16 |
| Time for one attempt | 15 to 1,800 seconds |
verify() keeps the scheduler’s public keys for 5 minutes, and allows 30 seconds of difference between clocks when it checks a token’s times.
Webhooks
space.hooks checks these before it sends anything.
| Limit | Value |
|---|---|
| Source and destination names | 1 to 100 characters |
| Destination URL | https, up to 2,048 characters, without a # part |
| Attempts for one delivery | 1 to 20 |
| Time for one attempt | 1 to 60 seconds |
| Rate limit | 1 to 100,000 a second, minute, or hour |
| Delay on a connection | 0 to 86,400 seconds |
| Transformation code | 64 KB |
| Deliveries to send again in one call | 1 to 100 |
verify() accepts a delivery signed up to 5 minutes before or after your server’s clock. Change it with toleranceSeconds, from 1 to 86,400.
Last updated