@base44-preview/sdk 0.8.52-pr.305.7dff8f5 → 0.8.52-pr.305.970f972
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.
|
@@ -42,7 +42,7 @@ export interface AiGatewayModuleConfig {
|
|
|
42
42
|
/**
|
|
43
43
|
* AI Gateway module for calling Base44's managed AI models from your own code.
|
|
44
44
|
*
|
|
45
|
-
* `connection()`
|
|
45
|
+
* Call `connection()` to get a `baseURL`, `token`, and `headers` that
|
|
46
46
|
* authenticate as your Base44 app. An OpenAI-compatible client is any library, such as the `openai`
|
|
47
47
|
* SDK or the Vercel AI SDK, that has the same request and response format
|
|
48
48
|
* as OpenAI's API and lets you point it at a custom `baseURL`
|
|
@@ -51,7 +51,7 @@ export interface AiGatewayModuleConfig {
|
|
|
51
51
|
* against the provider directly, no separate account, API key, or billing
|
|
52
52
|
* setup with the underlying model provider required.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
54
|
+
* The optional `provider` picks the API you connect to:
|
|
55
55
|
*
|
|
56
56
|
* - `openai` (default): OpenAI-compatible chat completions, image, and video endpoints.
|
|
57
57
|
* - `typesafe`: structured evaluations with the `jev` model.
|
|
@@ -71,7 +71,7 @@ export interface AiGatewayModuleConfig {
|
|
|
71
71
|
*
|
|
72
72
|
* The gateway also serves OpenAI's image endpoints, `/images/generations`
|
|
73
73
|
* and `/images/edits`, so you can generate images and edit them using
|
|
74
|
-
* reference images. Image requests use their own set of models
|
|
74
|
+
* reference images. Image requests use their own set of models. Pass
|
|
75
75
|
* `'automatic'` to let Base44 choose one, or pin a model such as
|
|
76
76
|
* `'gemini_3_1_flash_image'` or `'gpt_image_2'`. For request options, the
|
|
77
77
|
* full model list, and limits, see [Generate images with the AI Gateway](/developers/references/sdk/getting-started/ai-gateway-images).
|
|
@@ -80,7 +80,7 @@ export interface AiGatewayModuleConfig {
|
|
|
80
80
|
*
|
|
81
81
|
* The gateway also serves OpenAI's video endpoints, `/videos`, so you can
|
|
82
82
|
* generate video from a prompt, from a still image, or from existing media.
|
|
83
|
-
* Video generation is asynchronous
|
|
83
|
+
* Video generation is asynchronous. `POST /videos` returns a job, and you poll
|
|
84
84
|
* `GET /videos/{id}` until its status is `completed` or `failed`, which can
|
|
85
85
|
* take minutes. Video models are their own set, and there's no `automatic`
|
|
86
86
|
* option, so pin a model such as `'veo_3_1_fast'` or `'seedance_2'`. For
|
|
@@ -91,19 +91,32 @@ export interface AiGatewayModuleConfig {
|
|
|
91
91
|
*
|
|
92
92
|
* The `typesafe` provider runs the `jev` evaluation model through
|
|
93
93
|
* `@ai-sdk/typesafe-ai` and `experimental_evaluate` from the `ai` package,
|
|
94
|
-
* version 7.0.105 or later. Pass `evaluationModel("jev")
|
|
95
|
-
* other model IDs, such as `"jev-latest"`. Give it some app
|
|
96
|
-
* questions, each a `choice`, `score`, or `boolean`. Choice
|
|
97
|
-
* come back with `probabilities` per option
|
|
98
|
-
* `probability` of `true`. Use it to classify, score, or
|
|
99
|
-
* apply your own thresholds and actions in code.
|
|
94
|
+
* version 7.0.105 or later. Pass `evaluationModel("jev")`, and note that the
|
|
95
|
+
* gateway rejects other model IDs, such as `"jev-latest"`. Give it some app
|
|
96
|
+
* state and a set of questions, each a `choice`, `score`, or `boolean`. Choice
|
|
97
|
+
* and score answers come back with `probabilities` per option, and boolean
|
|
98
|
+
* answers with a single `probability` of `true`. Use it to classify, score, or
|
|
99
|
+
* route records, then apply your own thresholds and actions in code.
|
|
100
100
|
*
|
|
101
101
|
* ## Authentication Modes
|
|
102
102
|
*
|
|
103
103
|
* The mode determines which token `connection()` returns:
|
|
104
104
|
*
|
|
105
105
|
* - **User authentication** (`base44.aiGateway`): Returns the signed-in app user's token.
|
|
106
|
-
* - **Service role authentication** (`base44.asServiceRole.aiGateway`): Returns the service-role token instead.
|
|
106
|
+
* - **Service role authentication** (`base44.asServiceRole.aiGateway`): Returns the service-role token instead.
|
|
107
|
+
*
|
|
108
|
+
* Use service role, as every example here does. An app that restricts Core
|
|
109
|
+
* integrations rejects user-token gateway calls unless it's shared privately
|
|
110
|
+
* or with your workspace, and most new apps have that restriction on from the
|
|
111
|
+
* start. A user-token call therefore works while you're building and starts
|
|
112
|
+
* failing the moment you share the app publicly. Service role also works when
|
|
113
|
+
* there's no signed-in user at all, such as from a scheduled automation.
|
|
114
|
+
*
|
|
115
|
+
* The mode changes which token you get and nothing else. It grants the model
|
|
116
|
+
* no extra reach, because the gateway runs a model and never touches your
|
|
117
|
+
* data. Access to your app's data comes from the `base44.entities` calls you
|
|
118
|
+
* write around the gateway call, so pick the mode for those on their own
|
|
119
|
+
* merits rather than matching this one.
|
|
107
120
|
*
|
|
108
121
|
* ## Billing and limits
|
|
109
122
|
*
|