You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b917a38
Browse filesBrowse the repository at this point in the historyBrowse files
Make AI work again on hosted Void Cloud: publish AI logging policy to KV
Since 1.8.0 the proxy asked the API for each project's AI logging policy
on every AI call, and the API refused unless PLATFORM_AUTH_DATABASE_UNCACHED
was set. Hosted Void Cloud never sets it, so every hosted AI call failed
with 503 ai_logging_policy_unavailable.
Now the API and the installer write the policy to ROUTING KV key
`ai-logging:<projectId>`, and the proxy reads it from there.
Shared (`@void/platform/ai-logging`)
- Key names, value and metadata shape, parsers, resolver and the 30 s
read cache time, used by the API, the installer and the proxy.
Proxy
- Reads the key (cacheTtl 30) in /ai/run, /ai/provider and /ai/toMarkdown,
after body validation. Missing key: inherit (no logging option, as in
1.7.0). off / metadata / full: the 1.8.0 gateway mapping. KV error:
503 ai_logging_policy_unavailable. Bad value: 503
ai_logging_policy_invalid. Caller-supplied logging keys are still
stripped.
- Adds a manual live-check script for the two Cloudflare behaviours the
mapping depends on.
API
- publishProjectAiLogging locks the project row, reads every input through
a write statement (cached Hyperdrive reads never feed a publish), and
writes KV before the lock is released.
- The operator POST orders the write by direction: a tighten writes in the
same transaction; a loosen or inherit commits first and publishes in a
second locked step. Errors: ai_logging_publish_failed / _pending.
- Plan defaults in platform_settings 'plans:ai-logging', published in
pages of 100. A user plan change publishes one page per call; transfer,
create and delete keep the key in step.
- Readback returns saved, plan, effective, source, published and a state:
applied, pending, pending_plan_publish, drift or unknown.
- An hourly sweep repairs drifted keys within a 400 KV operation budget.
- The internal route 1.8.x proxies call is kept and answers from KV.
Installer and CLI
- Every install, upgrade and repair copies each project's setting from
Postgres to KV, before and after the Worker upload, under the same row
locks as the API.
- `void platform project ai-logging` and `project show` print the source,
effective mode and state; plan files accept `aiLogging`.
Docs
- CLI reference, admin guides, upgrade note, design doc 0094, operations
notes for the hosted rollout.
Refs #793.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/guide/ai.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,7 @@ const result = await ai.run('google/gemini-2.5-flash', {
142
142
});
143
143
```
144
144
145
-
Pass AI Gateway options as the third argument: `ai.run(model, inputs, { gateway: { skipCache: true } })`. On a team platform, the platform chooses the gateway and sets its metadata and logging; options such as `skipCache` and `cacheTtl` still apply.
145
+
Pass AI Gateway options as the third argument: `ai.run(model, inputs, { gateway: { skipCache: true } })`. On a team platform, the platform chooses the gateway and sets its metadata and logging; options such as `skipCache` and `cacheTtl` still apply. The platform's logging setting also covers `void dev` in a linked project; an unlinked project uses your own Cloudflare account and its gateway settings.
146
146
147
147
For provider-native requests on a direct deployment, configure [`ai.gateway`](../integrations/cloudflare.md#ai-self-host).
Copy file name to clipboardExpand all lines: docs/guide/platform/administration/plans.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Choose a plan to inspect or edit it, copy one into a new plan, or choose the def
16
16
17
17
## Use the Dashboard
18
18
19
-
Open **Plans** to see each plan's stable ID, account count, and signup default. Choose **Add plan** to copy an existing plan, or **Edit** to change its display name, limits, build size, and permission to use short project slugs.
19
+
Open **Plans** to see each plan's stable ID, account count, and signup default. Choose **Add plan** to copy an existing plan, or **Edit** to change its display name, limits, build size, permission to use short project slugs, and [AI Gateway logging default](#ai-gateway-logging).
20
20
21
21
Choose **Review changes** to compare the current and proposed settings and see how many accounts are affected. Review any quota warnings, then choose **Apply changes**. If someone changed the catalog while you were reviewing, open the plan again and create a fresh review.
22
22
@@ -89,6 +89,39 @@ Storage figures shown for D1, R2, and KV are informational and cannot be edited
89
89
90
90
The preview shows the affected account count and checks a sample for accounts already above a proposed quota. Lowering a quota can restrict existing apps, including accounts outside that sample. Usage history and billing periods are preserved, so a plan change does not reset usage. Manual administrator suspensions remain in effect.
91
91
92
+
## AI Gateway Logging {#ai-gateway-logging}
93
+
94
+
Each plan can set how AI Gateway logs AI requests for its accounts' projects: `inherit`, `off`, `metadata`, or `full`. See [AI Gateway logging](../../../reference/cli/platform-users.md#ai-gateway-logging) for what each mode stores. Plans start with `inherit`, which follows the gateway's own setting.
95
+
96
+
A project's own setting from `void platform project ai-logging` always wins over the plan default. Accounts whose plan is not in the catalog use the signup default plan's setting.
97
+
98
+
In the dashboard, choose **Edit** on a plan and pick its **AI Gateway logging default**. In a plan file, set `aiLogging`:
99
+
100
+
```json
101
+
{
102
+
"aiLogging": "metadata"
103
+
}
104
+
```
105
+
106
+
```sh
107
+
void platform config plans set team --file team-plan.json --plan
108
+
void platform config plans set team --file team-plan.json --yes
109
+
```
110
+
111
+
`"aiLogging": "inherit"` clears the plan default. Leaving `aiLogging` out keeps the current value. The interactive menu also offers **AI Gateway logging**. The preview shows the change, such as `AI Gateway logging: inherit → metadata`, and how many projects will receive it.
112
+
113
+
After applying, the CLI publishes the default to every project it affects, then prints:
114
+
115
+
```txt
116
+
AI logging published to 120 projects; expected by 14:03:20 UTC (normally within 2 minutes).
117
+
```
118
+
119
+
A plan default applies to a project once the command prints this line, then normally within 2 minutes. Until then, projects keep their previous behavior and `void platform project show <project-id>` reports `pending_plan_publish`. If publishing stops, the command exits with a nonzero status. Continue it with `void platform config plans sync --yes`, or choose **Continue AI logging publish** on the **Plans** page. The platform also continues it every hour.
120
+
121
+
Copying a plan copies its AI logging default. Changing the signup default also changes the setting for accounts whose plan is not in the catalog. When you remove a plan with a replacement, its accounts use the replacement plan's default. Moving a user to another plan, or transferring a project to a new owner, applies the new plan's default.
122
+
123
+
`void platform config plans show <plan-id>` and the user detail page in the dashboard show the plan's AI Gateway logging default. Plan defaults need a platform release that supports them. On an older platform, the CLI stops and asks you to run `void platform upgrade` first.
124
+
92
125
## Archive or Remove a Plan
93
126
94
127
Archive a plan to stop assigning it to new accounts while preserving its current accounts:
Only platform administrators can change this setting. It covers the project's AI requests through the platform, including calls with the app's own provider key.
37
+
Only platform administrators can change this setting. It covers the project's AI requests through the platform, including calls with the app's own provider key and calls from `void dev`.
38
38
39
-
Use `inherit` for the gateway default, `off` to stop log collection, or `full` to include bodies. Read the saved mode with `void platform project show <project-id> --json`. See [AI Gateway logging](../../../reference/cli/platform-users.md#ai-gateway-logging) for billing and Logpush details.
39
+
Use `inherit` for the gateway's own setting, `off` to store no log entry, or `full` to include bodies. A project's own setting wins over its plan's [AI Gateway logging default](./plans.md#ai-gateway-logging); `inherit` removes the project's own setting.
40
+
41
+
The command prints when new requests are expected to follow the change, normally within 2 minutes. Check it with `void platform project show <project-id>`, which reports a line such as `AI Gateway logging: metadata (from plan "pro") — applied`. The project page in the admin dashboard shows the same line. See [AI Gateway logging](../../../reference/cli/platform-users.md#ai-gateway-logging) for each state, what the setting covers, and billing and Logpush details.
The preview shows both owners, their plans and suspension state, blockers, and the changes to routing and usage counters. Wait for active rollbacks and builds to finish. For an ordinary active deployment, wait or use `void platform deployment cancel <id>`; rollback deployments cannot be canceled. A managed Sandbox controller also blocks transfer until its cleanup completes, even if no Sandbox container is running; the preview identifies the deployment that owns it.
51
53
52
-
After the transfer, the former owner becomes a project administrator. Existing project-scoped CI deploy credentials are revoked; create replacements as the new owner. The new owner's plan and limits apply immediately. Usage before the transfer remains charged to the former owner; later usage is charged to the new owner. If an apply reports partial convergence, inspect the project and operator event log before repeating it.
54
+
After the transfer, the former owner becomes a project administrator. Existing project-scoped CI deploy credentials are revoked; create replacements as the new owner. The new owner's plan and limits apply immediately. Its AI Gateway logging default applies to new AI requests, normally within 2 minutes, unless the project has its own setting. Usage before the transfer remains charged to the former owner; later usage is charged to the new owner. If an apply reports partial convergence, inspect the project and operator event log before repeating it.
53
55
54
56
By default, new users on a self-hosted installation start with the `custom` profile, which
55
57
does not cap application requests, AI usage, deployment frequency, or retained
Copy file name to clipboardExpand all lines: docs/guide/platform/installation/maintenance.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,6 +114,8 @@ void platform upgrade [id]
114
114
115
115
An upgrade validates the runtime, applies supported pending migrations, deploys the Workers, and checks their health. Existing Worker secrets are preserved.
116
116
117
+
Install, upgrade, and repair also publish the saved [AI Gateway logging](/reference/cli/platform-users#ai-gateway-logging) settings (**Publishing AI logging settings**). For about 2 minutes afterward, `void platform project show` reports projects with a setting other than `inherit` as `pending`, as well as projects it switched back to `inherit`.
118
+
117
119
Before starting, Void checks access to the installation's Cloudflare account, Workers, and existing R2 buckets. If credentials are rejected, set `CLOUDFLARE_API_TOKEN` to a management token scoped to that account and retry. This overrides the installation's saved management token.
118
120
119
121
Some upgrades pause application traffic until the new version passes health checks. If a command fails while traffic is paused:
@@ -144,6 +146,8 @@ Keep the earlier runtime files if you need rollback. If the installed version is
144
146
145
147
Do not roll back to 0.26.0 or earlier after upgrading to a later release. Void does not refuse this rollback, but those releases reject the credentials that later releases give your apps. Every project deployed or rotated since the upgrade loses AI, email, ISR revalidation, remote D1, KV, and R2, and prerendering until you upgrade again. If you have rolled back that far, upgrade again, then run `void platform system rotate-proxy-tokens --all --yes` and check with `--plan` until nothing is pending or failed.
146
148
149
+
After a rollback to 1.8.0, plan [AI Gateway logging](/guide/platform/administration/plans#ai-gateway-logging) defaults are not applied: projects that follow a plan default use the gateway's own setting, which logs prompts and responses on a new installation. Project settings still apply. Plan defaults stay saved, and the next upgrade publishes them again. A rollback to a release before 1.8.0 applies no AI logging settings.
150
+
147
151
Let running rotations finish before you roll back. If an older proxy runs next to a newer API, prerendering and remote D1, KV, and R2 fail until both run the same release. After a rollback to the release just before credential rotation, projects deployed since the upgrade lose prerendering and remote D1, KV, and R2 until they are deployed again or you upgrade again. A rotated project deployed during any rollback stays broken after you upgrade again, and 0.26.0 and earlier also drop rotations that have not finished. After upgrading again from any rollback, run the same `rotate-proxy-tokens` commands.
Copy file name to clipboardExpand all lines: docs/reference/cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Use this page as a command reference. If you are setting up a project for the fi
34
34
35
35
## Cheat Sheet {#cheat-sheet}
36
36
37
-
Platform administrators can also [choose AI Gateway logging per project](./cli/platform-users.md#ai-gateway-logging) with `void platform project ai-logging`.
37
+
Platform administrators can also choose AI Gateway logging [per project](./cli/platform-users.md#ai-gateway-logging) with `void platform project ai-logging`, or [per plan](../guide/platform/administration/plans.md#ai-gateway-logging) with `void platform config plans`.
Use `--plan` to preview changes and affected accounts; scripted mutations require `--yes`. Every command supports `--connection <slug-or-url>` and `--json`. `show` reports the effective limits, default, assignments, and pending account updates. `reset` restores a built-in plan's original limits and build instance size. Archived plans keep their existing accounts but cannot receive new assignments; change the default before archiving it. `remove` requires a replacement for a plan that has accounts or is the default. Changing the default affects only new accounts.
24
+
Use `--plan` to preview changes and affected accounts; scripted mutations require `--yes`. Every command supports `--connection <slug-or-url>` and `--json`. `show` reports the effective limits, default, assignments, and pending account and AI logging updates. `show <plan-id>` also reports the plan's AI Gateway logging default. `reset` restores a built-in plan's original limits and build instance size. Archived plans keep their existing accounts but cannot receive new assignments; change the default before archiving it. `remove` requires a replacement for a plan that has accounts or is the default. Changing the default affects new accounts, plus the AI Gateway logging of accounts whose plan is not in the catalog.
25
25
26
-
For `add` and `set`, `--file` reads a JSON object with optional `name`, `limits`, `buildInstanceType`, and boolean `allowShortSlugs`. `limits` is a partial object of nonnegative whole numbers; `0` means unlimited by the plan. Build timeouts remain capped at the platform maximum of 60 minutes; `0` uses that maximum. Omitted settings keep their current values or the copied plan's values. `buildInstanceType` is `standard-3` or `standard-4`. `allowShortSlugs` permits future assignments of project slugs of five characters or fewer; existing URLs remain available. Storage quotas are not editable. See [Plans and Limits](../../guide/platform/administration/plans.md) for supported limits and examples.
26
+
For `add` and `set`, `--file` reads a JSON object with optional `name`, `limits`, `buildInstanceType`, and boolean `allowShortSlugs`. `limits` is a partial object of nonnegative whole numbers; `0` means unlimited by the plan. Build timeouts remain capped at the platform maximum of 60 minutes; `0` uses that maximum. Omitted settings keep their current values or the copied plan's values. `buildInstanceType` is `standard-3` or `standard-4`. `allowShortSlugs` permits future assignments of project slugs of five characters or fewer; existing URLs remain available. `aiLogging` sets the plan's [AI Gateway logging](./platform-users.md#ai-gateway-logging) default: `off`, `metadata`, or `full`. `"inherit"` clears it; leaving it out keeps the current value. Storage quotas are not editable. See [Plans and Limits](../../guide/platform/administration/plans.md) for supported limits and examples.
27
27
28
-
An apply checks the preview's revision and rejects concurrent changes. Lower quotas can restrict accounts already above them; usage history and billing periods are preserved. The CLI continues account updates until complete. If an update fails or stops making progress, the configuration remains saved and the command exits unsuccessfully. Run `sync --yes` to continue before editing plans again. Inspect `show` and operator events after an uncertain request outcome.
28
+
An apply checks the preview's revision and rejects concurrent changes. Lower quotas can restrict accounts already above them; usage history and billing periods are preserved. The CLI continues account updates and AI logging publishing until complete, then prints how many projects received the AI logging default and when new requests are expected to follow it. If an update fails or stops making progress, the configuration remains saved and the command exits unsuccessfully. Run `sync --yes` to continue before editing plans again. Inspect `show` and operator events after an uncertain request outcome.
0 commit comments