@base44-preview/sdk 0.8.39-pr.231.1187092 → 0.8.39-pr.231.ef80ef9

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.
@@ -34,29 +34,25 @@ export interface AiGatewayModuleConfig {
34
34
  * against the provider directly, no separate account, API key, or billing
35
35
  * setup with the underlying model provider required.
36
36
  *
37
- * Call `connection()` from a backend function rather than the browser. That's
38
- * where your instructions, tools, and business logic stay server-side, where
39
- * users can't inspect or tamper with them, and where you can enforce your own
40
- * auth checks, rate limits, or spend limits around the call. `token` is the
41
- * caller's own session token, the same one the SDK already uses for every
42
- * other call, so calling from the browser doesn't expose anything new.
37
+ * Call `connection()` from a backend function rather than the browser. This
38
+ * keeps your instructions, tools, and business logic server-side, and lets
39
+ * you enforce your own auth, rate, and spend limits around the call. The
40
+ * `token` it returns is the caller's regular session token, the same one
41
+ * used for every other SDK call.
43
42
  *
44
43
  * ## Models
45
44
  *
46
- * Build AI agents or call models directly from your app's backend functions.
47
- * Pass `'automatic'` to let Base44 choose a model, or pin a specific one such
48
- * as `'claude_sonnet_4_6'`, `'claude_opus_4_8'`, `'gpt_5_5'`, or
49
- * `'gemini_3_1_pro'`.
50
- *
51
- * See the [`model` options on `InvokeLLM`](/developers/references/sdk/docs/type-aliases/integrations#invokellm)
52
- * for the current set of models you can use.
45
+ * You can use any of the [models available through `InvokeLLM`](/developers/references/sdk/docs/type-aliases/integrations#invokellm).
46
+ * Pass `'automatic'` to let Base44 choose one, or pin a specific model such
47
+ * as `'claude_sonnet_4_6'`, `'gpt_5_5'`, or `'gemini_3_1_pro'`.
53
48
  *
54
49
  * ## Authentication Modes
55
50
  *
56
- * This module is available to use with a client in all authentication modes:
51
+ * There's no permission difference between modes. Both just determine which
52
+ * token `connection()` returns:
57
53
  *
58
- * - **Anonymous or User authentication** (`base44.aiGateway`): The gateway connection is scoped to the current user's permissions.
59
- * - **Service role authentication** (`base44.asServiceRole.aiGateway`): The gateway connection uses the service role for backend code that needs elevated permissions.
54
+ * - **User authentication** (`base44.aiGateway`): Returns the signed-in app user's token.
55
+ * - **Service role authentication** (`base44.asServiceRole.aiGateway`): Returns the service-role token instead, for calling the gateway when there's no signed-in user, such as from a scheduled automation.
60
56
  *
61
57
  * ## Billing and limits
62
58
  *
@@ -64,7 +60,8 @@ export interface AiGatewayModuleConfig {
64
60
  * quota your app's built-in AI features use, and isn't split per user. If the
65
61
  * app runs out of credits, the gateway stops working for every user of the
66
62
  * app until the quota resets. A request is rejected before the model runs if
67
- * the app is out of credits.
63
+ * the app is out of credits. If you need to cap usage per user, build that
64
+ * check yourself, for example by tracking calls per user in your own entity.
68
65
  *
69
66
  * Streaming responses aren't supported yet, so leave `stream` unset on your requests.
70
67
  */
@@ -78,10 +75,11 @@ export interface AiGatewayModule {
78
75
  *
79
76
  * @example
80
77
  * ```typescript
81
- * // Call a model directly with the OpenAI SDK, inside a backend function
78
+ * // Call a model directly
82
79
  * import { createClientFromRequest } from "@base44/sdk";
83
80
  * import OpenAI from "openai";
84
81
  *
82
+ * // Runs inside a backend function
85
83
  * const base44 = createClientFromRequest(request);
86
84
  * const { baseURL, token } = base44.aiGateway.connection();
87
85
  * const openai = new OpenAI({ baseURL, apiKey: token });
@@ -96,12 +94,13 @@ export interface AiGatewayModule {
96
94
  *
97
95
  * @example
98
96
  * ```typescript
99
- * // Review a return request with a tool-using agent, inside a backend function
97
+ * // Use a tool-calling agent
100
98
  * import { createClientFromRequest } from "@base44/sdk";
101
99
  * import { ToolLoopAgent, tool, stepCountIs, hasToolCall } from "ai";
102
100
  * import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
103
101
  * import { z } from "zod";
104
102
  *
103
+ * // Runs inside a backend function, reviewing a return request
105
104
  * const base44 = createClientFromRequest(request);
106
105
  * const returnRequest = await base44.entities.ReturnRequest.get(returnId);
107
106
  * const { baseURL, token } = base44.aiGateway.connection();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.39-pr.231.1187092",
3
+ "version": "0.8.39-pr.231.ef80ef9",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",