@base44-preview/sdk 0.8.39-pr.231.cbd75f8 → 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,28 +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
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
48
47
  * as `'claude_sonnet_4_6'`, `'gpt_5_5'`, or `'gemini_3_1_pro'`.
49
48
  *
50
- * See the [`model` options on `InvokeLLM`](/developers/references/sdk/docs/type-aliases/integrations#invokellm)
51
- * for the current set of models you can use.
52
- *
53
49
  * ## Authentication Modes
54
50
  *
55
- * 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:
56
53
  *
57
- * - **Anonymous or User authentication** (`base44.aiGateway`): The gateway connection is scoped to the current user's permissions.
58
- * - **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.
59
56
  *
60
57
  * ## Billing and limits
61
58
  *
@@ -63,7 +60,8 @@ export interface AiGatewayModuleConfig {
63
60
  * quota your app's built-in AI features use, and isn't split per user. If the
64
61
  * app runs out of credits, the gateway stops working for every user of the
65
62
  * app until the quota resets. A request is rejected before the model runs if
66
- * 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.
67
65
  *
68
66
  * Streaming responses aren't supported yet, so leave `stream` unset on your requests.
69
67
  */
@@ -77,10 +75,11 @@ export interface AiGatewayModule {
77
75
  *
78
76
  * @example
79
77
  * ```typescript
80
- * // Call a model directly with the OpenAI SDK, inside a backend function
78
+ * // Call a model directly
81
79
  * import { createClientFromRequest } from "@base44/sdk";
82
80
  * import OpenAI from "openai";
83
81
  *
82
+ * // Runs inside a backend function
84
83
  * const base44 = createClientFromRequest(request);
85
84
  * const { baseURL, token } = base44.aiGateway.connection();
86
85
  * const openai = new OpenAI({ baseURL, apiKey: token });
@@ -95,12 +94,13 @@ export interface AiGatewayModule {
95
94
  *
96
95
  * @example
97
96
  * ```typescript
98
- * // Review a return request with a tool-using agent, inside a backend function
97
+ * // Use a tool-calling agent
99
98
  * import { createClientFromRequest } from "@base44/sdk";
100
99
  * import { ToolLoopAgent, tool, stepCountIs, hasToolCall } from "ai";
101
100
  * import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
102
101
  * import { z } from "zod";
103
102
  *
103
+ * // Runs inside a backend function, reviewing a return request
104
104
  * const base44 = createClientFromRequest(request);
105
105
  * const returnRequest = await base44.entities.ReturnRequest.get(returnId);
106
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.cbd75f8",
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",