totalum-sdk 1.9.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/{coerce.d-Cli9TkUD.d.ts → coerce.d-DiNiCkat.d.ts} +1 -1
- package/dist/_types/{errors.d-WcXvShIX.d.ts → errors.d-BfXTsxYG.d.ts} +11 -7
- package/dist/_types/{integrations.d-WM81VvEj.d.ts → integrations.d-DL2_rTOs.d.ts} +11 -20
- package/dist/_types/{ops.d-CS92EKY-.d.ts → ops.d-fwLDriUN.d.ts} +3 -3
- package/dist/ai/index.d.ts +14 -48
- package/dist/ai/index.js +6 -6
- package/dist/analytics/index.d.ts +5 -5
- package/dist/analytics/index.js +1 -1
- package/dist/browser/index.d.ts +10 -10
- package/dist/browser/index.js +4 -4
- package/dist/cron/index.d.ts +10 -10
- package/dist/cron/index.js +5 -5
- package/dist/d1/d1-limits.js +1 -1
- package/dist/d1/errors.js +3 -3
- package/dist/d1/https.js +3 -3
- package/dist/d1/index.d.ts +12 -12
- package/dist/d1/index.js +2 -2
- package/dist/d1/lazy.js +4 -4
- package/dist/d1/libsql.js +5 -5
- package/dist/d1/migrate-rules.js +5 -5
- package/dist/d1/native-shape.js +2 -2
- package/dist/d1/retry.js +3 -3
- package/dist/d1/session.js +3 -3
- package/dist/d1/sql.js +2 -2
- package/dist/email/index.d.ts +9 -13
- package/dist/email/index.js +1 -1
- package/dist/errors.js +4 -4
- package/dist/files/index.d.ts +11 -11
- package/dist/files/index.js +4 -4
- package/dist/http.js +12 -11
- package/dist/index.d.ts +6 -7
- package/dist/index.js +1 -1
- package/dist/logs/index.d.ts +6 -6
- package/dist/logs/index.js +1 -1
- package/dist/payments/index.d.ts +7 -7
- package/dist/payments/index.js +2 -2
- package/dist/pdf/index.d.ts +12 -20
- package/dist/pdf/index.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/realtime/index.d.ts +5 -5
- package/dist/realtime/index.js +1 -1
- package/dist/scan/index.d.ts +10 -18
- package/dist/scan/index.js +1 -1
- package/dist/seo/index.d.ts +5 -5
- package/dist/seo/index.js +1 -1
- package/dist/speech/index.d.ts +6 -9
- package/dist/speech/index.js +1 -1
- package/dist/vectors/index.d.ts +13 -31
- package/dist/web/index.d.ts +15 -30
- package/dist/web/index.js +1 -1
- package/dist/webhooks/index.d.ts +33 -8
- package/dist/webhooks/index.js +4 -4
- package/package.json +1 -1
- package/totalum-sdk.md +54 -54
- package/totalum-sdk.signatures.json +5 -5
- package/dist/_types/billing.d-Bl2JQGMY.d.ts +0 -42
package/totalum-sdk.md
CHANGED
|
@@ -21,7 +21,7 @@ same environment at call time, never at import; an option of the same name wins:
|
|
|
21
21
|
| `TOTALUM_SDK_API_URL` | `apiUrl` | Default `https://sdk-api.totalum.app`. |
|
|
22
22
|
| `TOTALUM_ENV` | `env` | `dev` or `live` (default), sent as `x-totalum-env`: the database `totalum-sdk/d1` targets over HTTPS, and dev vs live usage. |
|
|
23
23
|
| `TOTALUM_FILES_URL` | `filesUrl` | The public files host of `files.url()`. |
|
|
24
|
-
| `TOTALUM_AI_BASE_URL` | `aiBaseUrl` | The
|
|
24
|
+
| `TOTALUM_AI_BASE_URL` | `aiBaseUrl` | The OpenAI-compatible AI gateway `ai.gatewayConfig()` returns. |
|
|
25
25
|
| `TOTALUM_APP_KEY` | `key` | Set by Totalum in the sandbox only: the deployed app's own key, used before `TOTALUM_PROJECT_KEY` by every namespace but the database, so the agent's checks have the app's permissions. |
|
|
26
26
|
| `TOTALUM_WEBHOOK_SECRET` | argument | The secret `webhooks.verify` checks `Totalum-Signature` with. Totalum sets it on the preview, the published site and the sandbox, and a rotation reaches them at once: never set it yourself. |
|
|
27
27
|
|
|
@@ -36,7 +36,7 @@ Every failure throws `TotalumError` (`isTotalumError(e)`) with `errorCode` (froz
|
|
|
36
36
|
`requestId`; `TotalumD1Error` (`message` shaped like a native D1 error) and `TotalumWebhookError` extend it. A capped
|
|
37
37
|
or disabled feature (`FEATURE_LIMIT_REACHED` 429, `FEATURE_DISABLED` 403) refuses only its own namespace; at a zero
|
|
38
38
|
balance paid calls answer `INSUFFICIENT_CREDITS` 402. A project makes at most 100 built-in calls per second (AI, e-mail,
|
|
39
|
-
file uploads, web, scan, PDF, speech, vectors, browser, realtime, payments): above it
|
|
39
|
+
file uploads, web, scan, PDF, speech, vectors, browser, realtime, payments): above it the Totalum API answers `RATE_LIMITED` 429 with
|
|
40
40
|
`Retry-After`, which the SDK retries twice (with jitter) before throwing — handle it, and never fan out hundreds of calls
|
|
41
41
|
at once (batch, queue or `await` them in small groups).
|
|
42
42
|
|
|
@@ -100,7 +100,7 @@ totalumD1(options?: TotalumD1Options): D1Database
|
|
|
100
100
|
|
|
101
101
|
A `D1Database` for the project's own database wherever the code runs: the bound
|
|
102
102
|
`TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, the local D1 that
|
|
103
|
-
`initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to
|
|
103
|
+
`initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to the Totalum API everywhere else.
|
|
104
104
|
Detection happens on the first statement, never at call time.
|
|
105
105
|
|
|
106
106
|
## `totalum-sdk/files`
|
|
@@ -111,9 +111,9 @@ Detection happens on the first statement, never at call time.
|
|
|
111
111
|
totalumFiles(options?: TotalumFilesOptions)
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
`totalum.files` over HTTPS with the project key. Every call returns the file
|
|
114
|
+
`totalum.files` (the Totalum API ) over HTTPS with the project key. Every call returns the file
|
|
115
115
|
descriptor `{key, fileName, fileSize, contentType, fileUrl, visibility, createdAt}` meant to be stored as-is in the
|
|
116
|
-
row's file column; failures throw `TotalumError` with
|
|
116
|
+
row's file column; failures throw `TotalumError` with the Totalum API's frozen code.
|
|
117
117
|
|
|
118
118
|
#### `files.upload`
|
|
119
119
|
|
|
@@ -121,7 +121,7 @@ row's file column; failures throw `TotalumError` with SDK-API's frozen code.
|
|
|
121
121
|
files.upload(input: string | Blob | ArrayBuffer | Uint8Array<ArrayBufferLike>, opts?: UploadOptions): Promise<{ key: string; fileName: string; fileSize: number; contentType: string; fileUrl: string | null; visibility: 'public-by-link' | 'private'; createdAt: string; etag?: string | undefined; storageClass?: 'Standard' | 'InfrequentAccess' | undefined; name?: string | undefined; url?: string | null | undefined; size?: number | undefined; id?: string | undefined; fileNameId?: string | undefined; }>
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
Up to 25 MB through
|
|
124
|
+
Up to 25 MB through the Totalum API; larger files go through `getUploadUrl` + `complete`.
|
|
125
125
|
|
|
126
126
|
#### `files.getUploadUrl`
|
|
127
127
|
|
|
@@ -204,7 +204,7 @@ The object itself (private files included), with `Range` support; errors throw l
|
|
|
204
204
|
files.url(key: string): string
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
Sync, no I/O: the public URL of a `p/` key, or the authenticated
|
|
207
|
+
Sync, no I/O: the public URL of a `p/` key, or the authenticated the Totalum API URL of a private `pv/` key.
|
|
208
208
|
|
|
209
209
|
## `totalum-sdk/payments`
|
|
210
210
|
|
|
@@ -214,9 +214,9 @@ Sync, no I/O: the public URL of a `p/` key, or the authenticated SDK-API URL of
|
|
|
214
214
|
totalumPayments(options?: TotalumClientOptions)
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
`totalum.payments` over
|
|
217
|
+
`totalum.payments` over the Totalum API `/v1/payments/*` with a project key (scope `payments`): Stripe
|
|
218
218
|
Connect direct charges on the project's own connected account. Card data never passes through here — send buyers to
|
|
219
|
-
the hosted Checkout `url` (SAQ-A);
|
|
219
|
+
the hosted Checkout `url` (SAQ-A); the Totalum API refuses card fields with `CARD_DATA_NOT_ACCEPTED`. Stripe test mode on the
|
|
220
220
|
preview and in the sandbox; live mode only on the published site, once the owner onboarded and switched live on.
|
|
221
221
|
|
|
222
222
|
#### `payments.getStatus`
|
|
@@ -318,7 +318,7 @@ const event = await verifyWebhook(await request.text(), request.headers);
|
|
|
318
318
|
totalumWebhooks(options?: TotalumClientOptions)
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
-
`totalum.webhooks` over
|
|
321
|
+
`totalum.webhooks` over the Totalum API `/v1/webhooks` (a key with scope `*`): where the project receives its
|
|
322
322
|
signed events (payments, e-mail, browser programs, `project.credits.exhausted`) and the secret they are signed with.
|
|
323
323
|
|
|
324
324
|
#### `webhooks.verify`
|
|
@@ -361,13 +361,13 @@ A new signing secret, shown once; the old one keeps co-signing for 24 h. Totalum
|
|
|
361
361
|
totalumWeb(options?: TotalumClientOptions)
|
|
362
362
|
```
|
|
363
363
|
|
|
364
|
-
`totalum.web` over
|
|
364
|
+
`totalum.web` over the Totalum API `/v1/web/*` (scope `web`): scrape, search, map, crawl and screenshots,
|
|
365
365
|
billed in credits — every result carries `usage.credits`.
|
|
366
366
|
|
|
367
367
|
#### `web.scrape`
|
|
368
368
|
|
|
369
369
|
```ts
|
|
370
|
-
web.scrape(url: string, opts?: Omit<{ url: string; formats?: ('screenshot' | 'markdown' | 'html' | 'rawHtml' | 'links' | 'json' | 'summary')[] | undefined; onlyMainContent?: boolean | undefined; waitFor?: number | undefined; timeout?: number | undefined; proxy?: 'basic' | 'stealth' | 'auto' | undefined; location?: { country?: string | undefined; languages?: string[] | undefined; } | undefined; actions?: Record<string, unknown>[] | undefined; schema?: Record<string, unknown> | undefined; prompt?: string | undefined; cacheMaxAgeMs?: number | undefined; }, 'url'>): Promise<{ url: string; statusCode: number; metadata: { sourceURL: string; title?: string | undefined; description?: string | undefined; language?: string | undefined; }; usage: { credits: number;
|
|
370
|
+
web.scrape(url: string, opts?: Omit<{ url: string; formats?: ('screenshot' | 'markdown' | 'html' | 'rawHtml' | 'links' | 'json' | 'summary')[] | undefined; onlyMainContent?: boolean | undefined; waitFor?: number | undefined; timeout?: number | undefined; proxy?: 'basic' | 'stealth' | 'auto' | undefined; location?: { country?: string | undefined; languages?: string[] | undefined; } | undefined; actions?: Record<string, unknown>[] | undefined; schema?: Record<string, unknown> | undefined; prompt?: string | undefined; cacheMaxAgeMs?: number | undefined; }, 'url'>): Promise<{ url: string; statusCode: number; metadata: { sourceURL: string; title?: string | undefined; description?: string | undefined; language?: string | undefined; }; usage: { credits: number; }; markdown?: string | undefined; html?: string | undefined; rawHtml?: string | undefined; links?: string[] | undefined; screenshotUrl?: string | undefined; json?: unknown; summary?: string | undefined; contentUrl?: string | undefined; }>
|
|
371
371
|
```
|
|
372
372
|
|
|
373
373
|
One page as `markdown`, `html`, `links`, ….
|
|
@@ -379,7 +379,7 @@ const { markdown } = await web.scrape('https://example.com', { formats: ['markdo
|
|
|
379
379
|
#### `web.search`
|
|
380
380
|
|
|
381
381
|
```ts
|
|
382
|
-
web.search(query: string, opts?: Omit<{ query: string; limit?: number | undefined; sources?: ('web' | 'news' | 'images')[] | undefined; location?: { country?: string | undefined; city?: string | undefined; } | undefined; timeRange?: 'day' | 'month' | 'week' | 'year' | undefined; scrapeOptions?: { formats?: ('screenshot' | 'markdown' | 'html' | 'rawHtml' | 'links' | 'json' | 'summary')[] | undefined; onlyMainContent?: boolean | undefined; waitFor?: number | undefined; timeout?: number | undefined; proxy?: 'basic' | 'stealth' | 'auto' | undefined; location?: { country?: string | undefined; languages?: string[] | undefined; } | undefined; actions?: Record<string, unknown>[] | undefined; schema?: Record<string, unknown> | undefined; prompt?: string | undefined; cacheMaxAgeMs?: number | undefined; } | undefined; }, 'query'>): Promise<{ web: { title: string; url: string; position: number; snippet?: string | undefined; }[]; news?: { title: string; url: string; position: number; snippet?: string | undefined; }[] | undefined; images?: Record<string, unknown>[] | undefined; scraped?: { url: string; statusCode: number; metadata: { sourceURL: string; title?: string | undefined; description?: string | undefined; language?: string | undefined; }; markdown?: string | undefined; html?: string | undefined; rawHtml?: string | undefined; links?: string[] | undefined; screenshotUrl?: string | undefined; json?: unknown; summary?: string | undefined; contentUrl?: string | undefined; }[] | undefined; } & { usage:
|
|
382
|
+
web.search(query: string, opts?: Omit<{ query: string; limit?: number | undefined; sources?: ('web' | 'news' | 'images')[] | undefined; location?: { country?: string | undefined; city?: string | undefined; } | undefined; timeRange?: 'day' | 'month' | 'week' | 'year' | undefined; scrapeOptions?: { formats?: ('screenshot' | 'markdown' | 'html' | 'rawHtml' | 'links' | 'json' | 'summary')[] | undefined; onlyMainContent?: boolean | undefined; waitFor?: number | undefined; timeout?: number | undefined; proxy?: 'basic' | 'stealth' | 'auto' | undefined; location?: { country?: string | undefined; languages?: string[] | undefined; } | undefined; actions?: Record<string, unknown>[] | undefined; schema?: Record<string, unknown> | undefined; prompt?: string | undefined; cacheMaxAgeMs?: number | undefined; } | undefined; }, 'query'>): Promise<Omit<{ web: { title: string; url: string; position: number; snippet?: string | undefined; }[]; news?: { title: string; url: string; position: number; snippet?: string | undefined; }[] | undefined; images?: Record<string, unknown>[] | undefined; scraped?: { url: string; statusCode: number; metadata: { sourceURL: string; title?: string | undefined; description?: string | undefined; language?: string | undefined; }; markdown?: string | undefined; html?: string | undefined; rawHtml?: string | undefined; links?: string[] | undefined; screenshotUrl?: string | undefined; json?: unknown; summary?: string | undefined; contentUrl?: string | undefined; }[] | undefined; }, 'usage'> & { usage: Usage; }>
|
|
383
383
|
```
|
|
384
384
|
|
|
385
385
|
A web search; with `scrapeOptions` each result also carries its page content.
|
|
@@ -387,7 +387,7 @@ A web search; with `scrapeOptions` each result also carries its page content.
|
|
|
387
387
|
#### `web.map`
|
|
388
388
|
|
|
389
389
|
```ts
|
|
390
|
-
web.map(url: string, opts?: Omit<{ url: string; search?: string | undefined; limit?: number | undefined; }, 'url'>): Promise<{ links: string[]; } & { usage:
|
|
390
|
+
web.map(url: string, opts?: Omit<{ url: string; search?: string | undefined; limit?: number | undefined; }, 'url'>): Promise<Omit<{ links: string[]; }, 'usage'> & { usage: Usage; }>
|
|
391
391
|
```
|
|
392
392
|
|
|
393
393
|
The URLs of a site (sitemap and links), without fetching the pages.
|
|
@@ -419,7 +419,7 @@ Stops a running crawl; pages already crawled are charged.
|
|
|
419
419
|
#### `web.screenshot`
|
|
420
420
|
|
|
421
421
|
```ts
|
|
422
|
-
web.screenshot(input: { url?: string | undefined; html?: string | undefined; fullPage?: boolean | undefined; viewport?: { width: number; height: number; } | undefined; format?: 'png' | 'jpeg' | 'webp' | undefined; waitForSelector?: string | undefined; inline?: boolean | undefined; }): Promise<{ key: string; url: string; format: 'png' | 'jpeg' | 'webp'; base64?: string | undefined; } & { usage:
|
|
422
|
+
web.screenshot(input: { url?: string | undefined; html?: string | undefined; fullPage?: boolean | undefined; viewport?: { width: number; height: number; } | undefined; format?: 'png' | 'jpeg' | 'webp' | undefined; waitForSelector?: string | undefined; inline?: boolean | undefined; }): Promise<Omit<{ key: string; url: string; format: 'png' | 'jpeg' | 'webp'; base64?: string | undefined; }, 'usage'> & { usage: Usage; }>
|
|
423
423
|
```
|
|
424
424
|
|
|
425
425
|
A screenshot of a `url` or of inline `html`, stored as a project file (`key`, `url`).
|
|
@@ -437,7 +437,7 @@ totalumPdf(options?: TotalumClientOptions)
|
|
|
437
437
|
#### `pdf.fromHtml`
|
|
438
438
|
|
|
439
439
|
```ts
|
|
440
|
-
pdf.fromHtml(input: { name: string; html?: string | undefined; base64HtmlString?: string | undefined; options?: { format?: string | undefined; landscape?: boolean | undefined; margin?: Record<string, string> | undefined; printBackground?: boolean | undefined; headerTemplate?: string | undefined; footerTemplate?: string | undefined; displayHeaderFooter?: boolean | undefined; } | undefined; waitForSelector?: string | undefined; }): Promise<{ url: string; fileName: string; key: string; } & { usage:
|
|
440
|
+
pdf.fromHtml(input: { name: string; html?: string | undefined; base64HtmlString?: string | undefined; options?: { format?: string | undefined; landscape?: boolean | undefined; margin?: Record<string, string> | undefined; printBackground?: boolean | undefined; headerTemplate?: string | undefined; footerTemplate?: string | undefined; displayHeaderFooter?: boolean | undefined; } | undefined; waitForSelector?: string | undefined; }): Promise<Omit<{ url: string; fileName: string; key: string; }, 'usage'> & { usage: Usage; }>
|
|
441
441
|
```
|
|
442
442
|
|
|
443
443
|
A PDF rendered from HTML, stored as a project file (`key`, `url`).
|
|
@@ -449,7 +449,7 @@ const { url } = await pdf.fromHtml({ html: '<h1>Invoice 12</h1>', name: 'invoice
|
|
|
449
449
|
#### `pdf.fromUrl`
|
|
450
450
|
|
|
451
451
|
```ts
|
|
452
|
-
pdf.fromUrl(input: { url: string; name: string; options?: { format?: string | undefined; landscape?: boolean | undefined; margin?: Record<string, string> | undefined; printBackground?: boolean | undefined; headerTemplate?: string | undefined; footerTemplate?: string | undefined; displayHeaderFooter?: boolean | undefined; } | undefined; cookies?: Record<string, unknown>[] | undefined; headers?: Record<string, string> | undefined; }): Promise<{ url: string; fileName: string; key: string; } & { usage:
|
|
452
|
+
pdf.fromUrl(input: { url: string; name: string; options?: { format?: string | undefined; landscape?: boolean | undefined; margin?: Record<string, string> | undefined; printBackground?: boolean | undefined; headerTemplate?: string | undefined; footerTemplate?: string | undefined; displayHeaderFooter?: boolean | undefined; } | undefined; cookies?: Record<string, unknown>[] | undefined; headers?: Record<string, string> | undefined; }): Promise<Omit<{ url: string; fileName: string; key: string; }, 'usage'> & { usage: Usage; }>
|
|
453
453
|
```
|
|
454
454
|
|
|
455
455
|
A PDF of a web page, stored as a project file.
|
|
@@ -475,7 +475,7 @@ Extracts the fields described by `properties` from a document or image (one set
|
|
|
475
475
|
#### `scan.ocr`
|
|
476
476
|
|
|
477
477
|
```ts
|
|
478
|
-
scan.ocr(input: { pages?: number[] | undefined; fileName?: string | undefined; key?: string | undefined; url?: string | undefined; }): Promise<{ text: string; pages: { markdown: string; width: number; height: number; words?: { text: string; bbox: number[]; }[] | undefined; }[]; fullDetails?: unknown; } & { usage:
|
|
478
|
+
scan.ocr(input: { pages?: number[] | undefined; fileName?: string | undefined; key?: string | undefined; url?: string | undefined; }): Promise<Omit<{ text: string; pages: { markdown: string; width: number; height: number; words?: { text: string; bbox: number[]; }[] | undefined; }[]; fullDetails?: unknown; }, 'usage'> & { usage: Usage; }>
|
|
479
479
|
```
|
|
480
480
|
|
|
481
481
|
The text of a document or image, per page as Markdown.
|
|
@@ -498,7 +498,7 @@ metadata keys `source`, `type`, `tag`, `group` (strings) and `page` (number).
|
|
|
498
498
|
#### `vectors.upsert`
|
|
499
499
|
|
|
500
500
|
```ts
|
|
501
|
-
vectors.upsert(vectors: { id: string; values?: number[] | undefined; text?: string | undefined; image?: string | undefined; space?: 'text' | 'image' | undefined; metadata?: Record<string, string | number | boolean | string[]> | undefined; }[]): Promise<Omit<{ upserted: number; count: number; usage: { credits: number;
|
|
501
|
+
vectors.upsert(vectors: { id: string; values?: number[] | undefined; text?: string | undefined; image?: string | undefined; space?: 'text' | 'image' | undefined; metadata?: Record<string, string | number | boolean | string[]> | undefined; }[]): Promise<Omit<Omit<{ upserted: number; count: number; usage: { credits: number; }; }, 'usage'>, 'usage'> & { usage: Usage; }>
|
|
502
502
|
```
|
|
503
503
|
|
|
504
504
|
Inserts or replaces up to 100 vectors (≤ 8 images) from `values`, `text` or `image`, with optional metadata.
|
|
@@ -508,7 +508,7 @@ minutes (the index applies writes asynchronously). Never wait or poll for a writ
|
|
|
508
508
|
#### `vectors.query`
|
|
509
509
|
|
|
510
510
|
```ts
|
|
511
|
-
vectors.query(input: { text?: string | undefined; values?: number[] | undefined; image?: string | undefined; space?: 'text' | 'image' | undefined; topK?: number | undefined; filter?: Partial<Record<'type' | 'source' | 'page' | 'tag' | 'group', string | number | boolean | { $eq?: string | number | boolean | undefined; $ne?: string | number | boolean | undefined; $in?: (string | number | boolean)[] | undefined; $nin?: (string | number | boolean)[] | undefined; $lt?: string | number | undefined; $lte?: string | number | undefined; $gt?: string | number | undefined; $gte?: string | number | undefined; }>> | undefined; includeValues?: boolean | undefined; }): Promise<{ matches: { id: string; score: number; space: 'text' | 'image'; metadata?: Record<string, string | number | boolean | string[]> | undefined; values?: number[] | undefined; }[]; } & { usage:
|
|
511
|
+
vectors.query(input: { text?: string | undefined; values?: number[] | undefined; image?: string | undefined; space?: 'text' | 'image' | undefined; topK?: number | undefined; filter?: Partial<Record<'type' | 'source' | 'page' | 'tag' | 'group', string | number | boolean | { $eq?: string | number | boolean | undefined; $ne?: string | number | boolean | undefined; $in?: (string | number | boolean)[] | undefined; $nin?: (string | number | boolean)[] | undefined; $lt?: string | number | undefined; $lte?: string | number | undefined; $gt?: string | number | undefined; $gte?: string | number | undefined; }>> | undefined; includeValues?: boolean | undefined; }): Promise<Omit<{ matches: { id: string; score: number; space: 'text' | 'image'; metadata?: Record<string, string | number | boolean | string[]> | undefined; values?: number[] | undefined; }[]; }, 'usage'> & { usage: Usage; }>
|
|
512
512
|
```
|
|
513
513
|
|
|
514
514
|
The `topK` (≤ 50, default 5) closest vectors to `text`, `values` or `image`, with their metadata.
|
|
@@ -524,7 +524,7 @@ The stored vectors (values and metadata) of up to 100 ids; unknown and just-writ
|
|
|
524
524
|
#### `vectors.delete`
|
|
525
525
|
|
|
526
526
|
```ts
|
|
527
|
-
vectors.delete(ids: string[]): Promise<Omit<{ deleted: number; count: number; usage: { credits: number;
|
|
527
|
+
vectors.delete(ids: string[]): Promise<Omit<Omit<{ deleted: number; count: number; usage: { credits: number; }; }, 'usage'>, 'usage'> & { usage: Usage; }>
|
|
528
528
|
```
|
|
529
529
|
|
|
530
530
|
Deletes up to 1,000 ids; answers how many existed and how many are left.
|
|
@@ -550,7 +550,7 @@ totalumSpeech(options?: TotalumClientOptions)
|
|
|
550
550
|
#### `speech.transcribe`
|
|
551
551
|
|
|
552
552
|
```ts
|
|
553
|
-
speech.transcribe(input: { audioBase64?: string | undefined; filename?: string | undefined; url?: string | undefined; language?: string | undefined; model?: 'fast' | 'accurate' | undefined; diarize?: boolean | undefined; timestamps?: 'word' | 'segment' | undefined; keyterms?: string[] | undefined; }): Promise<{ text: string; durationSec: number; usage: { credits: number;
|
|
553
|
+
speech.transcribe(input: { audioBase64?: string | undefined; filename?: string | undefined; url?: string | undefined; language?: string | undefined; model?: 'fast' | 'accurate' | undefined; diarize?: boolean | undefined; timestamps?: 'word' | 'segment' | undefined; keyterms?: string[] | undefined; }): Promise<{ text: string; durationSec: number; usage: { credits: number; }; language?: string | undefined; segments?: { start: number; end: number; text: string; }[] | undefined; words?: { word: string; start: number; end: number; }[] | undefined; }>
|
|
554
554
|
```
|
|
555
555
|
|
|
556
556
|
Speech to text from `audioBase64` (+ `filename` with its extension) or a `url` — a public one, or a file this
|
|
@@ -559,8 +559,8 @@ project stored; optional language, word timestamps and speakers.
|
|
|
559
559
|
#### `speech.synthesize`
|
|
560
560
|
|
|
561
561
|
```ts
|
|
562
|
-
speech.synthesize(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; } & { store: true; }): Promise<{ key: string; url: string; usage: { credits: number;
|
|
563
|
-
speech.synthesize(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; }): Promise<{ key: string; url: string; usage: { credits: number;
|
|
562
|
+
speech.synthesize(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; } & { store: true; }): Promise<{ key: string; url: string; usage: { credits: number; }; }>
|
|
563
|
+
speech.synthesize(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; }): Promise<{ key: string; url: string; usage: { credits: number; }; } | SpeechAudio>
|
|
564
564
|
```
|
|
565
565
|
|
|
566
566
|
The stored file `{key, url, usage}` with `store: true`; else the audio bytes `{audio, contentType, usage}`.
|
|
@@ -573,10 +573,10 @@ The stored file `{key, url, usage}` with `store: true`; else the audio bytes `{a
|
|
|
573
573
|
totalumAi(options?: TotalumAiOptions)
|
|
574
574
|
```
|
|
575
575
|
|
|
576
|
-
`totalum.ai` over
|
|
576
|
+
`totalum.ai` over the Totalum API `/v1/ai/*` (scope `ai`): a `model` is a preset (`fast`,
|
|
577
577
|
`smart`, `reasoning`, `vision`, `image`, `image-edit`, `video`, `tts`, `stt`, `embed` — each follows the newest model
|
|
578
|
-
of its family, resolved by Totalum) or a pinned
|
|
579
|
-
charged (`usage.credits`, never tokens
|
|
578
|
+
of its family, resolved by Totalum) or a pinned model id; every call returned with the Totalum credits it was
|
|
579
|
+
charged (`usage.credits`, never tokens). No `ai.agent()` — the
|
|
580
580
|
agent loop is the template's `src/agents/` on the Vercel AI SDK, pointed at `gatewayConfig()`.
|
|
581
581
|
|
|
582
582
|
#### `ai.chat`
|
|
@@ -585,7 +585,7 @@ agent loop is the template's `src/agents/` on the Vercel AI SDK, pointed at `gat
|
|
|
585
585
|
ai.chat(req: Omit<{ messages: { [x: string]: unknown; role: 'user' | 'system' | 'assistant' | 'tool' | 'developer'; content: unknown; }[]; model?: string | undefined; tools?: Record<string, unknown>[] | undefined; toolChoice?: unknown; parallelToolCalls?: boolean | undefined; responseFormat?: Record<string, unknown> | undefined; temperature?: number | undefined; maxTokens?: number | undefined; reasoning?: { effort: string; } | undefined; serverTools?: ('web_search' | 'image_generation' | 'web_fetch' | 'datetime')[] | undefined; maxToolCalls?: number | undefined; stream?: boolean | undefined; cache?: { ttlSec: number; } | undefined; zdr?: boolean | undefined; fastMode?: boolean | undefined; user?: string | undefined; }, 'stream'>): Promise<ChatResult>
|
|
586
586
|
```
|
|
587
587
|
|
|
588
|
-
A chat completion; `model` is a preset (`fast`, `smart` — the default — or `reasoning`) or a pinned
|
|
588
|
+
A chat completion; `model` is a preset (`fast`, `smart` — the default — or `reasoning`) or a pinned model id.
|
|
589
589
|
|
|
590
590
|
```ts
|
|
591
591
|
const { text } = await ai.chat({ model: 'fast', messages: [{ role: 'user', content: 'Hi' }] });
|
|
@@ -603,7 +603,7 @@ The same request streamed: `raw` is the OpenAI-format SSE (return it from a rout
|
|
|
603
603
|
#### `ai.generateObject`
|
|
604
604
|
|
|
605
605
|
```ts
|
|
606
|
-
ai.generateObject(req: { schema: Record<string, unknown>; prompt?: string | undefined; messages?: { [x: string]: unknown; role: 'user' | 'system' | 'assistant' | 'tool' | 'developer'; content: unknown; }[] | undefined; model?: string | undefined; healing?: boolean | undefined; }): Promise<{ object: unknown; usage:
|
|
606
|
+
ai.generateObject(req: { schema: Record<string, unknown>; prompt?: string | undefined; messages?: { [x: string]: unknown; role: 'user' | 'system' | 'assistant' | 'tool' | 'developer'; content: unknown; }[] | undefined; model?: string | undefined; healing?: boolean | undefined; }): Promise<{ object: unknown; usage: Usage; }>
|
|
607
607
|
```
|
|
608
608
|
|
|
609
609
|
A JSON object matching `schema` (JSON Schema).
|
|
@@ -619,7 +619,7 @@ Sugar over `generateObject`: one of `options`, chosen by the model.
|
|
|
619
619
|
#### `ai.embed`
|
|
620
620
|
|
|
621
621
|
```ts
|
|
622
|
-
ai.embed(req: { input: string | string[]; model?: string | undefined; }): Promise<{ embeddings: number[][]; usage: { credits: number;
|
|
622
|
+
ai.embed(req: { input: string | string[]; model?: string | undefined; }): Promise<{ embeddings: number[][]; usage: { credits: number; }; }>
|
|
623
623
|
```
|
|
624
624
|
|
|
625
625
|
Embedding vectors for one or more texts.
|
|
@@ -627,7 +627,7 @@ Embedding vectors for one or more texts.
|
|
|
627
627
|
#### `ai.image.generate`
|
|
628
628
|
|
|
629
629
|
```ts
|
|
630
|
-
ai.image.generate(req: { prompt: string; model?: string | undefined; aspectRatio?: string | undefined; resolution?: '1K' | '2K' | '4K' | '512' | undefined; quality?: string | undefined; outputFormat?: 'png' | 'jpeg' | 'webp' | undefined; background?: string | undefined; n?: number | undefined; references?: string[] | undefined; fileName?: string | undefined; store?: boolean | undefined; }): Promise<{ images: { key: string; url: string; mediaType: string; width?: number | undefined; height?: number | undefined; }[]; usage: { credits: number;
|
|
630
|
+
ai.image.generate(req: { prompt: string; model?: string | undefined; aspectRatio?: string | undefined; resolution?: '1K' | '2K' | '4K' | '512' | undefined; quality?: string | undefined; outputFormat?: 'png' | 'jpeg' | 'webp' | undefined; background?: string | undefined; n?: number | undefined; references?: string[] | undefined; fileName?: string | undefined; store?: boolean | undefined; }): Promise<{ images: { key: string; url: string; mediaType: string; width?: number | undefined; height?: number | undefined; }[]; usage: { credits: number; }; fileName?: string | undefined; imageUrl?: string | undefined; }>
|
|
631
631
|
```
|
|
632
632
|
|
|
633
633
|
Images from a prompt; `store: true` keeps them as project files.
|
|
@@ -635,7 +635,7 @@ Images from a prompt; `store: true` keeps them as project files.
|
|
|
635
635
|
#### `ai.image.edit`
|
|
636
636
|
|
|
637
637
|
```ts
|
|
638
|
-
ai.image.edit(req: { prompt: string; images: string[]; mask?: string | undefined; fileName?: string | undefined; size?: string | undefined; quality?: string | undefined; outputFormat?: 'png' | 'jpeg' | 'webp' | undefined; background?: string | undefined; inputFidelity?: string | undefined; }): Promise<{ images: { key: string; url: string; mediaType: string; width?: number | undefined; height?: number | undefined; }[]; usage: { credits: number;
|
|
638
|
+
ai.image.edit(req: { prompt: string; images: string[]; mask?: string | undefined; fileName?: string | undefined; size?: string | undefined; quality?: string | undefined; outputFormat?: 'png' | 'jpeg' | 'webp' | undefined; background?: string | undefined; inputFidelity?: string | undefined; }): Promise<{ images: { key: string; url: string; mediaType: string; width?: number | undefined; height?: number | undefined; }[]; usage: { credits: number; }; fileName?: string | undefined; imageUrl?: string | undefined; }>
|
|
639
639
|
```
|
|
640
640
|
|
|
641
641
|
An image edited by a prompt.
|
|
@@ -651,7 +651,7 @@ ai.video.generate(req: { prompt: string; durationSec: number; model?: string | u
|
|
|
651
651
|
#### `ai.video.get`
|
|
652
652
|
|
|
653
653
|
```ts
|
|
654
|
-
ai.video.get(jobId: string): Promise<{ jobId: string; status: 'expired' | 'completed' | 'queued' | 'running' | 'failed' | 'cancelled'; progress?: number | undefined; video?: { key: string; url: string; } | undefined; usage?: { credits: number;
|
|
654
|
+
ai.video.get(jobId: string): Promise<{ jobId: string; status: 'expired' | 'completed' | 'queued' | 'running' | 'failed' | 'cancelled'; progress?: number | undefined; video?: { key: string; url: string; } | undefined; usage?: { credits: number; } | undefined; error?: { code: string; message: string; } | undefined; }>
|
|
655
655
|
```
|
|
656
656
|
|
|
657
657
|
The video job: `status`, and the stored clip once completed.
|
|
@@ -659,7 +659,7 @@ The video job: `status`, and the stored clip once completed.
|
|
|
659
659
|
#### `ai.video.wait`
|
|
660
660
|
|
|
661
661
|
```ts
|
|
662
|
-
ai.video.wait(jobId: string, opts?: { intervalMs?: number | undefined; timeoutMs?: number | undefined; }): Promise<{ jobId: string; status: 'expired' | 'completed' | 'queued' | 'running' | 'failed' | 'cancelled'; progress?: number | undefined; video?: { key: string; url: string; } | undefined; usage?: { credits: number;
|
|
662
|
+
ai.video.wait(jobId: string, opts?: { intervalMs?: number | undefined; timeoutMs?: number | undefined; }): Promise<{ jobId: string; status: 'expired' | 'completed' | 'queued' | 'running' | 'failed' | 'cancelled'; progress?: number | undefined; video?: { key: string; url: string; } | undefined; usage?: { credits: number; } | undefined; error?: { code: string; message: string; } | undefined; }>
|
|
663
663
|
```
|
|
664
664
|
|
|
665
665
|
⚠ NODE-ONLY: polls `get(jobId)` until the job leaves `queued`/`running` (default every 5 s, at most 45 min —
|
|
@@ -669,7 +669,7 @@ In a Worker it throws `NODE_ONLY` — store the `jobId` and read `get(jobId)` la
|
|
|
669
669
|
#### `ai.vision.describe`
|
|
670
670
|
|
|
671
671
|
```ts
|
|
672
|
-
ai.vision.describe(req: { image: string; prompt?: string | undefined; model?: string | undefined; }): Promise<{ text: string; usage: { credits: number;
|
|
672
|
+
ai.vision.describe(req: { image: string; prompt?: string | undefined; model?: string | undefined; }): Promise<{ text: string; usage: { credits: number; }; }>
|
|
673
673
|
```
|
|
674
674
|
|
|
675
675
|
A text description of an image (URL, data URL or project file key).
|
|
@@ -677,8 +677,8 @@ A text description of an image (URL, data URL or project file key).
|
|
|
677
677
|
#### `ai.speech.speak`
|
|
678
678
|
|
|
679
679
|
```ts
|
|
680
|
-
ai.speech.speak(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; } & { store: true; }): Promise<{ key: string; url: string; usage: { credits: number;
|
|
681
|
-
ai.speech.speak(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; }): Promise<{ key: string; url: string; usage: { credits: number;
|
|
680
|
+
ai.speech.speak(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; } & { store: true; }): Promise<{ key: string; url: string; usage: { credits: number; }; }>
|
|
681
|
+
ai.speech.speak(input: { text: string; voice?: string | undefined; language?: string | undefined; model?: 'standard' | 'premium' | undefined; format?: 'mp3' | 'wav' | 'opus' | undefined; speed?: number | undefined; store?: boolean | undefined; }): Promise<{ key: string; url: string; usage: { credits: number; }; } | SpeechAudio>
|
|
682
682
|
```
|
|
683
683
|
|
|
684
684
|
**Deprecated.** Since 1.0.0: use `totalum.speech.synthesize` (the same call).
|
|
@@ -686,7 +686,7 @@ ai.speech.speak(input: { text: string; voice?: string | undefined; language?: st
|
|
|
686
686
|
#### `ai.speech.transcribe`
|
|
687
687
|
|
|
688
688
|
```ts
|
|
689
|
-
ai.speech.transcribe(input: { audioBase64?: string | undefined; filename?: string | undefined; url?: string | undefined; language?: string | undefined; model?: 'fast' | 'accurate' | undefined; diarize?: boolean | undefined; timestamps?: 'word' | 'segment' | undefined; keyterms?: string[] | undefined; }): Promise<{ text: string; durationSec: number; usage: { credits: number;
|
|
689
|
+
ai.speech.transcribe(input: { audioBase64?: string | undefined; filename?: string | undefined; url?: string | undefined; language?: string | undefined; model?: 'fast' | 'accurate' | undefined; diarize?: boolean | undefined; timestamps?: 'word' | 'segment' | undefined; keyterms?: string[] | undefined; }): Promise<{ text: string; durationSec: number; usage: { credits: number; }; language?: string | undefined; segments?: { start: number; end: number; text: string; }[] | undefined; words?: { word: string; start: number; end: number; }[] | undefined; }>
|
|
690
690
|
```
|
|
691
691
|
|
|
692
692
|
**Deprecated.** Since 1.0.0: use `totalum.speech.transcribe` (the same call).
|
|
@@ -705,7 +705,7 @@ Each preset's current model and the models a project may call, with their prices
|
|
|
705
705
|
ai.gatewayConfig(): { baseURL: string; apiKey: string; }
|
|
706
706
|
```
|
|
707
707
|
|
|
708
|
-
The
|
|
708
|
+
The OpenAI-compatible API for any OpenAI-compatible client: `new OpenAI(ai.gatewayConfig())`. Server-side only.
|
|
709
709
|
|
|
710
710
|
## `totalum-sdk/email`
|
|
711
711
|
|
|
@@ -715,13 +715,13 @@ The exact OpenRouter API for any OpenRouter/OpenAI client: `new OpenAI(ai.gatewa
|
|
|
715
715
|
totalumEmail(options?: TotalumClientOptions)
|
|
716
716
|
```
|
|
717
717
|
|
|
718
|
-
`totalum.email` over
|
|
718
|
+
`totalum.email` over the Totalum API `/v1/email/*` (scope `email`): HTML sent byte for byte, charged
|
|
719
719
|
per recipient. On dev only allow-listed recipients are accepted (`DEV_RECIPIENT_NOT_ALLOWED`).
|
|
720
720
|
|
|
721
721
|
#### `email.send`
|
|
722
722
|
|
|
723
723
|
```ts
|
|
724
|
-
email.send(msg: { to: string | string[]; subject: string; html?: string | undefined; text?: string | undefined; from?: { name?: string | undefined; localPart?: string | undefined; domain?: string | undefined; } | undefined; replyTo?: string | string[] | undefined; cc?: string | string[] | undefined; bcc?: string | string[] | undefined; headers?: Record<string, string> | undefined; attachments?: { filename: string; url?: string | undefined; content?: string | undefined; contentType?: string | undefined; }[] | undefined; tags?: { name: string; value: string; }[] | undefined; scheduledAt?: string | undefined; idempotencyKey?: string | undefined; bulk?: boolean | undefined; }): Promise<{ success: true; message: 'Email sent successfully'; messageId: string; id: string; status: 'queued' | 'sent'; } & { usage:
|
|
724
|
+
email.send(msg: { to: string | string[]; subject: string; html?: string | undefined; text?: string | undefined; from?: { name?: string | undefined; localPart?: string | undefined; domain?: string | undefined; } | undefined; replyTo?: string | string[] | undefined; cc?: string | string[] | undefined; bcc?: string | string[] | undefined; headers?: Record<string, string> | undefined; attachments?: { filename: string; url?: string | undefined; content?: string | undefined; contentType?: string | undefined; }[] | undefined; tags?: { name: string; value: string; }[] | undefined; scheduledAt?: string | undefined; idempotencyKey?: string | undefined; bulk?: boolean | undefined; }): Promise<Omit<{ success: true; message: 'Email sent successfully'; messageId: string; id: string; status: 'queued' | 'sent'; }, 'usage'> & { usage: Usage; }>
|
|
725
725
|
```
|
|
726
726
|
|
|
727
727
|
Sends one e-mail (HTML byte for byte); charged per recipient (`usage.credits`).
|
|
@@ -746,7 +746,7 @@ email.get(id: string): Promise<{ id: string; from: string; to: string[]; subject
|
|
|
746
746
|
totalumCron(options?: TotalumClientOptions)
|
|
747
747
|
```
|
|
748
748
|
|
|
749
|
-
`totalum.cron` over
|
|
749
|
+
`totalum.cron` over the Totalum API `/v1/cron/*` (scope `cron`): HTTP jobs against the project's own host,
|
|
750
750
|
fired by Totalum's Scheduler; limits per plan (`429 CRON_LIMIT_REACHED {limit, plan}`, `400 INVALID_SCHEDULE
|
|
751
751
|
{minIntervalSeconds}`). Executions cost nothing. `timezone` (IANA) reads the schedule on that zone's clock, daylight
|
|
752
752
|
saving included; `pauseAfterFailures` (1–100, default 3; `null` = never) sets how many failed runs in a row pause it.
|
|
@@ -761,10 +761,10 @@ A job that calls a URL of the project's own host on a cron `schedule` (or `{ eve
|
|
|
761
761
|
|
|
762
762
|
```ts
|
|
763
763
|
await cron.create({
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
764
|
+
name: 'daily-report',
|
|
765
|
+
schedule: '0 8 * * *', // 08:00 in Madrid all year
|
|
766
|
+
timezone: 'Europe/Madrid',
|
|
767
|
+
request: { method: 'POST', url: 'https://my-app.totalum-project.com/api/cron/report' },
|
|
768
768
|
});
|
|
769
769
|
```
|
|
770
770
|
|
|
@@ -840,7 +840,7 @@ Fires a job now, outside its schedule.
|
|
|
840
840
|
totalumSeo(options?: TotalumClientOptions)
|
|
841
841
|
```
|
|
842
842
|
|
|
843
|
-
`totalum.seo` over
|
|
843
|
+
`totalum.seo` over the Totalum API `/v1/seo/*` (scope `seo`): IndexNow for verified custom domains, free.
|
|
844
844
|
|
|
845
845
|
#### `seo.notifyChanged`
|
|
846
846
|
|
|
@@ -866,7 +866,7 @@ The key the template serves at `/<key>.txt`.
|
|
|
866
866
|
totalumBrowser(options?: TotalumClientOptions)
|
|
867
867
|
```
|
|
868
868
|
|
|
869
|
-
`totalum.browser` over
|
|
869
|
+
`totalum.browser` over the Totalum API `/v1/browser/*` (scope `browser`): remote browser sessions driven entirely
|
|
870
870
|
over HTTPS, so every command works from a Worker. A command's refusal throws `TotalumError` with its frozen
|
|
871
871
|
code (`ACTION_TIMEOUT`, `ACTION_FAILED`, …); `actions()` returns every result instead.
|
|
872
872
|
|
|
@@ -935,7 +935,7 @@ Polls until the program leaves `pending`/`running` (the `browser.program.complet
|
|
|
935
935
|
totalumRealtime(options?: TotalumClientOptions)
|
|
936
936
|
```
|
|
937
937
|
|
|
938
|
-
`totalum.realtime` server side over
|
|
938
|
+
`totalum.realtime` server side over the Totalum API `/v1/realtime/*` (scope `realtime`). The app's own
|
|
939
939
|
server mints a short-lived ticket after its own auth check and hands `{ticket, url}` to the page; the page opens the
|
|
940
940
|
`wss://` `url` and never holds a key.
|
|
941
941
|
|
|
@@ -981,7 +981,7 @@ const { connections } = await realtime.publish(`orders:${shopId}`, { event: 'ord
|
|
|
981
981
|
totalumLogs(options?: TotalumClientOptions)
|
|
982
982
|
```
|
|
983
983
|
|
|
984
|
-
`totalum.logs` over
|
|
984
|
+
`totalum.logs` over the Totalum API `/v1/logs` (scope `logs:read`; the agent's sandbox key reads its dev
|
|
985
985
|
preview for free): the Worker invocations of the published app (`env: 'live'`) or the preview (`'dev'`). Free.
|
|
986
986
|
|
|
987
987
|
#### `logs.query`
|
|
@@ -1004,7 +1004,7 @@ const { items } = await logs.query({ level: 'error', env: 'live' });
|
|
|
1004
1004
|
totalumAnalytics(options?: TotalumClientOptions)
|
|
1005
1005
|
```
|
|
1006
1006
|
|
|
1007
|
-
`totalum.analytics` over
|
|
1007
|
+
`totalum.analytics` over the Totalum API `/v1/analytics/site` (scope `analytics:read`): the site's own traffic. Free.
|
|
1008
1008
|
|
|
1009
1009
|
#### `analytics.site`
|
|
1010
1010
|
|
|
@@ -1127,7 +1127,7 @@ type RealtimeChannelOptions = {
|
|
|
1127
1127
|
type ScanDocumentResult = {
|
|
1128
1128
|
data: Record<string, unknown> | Record<string, unknown>[];
|
|
1129
1129
|
metadata: { usageUnits: number; exactUsageUnits: number; pages: number; provider: string; credits: number; };
|
|
1130
|
-
usage:
|
|
1130
|
+
usage: Usage;
|
|
1131
1131
|
}
|
|
1132
1132
|
```
|
|
1133
1133
|
|
|
@@ -1167,7 +1167,7 @@ type SpeechAudio = {
|
|
|
1167
1167
|
|
|
1168
1168
|
```ts
|
|
1169
1169
|
type TotalumAiOptions = {
|
|
1170
|
-
/** The
|
|
1170
|
+
/** The OpenAI-compatible AI gateway `gatewayConfig()` returns; default `TOTALUM_AI_BASE_URL`, else `https://ai.totalum.app/api/v1`. */
|
|
1171
1171
|
aiBaseUrl?: string;
|
|
1172
1172
|
/** Project key `tlm_pk_…`; default `TOTALUM_PROJECT_KEY`. Server-side only. */
|
|
1173
1173
|
key?: string;
|
|
@@ -1231,7 +1231,7 @@ type TotalumFilesOptions = {
|
|
|
1231
1231
|
|
|
1232
1232
|
```ts
|
|
1233
1233
|
type TotalumOptions = {
|
|
1234
|
-
/** The
|
|
1234
|
+
/** The OpenAI-compatible AI gateway `gatewayConfig()` returns; default `TOTALUM_AI_BASE_URL`, else `https://ai.totalum.app/api/v1`. */
|
|
1235
1235
|
aiBaseUrl?: string;
|
|
1236
1236
|
/** Project key `tlm_pk_…`; default `TOTALUM_PROJECT_KEY`. Server-side only. */
|
|
1237
1237
|
key?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.10.1",
|
|
3
3
|
"methods": [
|
|
4
4
|
{
|
|
5
5
|
"call": "totalum.files.upload(input, { name?, contentType?, private?, folder? })",
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
"call": "totalum.pdf.fromHtml({ name, html?, base64HtmlString?, options?, waitForSelector? })",
|
|
131
|
-
"returns": "{
|
|
131
|
+
"returns": "{ key, fileName, url, usage }"
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
"call": "totalum.pdf.fromUrl({ url, name, options?, cookies?, headers? })",
|
|
135
|
-
"returns": "{
|
|
135
|
+
"returns": "{ key, fileName, url, usage }"
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
"call": "totalum.scan.document({ properties, options?, fileName?, key?, url? })",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
"call": "totalum.scan.ocr({ pages?, fileName?, key?, url? })",
|
|
143
|
-
"returns": "{
|
|
143
|
+
"returns": "{ pages, text, fullDetails?, usage }"
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
"call": "totalum.vectors.upsert(vectors)",
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
"call": "totalum.email.send({ to, subject, html?, text?, from?, replyTo?, cc?, bcc?, headers?, attachments?, tags?, scheduledAt?, idempotencyKey?, bulk? })",
|
|
246
|
-
"returns": "{
|
|
246
|
+
"returns": "{ id, status: 'queued' | 'sent', message, success, messageId, usage }"
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
"call": "totalum.email.get(id)",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Z as ZodObject, k as ZodNumber, c as ZodOptional, d as ZodString, m as $strip, o as output, u as ZodISODateTime, f as ZodEnum, j as ZodBoolean, h as ZodRecord, g as ZodUnknown, w as ZodNullable, p as ZodURL } from './errors.d-WcXvShIX.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* `usage` on every integration result (plan 11 §0.8): the Totalum credits the call was charged, 4 decimals — never
|
|
5
|
-
* the vendor, its units or its cost (Francesc 2026-09-28). The optional fields stay for totalum-sdk 1.x type
|
|
6
|
-
* compatibility and are never sent.
|
|
7
|
-
*/
|
|
8
|
-
declare const IntegrationUsage: ZodObject<{
|
|
9
|
-
credits: ZodNumber;
|
|
10
|
-
vendor: ZodOptional<ZodString>;
|
|
11
|
-
units: ZodOptional<ZodNumber>;
|
|
12
|
-
vendorCostUsd: ZodOptional<ZodNumber>;
|
|
13
|
-
}, $strip>;
|
|
14
|
-
type IntegrationUsage = output<typeof IntegrationUsage>;
|
|
15
|
-
/** The delivery body: `{id, type, createdAt, projectId, env, livemode?, data}`, idempotent by `id`. */
|
|
16
|
-
declare const WebhookEvent: ZodObject<{
|
|
17
|
-
id: ZodString;
|
|
18
|
-
type: ZodString;
|
|
19
|
-
createdAt: ZodISODateTime;
|
|
20
|
-
projectId: ZodString;
|
|
21
|
-
env: ZodEnum<{
|
|
22
|
-
dev: "dev";
|
|
23
|
-
live: "live";
|
|
24
|
-
}>;
|
|
25
|
-
livemode: ZodOptional<ZodBoolean>;
|
|
26
|
-
data: ZodRecord<ZodString, ZodUnknown>;
|
|
27
|
-
}, $strip>;
|
|
28
|
-
type WebhookEvent = output<typeof WebhookEvent>;
|
|
29
|
-
/** `GET|PUT /v1/webhooks`: the secret itself is shown only by `POST /v1/webhooks/rotate-secret`. */
|
|
30
|
-
declare const WebhookConfig: ZodObject<{
|
|
31
|
-
url: ZodNullable<ZodURL>;
|
|
32
|
-
enabled: ZodBoolean;
|
|
33
|
-
secretPrefix: ZodNullable<ZodString>;
|
|
34
|
-
}, $strip>;
|
|
35
|
-
type WebhookConfig = output<typeof WebhookConfig>;
|
|
36
|
-
/** `POST /v1/webhooks/rotate-secret`: a new signing secret, revealed once (`whsec_` + 64 hex). */
|
|
37
|
-
declare const WebhookSecretOutput: ZodObject<{
|
|
38
|
-
secret: ZodString;
|
|
39
|
-
}, $strip>;
|
|
40
|
-
type WebhookSecretOutput = output<typeof WebhookSecretOutput>;
|
|
41
|
-
|
|
42
|
-
export { IntegrationUsage as I, WebhookConfig as W, WebhookEvent as a, WebhookSecretOutput as b };
|