Skip to content

Commit 8cc60ca

Browse files
yardend-wixclaude
andauthored
docs(ai-gateway): document the service-role-only gateway rule (#330)
* docs(ai-gateway): document the service-role-only gateway rule --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 0996f8a commit 8cc60ca

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/sdk/src/modules/ai-gateway.types.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ export interface AiGatewayConnection {
55
/** Base URL of the selected gateway provider. */
66
baseURL: string;
77
/**
8-
* Bearer token that authenticates the request. Empty string when the caller is
9-
* unauthenticated.
8+
* Bearer token that authenticates the request: the service-role token from
9+
* `base44.asServiceRole.aiGateway`, or the signed-in user's token from
10+
* `base44.aiGateway`. The gateway expects the service-role token.
1011
*/
1112
token: string;
1213
/**
@@ -94,8 +95,8 @@ export interface AiGatewayModuleConfig {
9495
*
9596
* The mode determines which token `connection()` returns:
9697
*
97-
* - **User authentication** (`base44.aiGateway`): Returns the signed-in app user's token.
98-
* - **Service role authentication** (`base44.asServiceRole.aiGateway`): Returns the service-role token instead. Use it from backend functions: apps that restrict Core integrations, the default for new apps, reject user-token gateway calls on public apps. It also works when there's no signed-in user, such as from a scheduled automation.
98+
* - **Service role authentication** (`base44.asServiceRole.aiGateway`): Returns the app's service-role token. Use it server-side; the gateway rejects other calls with a `403` and the error code `ai_gateway_requires_service_role`. It also works with no signed-in user, such as from a scheduled automation.
99+
* - **User authentication** (`base44.aiGateway`): Returns the signed-in app user's token. The gateway accepts it only on apps shared privately or with your workspace.
99100
*
100101
* ## Billing and limits
101102
*

0 commit comments

Comments
 (0)