AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(flows): move every AI step onto the version that bills on cost (#15495)
Abdul8eb2e52446df
diff --git a/brain/knowledge/ai-intelligence/ai-providers.md b/brain/knowledge/ai-intelligence/ai-providers.mdindex 3238acb824d..0b7a200cace 100644--- a/brain/knowledge/ai-intelligence/ai-providers.md+++ b/brain/knowledge/ai-intelligence/ai-providers.md@@ -101,11 +101,28 @@ renders and preserves every real price; the cheapest in the set is 0.01.`runawayTokenCeiling` / `boundContextForStep` in the worker's `run-agent-turn.ts`) thread`provider` and no `modelId`. So EE agent compaction still fires at, say, 200k for every Anthropicmodel including the 1M ones. Fixing it is plumbing plus an `agent-evals` run.-- **`MANAGED_MODEL_WEIGHTS` is a pricing ladder, not a cache of cost — don't derive it from the catalog.**- It tracks real output price but is not a function of it (`claude-opus-4` $75/M → weight 45;- `claude-opus-4.7-fast` $150/M → weight 200). Deriving it would silently re-price customers. Billing- never reads `AIProviderModel` at all: `flow-run-ai-usage-tracker` computes credits from run-log- telemetry times that static table.+- **AI is billed on what the call cost, and the weight tables are gone.** `MANAGED_MODEL_WEIGHTS`,+ `DEFAULT_MANAGED_MODEL_WEIGHT`, `CHAT_BYOK_CREDIT_WEIGHT` and `ACTIVEPIECES_CHAT_TIERS[].creditWeight`+ were a static pricing ladder calibrated at about a thousand tokens per call, so a long call billed+ the same as a short one. Every language model is now built through `billedLanguageModel`+ (`packages/server/utils/src/activepieces-ai-cost.ts`): the managed provider bills the dollar cost+ OpenRouter reports divided by `AP_AI_CREDIT_USD_VALUE`, and any other provider bills one flat credit.+ Tool calls stay at one credit each. **The own-key credit is per model call for a direct AI step and+ per turn for an agent** — an agent turn is many model round-trips, so charging it per call would have+ silently raised the price of every agent on a customer's own key. The caller says which it wants with+ `ownKeyCredit`, and the agent's turn credit is charged in `chatToolBilling.chargeForLatestTurn`+ alongside its tool calls.+- **OpenRouter only reports `usage.cost` when the request asks for it.** The provider sends+ `usage: this.settings.usage` in the request body and copies `cost` into `providerMetadata` only when+ the response carries one, so without `usage: { include: true }` every managed call reports no cost,+ bills nothing, and raises no error. `openRouterModelSettings` in `packages/server/utils/src/ai-utils.ts`+ sets it for the ACTIVEPIECES provider and a test pins it. A call that still reports no cost bills+ zero, is counted, and pages on-call — there is deliberately no fallback to a table.+- **Ask AI's conversation history is hard-capped at 512 KB, on the write path.** The history lives in+ `context.store` under `ask-ai-conversation:<key>`, and the store-entry controller refuses a value over+ `STORE_VALUE_MAX_SIZE`. So the history cannot grow unbounded and cannot outgrow a request body — no+ separate limit is needed wherever it is passed along. An older version of the action could write a+ `{ messages: [] }` wrapper instead of a bare array, so any reader has to accept both shapes.- **A failed `enrichWithKeysIfNeeded()` is self-sustaining, and it takes chat down with it.** `createKey` runs on the chat hot path — `chatHelpers.resolveChatProvider` → `getChatProvider` calls it whenever the platform's managed ACTIVEPIECES row has no `apiKey` — and the `save` happens *after* the OpenRouter call, so a failure persists nothing and the next chat turn calls `createKey` again. There is also no distributed lock or cache, so concurrent turns for one platform each mint a live key and only the last is saved; the orphans keep spending provisioning quota. Seen in prod 2026-07-30: `keys-modify-api-rpd-v2` 429 (OpenRouter's key create/modify bucket, 10k/day on the provision key — a *separate* limit from inference), which killed every chat turn for the affected platform in `getChatConfig` before the first token, with no recovery until the bucket reset at 00:00 UTC.- **`openrouter-api.ts` uses raw `fetch`** — no timeout, no retry, no `tryCatch`, and it bypasses the repo's `safeHttp` rule for outbound HTTP in `packages/server/api`. A `getKey` 408 from OpenRouter escapes the admin `increaseAiCredits` path as an unhandled rejection.- **Chat model tiers are Activepieces-only.** `ACTIVEPIECES_CHAT_TIERS` (`fast`/`smart`/`premium`, shown as Fast/Expert/Heavy) hold OpenRouter-shaped Anthropic ids, so they only mean anything for the ACTIVEPIECES and OPENROUTER chat providers. Any provider that declares `ALLOWED_CHAT_MODELS_BY_PROVIDER` (openai, anthropic, google) picks a real model id from that list instead. Naively stripping the tier's vendor prefix for every provider is what once sent `claude-haiku-4-5` to OpenAI and broke every message.@@ -114,7 +131,12 @@ renders and preserves every real price; the cheapest in the set is 0.01.- **`conversation.modelName` carries either a tier id or a real model id** — it is a free string with no discriminator. A legacy tier id resolves to the tier's equivalent model when the provider ships it, else the provider's first curated model, so old conversations keep working after a provider switch. Note `premium` maps to opus 4.8, which the native anthropic list does not carry, so a legacy `premium` on anthropic lands on Sonnet.- Chat-provider resolution is **first `enabledForChat` row wins**, *not* "prefer ACTIVEPIECES". All three branches of `findAvailableChatProviderRow` reduce to that: when the managed provider is visible the function returns `chatProviders[0]` whatever it is, so a platform with `[openai, activepieces]` both chat-enabled resolves to **openai**. The client mirror is `aiProviderQueries.useChatProvider()` (`providers.find((p) => p.enabledForChat)`) — always read the resolved chat provider through it rather than re-deriving the rule inline. **`enabledForChat` on a deduped project entry must be an OR across that provider's keys, never the top-ranked key's flag** — ranking (`selected` > `except` > `all`, newest first) and chat selection answer different questions, so reading `rows[0].enabledForChat` makes the client report "no provider configured" whenever the chat-enabled key is not the ranking winner, while the server (`findAvailableChatProviderRow`, which queries `enabledForChat: true` directly) happily serves the turn. Invisible with one key per provider. Both sides lean on an unordered `findBy()`: there is no `ORDER BY`, so "first" is not guaranteed stable when several providers are chat-enabled.- Listing providers is **not a pure read**: both `listConfigs` and `listForProject` go through `listVisibleRows`, which inserts the ACTIVEPIECES provider row when `aiCreditsEnabled && !activepiecesExists`. A `GET /v1/ai-providers` can therefore create a row. It also applies the hidden-provider filter (`plan.embeddingEnabled` hides the managed provider), which is why the client can trust its output without re-checking flags.-- Managed-chat credit cost per turn is `tier.creditWeight + billableToolCalls` (`fast` 2 / `smart` 10 / `premium` 20, from `ACTIVEPIECES_CHAT_TIERS`), and BYOK collapses the weight to `CHAT_BYOK_CREDIT_WEIGHT` (1) regardless of tier — so never show tier weights to a BYOK platform. `CHAT_BYOK_CREDIT_WEIGHT` / `CHAT_CREDITS_PER_TOOL_CALL` live in `@activepieces/shared` so the billed number and the number shown in the model picker come from one place. **Every credit-cost surface must render from `ACTIVEPIECES_CHAT_TIERS`, never from a local copy** — the billing Credits FAQ (`credits-info-dialog.tsx`) hardcoded its own 2/10/20 table and drifted the moment the tiers were relabelled, so it still shows Fast/Smart/Premium against the real Fast/Expert/Heavy.+- **A managed chat turn is charged in two events, not one.** The model cost arrives per model call from+ the billing wrapper, and the turn's own-key credit and tool calls are charged by `chatToolBilling.chargeForLatestTurn`+ — which also owns the rule for which tool calls count (`mcp__*` plus a short allow-list, completed only).+ Both land on `CreditUsageSource.CHAT`, so the total is unchanged, but no single event holds a turn's+ whole cost. There is no fixed per-model price left to show a user: the model picker and the Credits FAQ+ now say the charge follows the call.- Azure model listing (`azureProvider.listModels`) is pinned to the retired data-plane api-version `2023-03-15-preview` — newer versions 404 and break `validateConnection`; the configured `apiVersion` only affects inference via `@ai-sdk/azure` (GIT-1310).- **`@activepieces/ai-providers` is `ai@7`, so only `ai@7` code may call it — a piece must build its own language models.** The shared `createLanguageModel` factory pins `ai@7` / `@ai-sdk/openai@4` / `@openrouter@3`, while `packages/pieces/community/ai` (and the engine that runs pieces) sit on `ai@6` / `@ai-sdk/openai@3` / `@openrouter@2`. #14446 pointed the piece at the factory anyway, which broke it two ways: `tsc` rejects the result (`specificationVersion "v4" is not assignable to "v2"`, `LanguageModelV4` vs the piece's `LanguageModelV2 | V3`), and at runtime the piece's own `ai@6` `generateText` would refuse a v4 model. CI hid it because the pieces build only runs when a PR's diff touches `packages/pieces/**`, and a post-merge run on main diffs `HEAD` against `origin/main` — empty, so no piece is ever built there. Fixed by giving the piece back a local `buildLanguageModel` switch built on its own SDKs; the factory is server-side only until the pieces move to AI SDK 7. Cloudflare Gateway is the one provider the factory refuses (`throw`) because its routing is caller-specific; each caller builds that one itself. **The standing consequence: a new provider must be added to BOTH switches** — `createLanguageModel` in `packages/core/ai-providers` *and* `buildLanguageModel` in `packages/pieces/community/ai/src/lib/common/ai-sdk.ts` — and the piece one is the easy half to forget, because nothing before step execution touches it. Miss it and the provider connects, validates, lists its models and saves without complaint, then every AI-piece step dies at run time on the switch's `default:` with `Provider <name> is not supported`. Since pieces cannot import `@activepieces/shared`, anything the piece-side case needs (base-url maps, config types) also has to be re-exported through `packages/pieces/framework/src/index.ts`. The `git show --stat` of the commits that added Mistral (#13088) and Bedrock (#12712) is the reliable checklist for what a provider actually touches — both include `ai-sdk.ts`.- **Attribution headers are for `ACTIVEPIECES` only, and go through the factory's `extraHeaders` option rather than a local `createOpenRouter` call.** The managed provider is OpenRouter under the hood on our own key, so the `x-ap-*` headers are what tag *our* account's events: `x-ap-platform-id` / `x-ap-conversation-id` / `x-ap-run-id` on the agent path, `x-ap-project-id` / `x-ap-flow-id` / `x-ap-run-id` on the piece path. BYOK `OPENROUTER` is a customer's own account and must not get them. Constructing the provider inline to attach headers is also what silently drops `openRouterSettings` (the web-search plugin), since the factory is the only place that still passes them. (`CUSTOM` separately receives the piece-path metadata headers — that is #11700's metadata forwarding for self-hosted OpenAI-compatible endpoints, older than either the rename or the Autumn work and unrelated to OpenRouter attribution. Its precedence is deliberate: admin-configured `defaultHeaders` override the `x-ap-*` metadata, and the api key is applied last.)diff --git a/brain/knowledge/ai-intelligence/index.md b/brain/knowledge/ai-intelligence/index.mdindex 23d5b2d64cf..88d81a4e6e8 100644--- a/brain/knowledge/ai-intelligence/index.md+++ b/brain/knowledge/ai-intelligence/index.md@@ -10,8 +10,8 @@ The AI layer: which model backends a platform may use, how usage is metered, andA configured LLM backend (OpenAI, Anthropic, Google, Azure, OpenRouter, Cloudflare, Custom, or Activepieces-hosted) with encrypted credentials, resolved per platform.### 🪙 AI Credits-The metered currency for AI usage — 1000 credits = $1 — backed by per-key OpenRouter limits. A quota, not a wallet.-- *Avoid:* "tokens" for the billing unit; tokens are the model's unit, credits are ours.+The metered currency for AI usage — one credit is `AP_AI_CREDIT_USD_VALUE` of model spend, $0.0005 by default — backed by per-key OpenRouter limits. A quota, not a wallet. A managed call is billed on the dollar cost the provider reports; a call on a customer's own key is billed one flat credit. See [decision 000037](../decisions/000037-ai-is-billed-on-what-the-call-cost-observed-at-the-worker.md).+- *Avoid:* "tokens" for the billing unit; tokens are the model's unit, credits are ours. *Avoid:* "credit weight" — the per-model weight table is gone.### 🤖 AgentA flow step that runs an autonomous LLM loop rather than a single call. Its **AgentTool**s are Piece, Flow, MCP, or Knowledge Base handles.diff --git a/brain/knowledge/decisions/000037-ai-is-billed-on-what-the-call-cost-observed-at-the-worker.md b/brain/knowledge/decisions/000037-ai-is-billed-on-what-the-call-cost-observed-at-the-worker.mdnew file mode 100644index 00000000000..e0cf21d69b2--- /dev/null+++ b/brain/knowledge/decisions/000037-ai-is-billed-on-what-the-call-cost-observed-at-the-worker.md@@ -0,0 +1,65 @@+---+title: AI is billed on what the call cost, observed at the worker+icon: 🪙+status: accepted+---++# AI is billed on what the call cost, observed at the worker++## Decision++Managed AI is billed on the dollar cost the provider reports for each model call, converted at+`AP_AI_CREDIT_USD_VALUE`. Work on a customer's own key is billed one flat credit per billable unit —+per model call for a direct AI step, per turn for an agent. Tool calls stay at one credit each. The+cost is observed by a middleware the **worker** wraps around every language model, and the charge is+written by the API over the worker-to-API RPC. The per-model weight tables are deleted, not kept as a+fallback.++## Context++The managed provider runs on our own OpenRouter key, so we pay per token while the customer was+charged a flat `MANAGED_MODEL_WEIGHTS[model]` per step. That table is calibrated at roughly a+thousand tokens per call: below it the charge is about right, above it our cost diverges linearly and+the charge does not. A call an order of magnitude larger costs an order of magnitude more than it+bills.++Two stacks attacked this. One read the cost **in the piece** and posted it to a new endpoint. The+other moved AI **execution** to the worker.++## Why++Measuring in the piece means trusting a caller that can lie about its own identity. It needs a+`pieceVersion` gate to stop an old or forged piece from reporting a cost of zero, and that gate is a+speed bump rather than a lock. Measuring at the worker puts the observation on our side of the trust+boundary: the RPC is worker-to-API and engine-token authenticated, so piece code cannot call it and a+caller identity cannot be forged. That is what makes version gating unnecessary rather than merely+inconvenient — so the piece-side approach was rejected.++Billing one flat credit for a customer's own key, rather than nothing, keeps the credits gate+meaningful for platforms that bring their own key. That credit is charged per *turn* for an agent, not+per model call: an agent turn is one model round-trip per tool-use step, so a per-call charge would+have quietly multiplied the price of every own-key agent. For managed AI the per-call charge tracks+money we actually spend, so it stays per call; for an own key we spend nothing and the credit is a+flat platform fee, which the turn is the honest unit for.++A missing cost bills zero, is counted, and pages on-call. There is no fallback to the old table: a+silent fallback would mask the one regression that matters — an SDK bump moving where the cost is+reported — and failing the step would turn a billing-telemetry bug into a customer outage. A+genuinely free model reports a real cost of zero; a *missing* cost reports nothing, and the gap+between the two is the signal.++## Consequences++Credits are now fractional, so a small call can cost less than one credit; round only for display.+There is no fixed per-model price to publish, so the model picker and the credits breakdown say the+charge follows the call. A chat turn is charged in two events — the model cost per call, the tool+calls for the turn — which sum to the same total but mean no single event holds a turn's whole cost.++Because the charge depends on the provider actually reporting a cost, the managed request must ask+for it (`usage: { include: true }` on OpenRouter); a test pins that, since without it the entire+scheme bills nothing and raises no error.++Every AI step must run on a piece version that routes through the worker, so the release that ships+this also migrates every `@activepieces/piece-ai` step to `0.11.0`. The old trackers must be deleted+in that same release: `flowRunAiUsageExtractor` detected AI steps by piece name rather than version,+so while both paths live every managed AI step is charged twice.diff --git a/brain/knowledge/pieces-engine/pieces.md b/brain/knowledge/pieces-engine/pieces.mdindex 5efe3a8e381..688e9612a1c 100644--- a/brain/knowledge/pieces-engine/pieces.md+++ b/brain/knowledge/pieces-engine/pieces.md@@ -29,6 +29,16 @@ The metadata catalog of automation integrations ("pieces") — each a named inte- **DynamicProperties clears its value before it knows the new schema, so the merge source must be a snapshot.** `DynamicPropertiesImplementation` re-fetches the child schema on every refresher change, clearing the form value synchronously and re-populating it in the mutation callback. The merge source for `getDefaultValueForProperties` has to be a `lastKnownValue` ref captured *before* the clear — reading `form.getValues()` in the callback sees the cleared `null` and defaults every child (GIT-1514). The snapshot must be spread-cloned: RHF `getValues(name)` hands back the live object and the clear's `setValue(...child, null)` mutates it in place. Guard the ref with `isNil` so it survives rapid successive changes, where later effect runs already observe `null`.- `DynamicPropertiesContext` tracks loading by property name only, so two in-flight requests for the same property let the first completion clear the flag for both — briefly re-enabling Test Step while the value is still cleared.- **The frontend `POST /v1/pieces/options` client only rejects for DYNAMIC.** `piecesApi.options` (`packages/web/src/features/pieces/api/`) catches DROPDOWN failures, toasts, and *resolves* with a disabled-dropdown fallback — so for dropdowns every error path wired onto that mutation is dead: `usePieceOptions`' `onError` handlers, its `retry: 1`, and the `if (error) throw error` into `DynamicPropertiesErrorBoundary`. DYNAMIC must rethrow: a swallowed failure arrives as a *successful* empty schema, which resets the property's children to defaults and gets persisted by step-settings autosave.+- **An action that can be called as an MCP tool cannot create a waitpoint.** An MCP piece tool runs the+ real action through `actionRunService`, which sets `actionRunMode` on the engine, and+ `createWaitpoint` / `waitForWaitpoint` both throw `assertActionRunCannotSuspend` there. So an action+ with `audience: 'both'` that wants to suspend needs a second, synchronous path — `context.run.canPause`+ tells it which it is in. The AI piece's five simple actions do exactly this: they pause on a waitpoint+ inside a flow, and ask for the answer in the same request when they cannot.+- **MCP piece tools execute real piece actions; the Agent's own tools never touch pieces.** The Agent has+ native image, structured-output, web and scrape tools of its own, so removing an action from the MCP+ surface costs the Agent nothing and costs external MCP clients the whole tool. Worth checking which of+ the two you mean before reasoning about the blast radius of an `audience` change.- **`AP_DEV_PIECES` shadows the DB registry copy by name**, so a dev piece failing the release gate removes the piece *entirely* rather than falling back to the published version. Dropping the name from `AP_DEV_PIECES` (or bumping the local root `package.json`) brings it back.- **A piece search narrows `suggestedActions` to the actions that matched — and matching the *piece* name matches all of them.** `pieceSearching.search` (`pieces/metadata/utils/piece-searching.ts`) runs Fuse over the pieces, then re-runs a nested Fuse per hit through `searchForSuggestion` and returns only the matching actions/triggers. That nested search includes `pieceDisplayName` in its keys and stamps it onto every action, so querying "slack" scores every Slack action as a suggestion, while "archive channel" returns a short list. So `suggestedActions` on a search response is *the answer to the query*, not the piece's full catalogue — a UI that expands search results is showing what matched, and one that caches them must key on the query. Without a `searchQuery` the field is the normal suggestion set instead.- **Type the piece's whole display name and its suggestions can never come back empty — that is the rule that makes `<piece> <action>` queries work.** Fuse matches a query as one untokenized pattern, so `"slack message"` satisfies neither `displayName: 'Slack'` nor `'Send Message To A Channel'` at `threshold: 0.2`; the outer search misses and the substring rescue in `filterBasedOnSearchQuery` puts the piece back. `searchForSuggestion` must therefore not re-run that whole query over the piece's own actions — it drops the tokens naming the piece and searches the remainder, and if the remainder matches nothing it returns **all** actions, but *only when every word of the display name was typed*. Empty `suggestedActions` means `filterOutPiecesWithNoSuggestions` (`pieces-hooks.ts`) deletes the piece in the selector, which is what made `formstack submission` and `discord webhook` return nothing at all. (Do not reach for `slack message` as the regression case: measured against `main` on the 761-piece catalogue it already survives, because an action description carries the phrase.) Measured on the 761-piece dev catalogue, `"<piece> <word from its own action>"` recall went 9/164 → 163/164. **The two guards are load-bearing, do not loosen them:** match naming tokens against the *display name only* (matching the npm name too makes `piece` and `activepieces` name every piece, so any query containing them returns the whole catalogue with all actions), and require ≥3 characters plus full-name coverage (without it `"Google Vertex AI"` drags in every Google piece — 16 pieces instead of 1). A piece matched only by the loose outer rescue is *supposed* to come back with no suggestions and be dropped. Pinned by `test/unit/piece-searching.test.ts`.diff --git a/bun.lock b/bun.lockindex f4d02eb1acd..be1c3748d09 100644--- a/bun.lock+++ b/bun.lock@@ -335,25 +335,14 @@},"packages/pieces/community/ai": {"name": "@activepieces/piece-ai",- "version": "0.10.3",+ "version": "0.11.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*","@activepieces/pieces-common": "workspace:*","@activepieces/pieces-framework": "workspace:*",- "@ai-sdk/amazon-bedrock": "3.0.97",- "@ai-sdk/anthropic": "3.0.72",- "@ai-sdk/azure": "3.0.55",- "@ai-sdk/google": "3.0.65",- "@ai-sdk/google-vertex": "4.0.113","@ai-sdk/mcp": "1.0.11",- "@ai-sdk/openai": "3.0.54",- "@ai-sdk/openai-compatible": "2.0.42",- "@ai-sdk/provider-utils": "4.0.24","@modelcontextprotocol/sdk": "1.26.0",- "@openrouter/ai-sdk-provider": "2.1.1",- "ai": "6.0.170",- "ai-gateway-provider": "3.1.1","ajv": "8.18.0","mime-types": "2.1.35","zod": "4.3.6",@@ -10719,7 +10708,7 @@},"packages/pieces/framework": {"name": "@activepieces/pieces-framework",- "version": "0.39.0",+ "version": "0.40.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",@@ -12759,7 +12748,7 @@"@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-tbHKNLirllUNF3ZlkCsXnwab2ZV1Sl4b1H/Cp9ruCce15IBmskE8Gwkk0yo9xDWY+jho2of7lVXtwSsyrq7cwQ=="],- "@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-oXIw1oLmuBILuvHgSj6w5LOV8oSnFRouPSv0MGkG9sRMeukZ9JnMF17kldaRQaRq8lSJIxo6aS3NzWlVmSb+4Q=="],+ "@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],"@ai-sdk/replicate": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@ai-sdk/provider-utils": "5.0.16" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-GXLqkqQSRR7R279UCHeFnyGdN2s8Nq4C0hFBZztP4M/o0vHajBKq+0GS9D5R3lLra1Hqax6F8IKuF4jAZiQ99Q=="],@@ -18055,26 +18044,6 @@"@activepieces/piece-agentx/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/anthropic": "2.0.77", "@ai-sdk/provider": "2.0.1", "@ai-sdk/provider-utils": "3.0.23", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-EUkR9ovQQY9dHVo67bchi9Qa+05FlSee6hTNZ6X1Rz1SJQKIIR2jt9rN7glRTvrYd+70zU7Xl993RKE3JtqT9w=="],-- "@activepieces/piece-ai/@ai-sdk/anthropic": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-t0j9mggxylA9uP0hi12NlRk2npYh4QkE7JIpws2MdV/18QzHcsT6+TNGIjbOPayLQDjrmRKx78Ym7iZkg9qRxQ=="],-- "@activepieces/piece-ai/@ai-sdk/azure": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/openai": "3.0.54", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-60a9dmRz3s1mgcJeUTrrS/dr2vRXZaypipfLjEW41gdw6Za//Pa2BMEpG+5QSBYDWIZrOdtvvy7yjbBMVqG7wg=="],-- "@activepieces/piece-ai/@ai-sdk/google": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-SwdaJ6IqguyiVuDRgiRM4sHj7uUO4AETlQFFLF3jcEvu/3yrgIHfw2aM6bBNKSdalw0j25Pedx6qyHc2DWJwrg=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/anthropic": "3.0.72", "@ai-sdk/google": "3.0.65", "@ai-sdk/openai-compatible": "2.0.42", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24", "google-auth-library": "^10.5.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-eG7dOZEt3umUWxHHlseYTXLDXdbsVkQ//99liHB38+vLat8SDYcp6+skvguev7OKbl66/8JHdgqRk5Wg7lcd3A=="],-- "@activepieces/piece-ai/@ai-sdk/openai": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-j1qrNe/ebUKuE+fETzS+CVnczs11jQBR9y9M6aoKtJZAosg6SZnPC1Bb92e2u6yaSK+88TZoFhiY67uYphPitw=="],-- "@activepieces/piece-ai/@ai-sdk/openai-compatible": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-hjq485U/dpi6Hvjzw5+F1vohCrB1kibGHlUFknYGa4nOoCnSvFM1lTXEIyTAkjK1uXgTbNk8vw66lbEyWT12jg=="],-- "@activepieces/piece-ai/@openrouter/ai-sdk-provider": ["@openrouter/[email protected]", "", { "peerDependencies": { "ai": "^6.0.0", "zod": "^3.25.0 || ^4.0.0" } }, "sha512-UypPbVnSExxmG/4Zg0usRiit3auvQVrjUXSyEhm0sZ9GQnW/d8p/bKgCk2neh1W5YyRSo7PNQvCrAEBHZnqQkQ=="],-- "@activepieces/piece-ai/ai": ["[email protected]", "", { "dependencies": { "@ai-sdk/gateway": "3.0.105", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-FWTKeGGDRcYJtPWIrdZDSuvOW5LCjI2NZUJmaml8OTOaPEsXnFdFvmawCXbT+wTGxyWKJTgZ9sZtCjbJsmjM2Q=="],-- "@activepieces/piece-ai/ai-gateway-provider": ["[email protected]", "", { "optionalDependencies": { "@ai-sdk/amazon-bedrock": "^4.0.37", "@ai-sdk/anthropic": "^3.0.29", "@ai-sdk/azure": "^3.0.21", "@ai-sdk/cerebras": "^2.0.23", "@ai-sdk/cohere": "^3.0.12", "@ai-sdk/deepgram": "^2.0.12", "@ai-sdk/deepseek": "^2.0.12", "@ai-sdk/elevenlabs": "^2.0.12", "@ai-sdk/fireworks": "^2.0.22", "@ai-sdk/google": "^3.0.16", "@ai-sdk/google-vertex": "^4.0.35", "@ai-sdk/groq": "^3.0.16", "@ai-sdk/mistral": "^3.0.13", "@ai-sdk/openai": "^3.0.21", "@ai-sdk/perplexity": "^3.0.12", "@ai-sdk/xai": "^3.0.40", "@openrouter/ai-sdk-provider": "^2.1.1" }, "peerDependencies": { "@ai-sdk/openai-compatible": "^2.0.0", "@ai-sdk/provider": "^3.0.0", "@ai-sdk/provider-utils": "^4.0.0", "ai": "^6.0.0" } }, "sha512-RTHkboNz9JocplBSKdDLSMEiN3OkfS1UeZqM93zuQ3BVDR5BmTisThoQR/3pkAVACIYL/8OEQ3kuSuDo820gVw=="],-"@activepieces/piece-aidbase/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],"@activepieces/piece-aiprise/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],@@ -18695,51 +18664,13 @@"@actual-app/crdt/uuid": ["[email protected]", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="],- "@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/anthropic/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/azure/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/cerebras/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/cohere/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/deepgram/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/deepseek/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/elevenlabs/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/fireworks/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/gateway/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/google/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/google-vertex/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-"@ai-sdk/google-vertex/google-auth-library": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "gaxios": "^7.1.4", "gcp-metadata": "8.1.2", "google-logging-utils": "1.1.3", "jws": "^4.0.0" } }, "sha512-i1ydyHrqcIxXkWh/uBmVkzCvIuq5yiK2ATndIe5XxKholrG/MTYP9xGYka4sQhrbIAgGjL2B6NOE7rFaiF3fXw=="],- "@ai-sdk/groq/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-"@ai-sdk/mcp/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-5KXyBOSEX+l67elrEa+wqo/LSsSTtrPj9Uoh3zMbe/ceQX4ucHI3b9nUEfNkGF3Ry1svv90widAt+aiKdIJasQ=="],"@ai-sdk/mcp/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.4", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ns9gN7MmpI8vTRandzgz+KK/zNMLzhrriiKECMt4euLtQFSBgNfydtagPOX4j4pS1/3KvHF6RivhT3gNQgBZsg=="],- "@ai-sdk/mistral/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/openai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/openai-compatible/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/perplexity/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/provider-utils/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@ai-sdk/replicate/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "@ai-sdk/xai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],+ "@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],"@anthropic-ai/sdk/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg=="],@@ -19779,10 +19710,6 @@"aggregate-error/clean-stack": ["[email protected]", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="],- "ai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-- "ai-gateway-provider/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-"ai-gateway-provider/@openrouter/ai-sdk-provider": ["@openrouter/[email protected]", "", { "peerDependencies": { "ai": "^6.0.0", "zod": "^3.25.0 || ^4.0.0" } }, "sha512-FMsAEjLUt5pWuRE2LDC/LCvVrFjLlrEzUITH5+5SZtfq7KZ2wrOHjQVxzz92sju8S9ltpzW87CLW8/b0oBXVCw=="],"airtable/@types/node": ["@types/[email protected]", "", {}, "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ=="],@@ -20787,57 +20714,7 @@"@activepieces/engine/ai/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@ai-sdk/anthropic": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "2.0.1", "@ai-sdk/provider-utils": "3.0.23" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-8n7ApEzFOxqVvT3HyqLrEQlgUx/2nUmPFLTGY3fNKwUA8KVNU3Ovd2C66Qh1Y93Iq5NkHsOWuLiTyAZpRKQhgw=="],-- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-KCUwswvsC5VsW2PWFqF8eJgSCu5Ysj7m1TxiHTVA6g7k360bk0RNQENT8KTMAYEs+8fWPD3Uu4dEmzGHc+jGng=="],-- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "2.0.1", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-60GYsRj5wIJQRcq5YwYJq4KhwLeStceXEJiZdecP1miiH+6FMmrnc7lZDOJoQ6m9lrudEb+uI4LEwddLz5+rPQ=="],-- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@smithy/eventstream-codec": ["@smithy/[email protected]", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.1", "@smithy/util-hex-encoding": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-erZq0nOIpzfeZdCyzZjdJb4nVSKLUmSkaQUVkRGQTXs30gyUGeKnrYEg+Xe1W5gE3aReS7IgsvANwVPxSzY6Pw=="],-- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@smithy/util-utf8": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-75MeYpjdWRe8M5E3AW0O4Cx3UadweS+cwdXjwYGBW5h/gxxnbeZ877sLPX/ZJA9GVTlL/qG0dXP29JWFCD1Ayw=="],-- "@activepieces/piece-ai/@ai-sdk/anthropic/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/@ai-sdk/azure/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/@ai-sdk/google/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/google-auth-library": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "gaxios": "7.1.3", "gcp-metadata": "8.1.2", "google-logging-utils": "1.1.3", "jws": "^4.0.0" } }, "sha512-5awwuLrzNol+pFDmKJd0dKtZ0fPLAtoA5p7YO4ODsDu6ONJUVqbYwvv8y2ZBO5MBNp9TJXigB19710kYpBPdtA=="],-- "@activepieces/piece-ai/@ai-sdk/openai/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/@ai-sdk/openai-compatible/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/ai/@ai-sdk/gateway": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24", "@vercel/oidc": "3.2.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-XpERadvLMHkYGJO4hz1Sw7Y9J705Iex48TmdZLdZdaPiFFtVgiA9qhXugLUWGAxdlXU/2N6ipoPSOwfnULZbXw=="],-- "@activepieces/piece-ai/ai/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/amazon-bedrock": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/anthropic": "3.0.72", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-T0uI1FeZ3IHM6n8x9Taylh1wOY1BYQ86AlLxcVs+oONLHTetSpev9JxJa/QID/3a5L6ve8p1+oXxtyVRrv7N7A=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/cerebras": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/openai-compatible": "2.0.42", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-MK8uzm5k+G0HM/pjHfrQGvPsIUy1zSqat716UNpuGo33GQGsABf3jorXyuKmmsGhQpyoKB03DqKZs821FID3Iw=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/cohere": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-PvVW9PVXjDjR8lCLLe1N7gdT5LZGNKbJJ1PiHED22++R8qnlDd42l2cSfJeOmf1UtbQFnMTCVAh9s1de3mCv8A=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/deepgram": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-sXE+iQLj4dV9B9IXwLf55YdsuofeheKTbS/0XQfvjn5MCoEq+baQu+eENHrBYF0IXciooislm4pmNGRmwJ2ijw=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/deepseek": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ATqXxA0u2h201mrtr8KYp6hJGKbnorby9gti/Jgk5m9A3HzWpnw2AjO0uFHTRkhHonhoZD6QH/WyIEQGKDtmIg=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/elevenlabs": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-lLA1LATQfMxa9EhNWizs1Ykqq4NG+XqjYQlO3a8wk5qsSTT8fn1GbHEbVuOBS+/Wzdt7lno6FSuU36zkgBNH3A=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/fireworks": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/openai-compatible": "2.0.42", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-a3USW0vPUgoZCTVkAt9aU+vIPqrZuuSm7eYRv9grcuOCM4KD00QEaBC4ipAXfU9I8bqO5+RdiZE9e1Uh/nuBKw=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/groq": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-77onMo3RZg6wG9qZQuekqS18YDS1znRZNN6PuBOsSm/TjryttUq4VOhk1HXogc3QWoEaTYGFxjZgZGp3wTJuSg=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/mistral": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-dwb+D7xlLNqxn2PSHe6jCgY0vrrJXdYfTShXjNQLr7o15XgtCuQ76ezXHFHdmkb8I2jdVGiuOe+68hwqMw7ZsA=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/perplexity": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-BlQSjRg3Pqt4pbCHsXTGcWZOjKWifVsF3HVKumKnuOge2FV6nJUjL8k2yUWYZzyuyD5BDhCPAkT3l1cA/JoPnw=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/xai": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/openai-compatible": "2.0.42", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-L9NIlV7iUpx+dLFAtHEeAexugr3zb6Y28zW8WLwaiDcs546VQCgY12toyGn9vJgFleL40J4JUU4J8Ev0XFZnxw=="],+ "@activepieces/engine/ai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-oXIw1oLmuBILuvHgSj6w5LOV8oSnFRouPSv0MGkG9sRMeukZ9JnMF17kldaRQaRq8lSJIxo6aS3NzWlVmSb+4Q=="],"@activepieces/piece-amazon-secrets-manager/@aws-sdk/client-secrets-manager/@aws-sdk/util-endpoints": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-sdk/types": "^3.973.1", "@smithy/types": "^4.12.0", "@smithy/url-parser": "^4.2.8", "@smithy/util-endpoints": "^3.2.8", "tslib": "^2.6.2" } }, "sha512-eKmAOeQM4Qusq0jtcbZPiNWky8XaojByKC/n+THbJ8vJf7t4ys8LlcZ4PrBSHZISe9cC484mQsPVOQh6iySjqw=="],@@ -20939,6 +20816,8 @@"@activepieces/pieces-framework/ai/@ai-sdk/provider": ["@ai-sdk/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-/ngMKqKdL9dSlY/eQ3NFDzzFyw0Hix+cbFFlyuKEKcOgpHdBt/spKUvX/i0wGrDLFPYJeVvv3N0j92LxWRL7yQ=="],+ "@activepieces/pieces-framework/ai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-oXIw1oLmuBILuvHgSj6w5LOV8oSnFRouPSv0MGkG9sRMeukZ9JnMF17kldaRQaRq8lSJIxo6aS3NzWlVmSb+4Q=="],+"@activepieces/sandbox/esbuild/@esbuild/aix-ppc64": ["@esbuild/[email protected]", "", { "os": "aix", "cpu": "ppc64" }, "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ=="],"@activepieces/sandbox/esbuild/@esbuild/android-arm": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g=="],@@ -20991,50 +20870,12 @@"@activepieces/server-utils/@modelcontextprotocol/sdk/eventsource-parser": ["[email protected]", "", {}, "sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA=="],- "@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/anthropic/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/azure/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/cerebras/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/cohere/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/deepgram/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/deepseek/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/elevenlabs/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/fireworks/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/gateway/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/google-vertex/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-"@ai-sdk/google-vertex/google-auth-library/gaxios": ["[email protected]", "", { "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2" } }, "sha512-RB5vLV+vvQeoFPCX4QMK6/hjVkbIamPp1QSUD0CiZcnj12qbpiL+pLbYtgD+oZkWl0tl9z+o2Utp+MpM3QRhBA=="],"@ai-sdk/google-vertex/google-auth-library/gcp-metadata": ["[email protected]", "", { "dependencies": { "gaxios": "^7.0.0", "google-logging-utils": "^1.0.0", "json-bigint": "^1.0.0" } }, "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg=="],"@ai-sdk/google-vertex/google-auth-library/jws": ["[email protected]", "", { "dependencies": { "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA=="],- "@ai-sdk/google/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/groq/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/mistral/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/openai-compatible/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/openai/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/perplexity/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/replicate/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@ai-sdk/xai/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-"@anthropic-ai/sdk/@types/node/undici-types": ["[email protected]", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],"@atlaskit/adf-schema/linkify-it/uc.micro": ["[email protected]", "", {}, "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="],@@ -21279,14 +21120,8 @@"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w=="],- "ai-gateway-provider/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-"ai-gateway-provider/@openrouter/ai-sdk-provider/ai": ["[email protected]", "", { "dependencies": { "@ai-sdk/gateway": "3.0.105", "@ai-sdk/provider": "3.0.9", "@ai-sdk/provider-utils": "4.0.24", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-FWTKeGGDRcYJtPWIrdZDSuvOW5LCjI2NZUJmaml8OTOaPEsXnFdFvmawCXbT+wTGxyWKJTgZ9sZtCjbJsmjM2Q=="],- "ai/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "api/@ai-sdk/mcp/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-"api/@modelcontextprotocol/sdk/eventsource-parser": ["[email protected]", "", {}, "sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA=="],"api/google-auth-library/gaxios": ["[email protected]", "", { "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2", "rimraf": "^5.0.1" } }, "sha512-YGGyuEdVIjqxkxVH1pUTMY/XtmmsApXrCVv5EU25iX6inEPbV+VakJfLealkBtJN69AQmh1eGOdCl9Sm1UP6XQ=="],@@ -22065,26 +21900,10 @@"winston/readable-stream/string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],- "worker/@ai-sdk/mcp/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "4.0.4", "@standard-schema/spec": "^1.1.0", "@workflow/serde": "4.1.0", "eventsource-parser": "^3.0.8", "undici": "^7.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LWDrmYWkZoAJwMbToUglpR6AmgvtnNtCCGeU9MKlXiSV3Yiu4u73/pVA18sQAAe3kZtCRBY9P31lAfnPekWWyg=="],-"zip-stream/readable-stream/string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],"zustand/use-sync-external-store/react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ=="],- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@smithy/eventstream-codec/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],-- "@activepieces/piece-ai/@ai-sdk/amazon-bedrock/@smithy/util-utf8/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/google-auth-library/gaxios": ["[email protected]", "", { "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2", "rimraf": "^5.0.1" } }, "sha512-YGGyuEdVIjqxkxVH1pUTMY/XtmmsApXrCVv5EU25iX6inEPbV+VakJfLealkBtJN69AQmh1eGOdCl9Sm1UP6XQ=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/google-auth-library/gcp-metadata": ["[email protected]", "", { "dependencies": { "gaxios": "^7.0.0", "google-logging-utils": "^1.0.0", "json-bigint": "^1.0.0" } }, "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/google-auth-library/jws": ["[email protected]", "", { "dependencies": { "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/amazon-bedrock/@smithy/eventstream-codec": ["@smithy/[email protected]", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.1", "@smithy/util-hex-encoding": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-erZq0nOIpzfeZdCyzZjdJb4nVSKLUmSkaQUVkRGQTXs30gyUGeKnrYEg+Xe1W5gE3aReS7IgsvANwVPxSzY6Pw=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/amazon-bedrock/@smithy/util-utf8": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-75MeYpjdWRe8M5E3AW0O4Cx3UadweS+cwdXjwYGBW5h/gxxnbeZ877sLPX/ZJA9GVTlL/qG0dXP29JWFCD1Ayw=="],-"@activepieces/piece-gmail/google-auth-library/gaxios/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],"@activepieces/piece-gmail/google-auth-library/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],@@ -22305,8 +22124,6 @@"ai-gateway-provider/@openrouter/ai-sdk-provider/ai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "3.0.9", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-oXIw1oLmuBILuvHgSj6w5LOV8oSnFRouPSv0MGkG9sRMeukZ9JnMF17kldaRQaRq8lSJIxo6aS3NzWlVmSb+4Q=="],- "api/@ai-sdk/mcp/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-"api/google-auth-library/gaxios/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],"api/google-auth-library/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],@@ -22515,16 +22332,6 @@"vite-plugin-checker/chokidar/readdirp/picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],- "worker/@ai-sdk/mcp/@ai-sdk/provider-utils/undici": ["[email protected]", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/google-auth-library/gaxios/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],-- "@activepieces/piece-ai/@ai-sdk/google-vertex/google-auth-library/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/amazon-bedrock/@smithy/eventstream-codec/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],-- "@activepieces/piece-ai/ai-gateway-provider/@ai-sdk/amazon-bedrock/@smithy/util-utf8/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],-"@ai-sdk/google-vertex/google-auth-library/gcp-metadata/gaxios/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],"@atlaskit/editor-json-transformer/@atlaskit/editor-prosemirror/prosemirror-commands/prosemirror-state/prosemirror-view": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.20.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0" } }, "sha512-TnKDdohEatgyZNGCDWIdccOHXhYloJwbwU+phw/a23KBvJIR9lWQWW7WHHK3vBdOLDNuF7TaX98GObUZOWkOnA=="],diff --git a/docs/install/reference/breaking-changes.mdx b/docs/install/reference/breaking-changes.mdxindex 1b58e02a289..c828764cd74 100644--- a/docs/install/reference/breaking-changes.mdx+++ b/docs/install/reference/breaking-changes.mdx@@ -224,6 +224,28 @@ The connection's `Username` and `API Password` fields are removed and replaced wOnly if you have an existing Kimai connection. Reconnect it: in your Kimai instance, generate an API token from your user profile's "API Access" page, then re-enter your Kimai connection in Activepieces with the Server URL and that token. Existing connections using the old username/API-password fields will fail to authenticate until reconnected.+#### The AI provider config endpoint is removed++`GET /v1/ai-providers/:provider/config` returned a provider's decrypted credentials so that an AI step running inside the engine could build the model itself and call the provider directly. AI steps no longer work that way: the worker resolves the credentials and makes the call, which is what lets Activepieces charge managed AI on what the call actually cost. Nothing in the product calls the endpoint any more, and it now returns `404`.++The route only ever accepted an engine token, so it was never reachable with a user token, an API key or from the browser. `GET /v1/ai-providers` and `GET /v1/ai-providers/:provider/models` are unchanged.++#### What you need to do++Nothing on a normal upgrade. Every flow is moved to the AI piece version that runs on the worker the first time its version is read, before it can run.++If you serve pieces from your own registry, make sure it carries the AI piece at `0.11.0` or later. A flow left on an earlier version would still try to fetch its provider credentials over this endpoint and fail.++#### Files passed to an AI step are capped at `AP_MAX_FILE_SIZE_MB`++Extract Structured Data and Generate Image used to read file inputs straight from the flow's memory, so no Activepieces-side size limit applied. Those files are now stored and fetched by the worker that runs the model, which puts them under the same per-file limit as every other file the engine writes: `AP_MAX_FILE_SIZE_MB`, 25 MB by default.++The limit is per file, not per step, so several large files in one step are fine as long as each is under it. On Activepieces Cloud the limit is 10 MB and is not configurable.++#### What you need to do++Nothing unless an AI step handles files larger than 25 MB. Those steps now fail with a size error naming the limit. Raise `AP_MAX_FILE_SIZE_MB` on a self-hosted installation if you need more.+## 0.91.0### What has changed?diff --git a/docs/install/reference/environment-variables.mdx b/docs/install/reference/environment-variables.mdxindex 6dde8acc109..00dca0b93be 100644--- a/docs/install/reference/environment-variables.mdx+++ b/docs/install/reference/environment-variables.mdx@@ -170,6 +170,7 @@ run data is kept. The **Cloud** values and how these interact are covered in| `AP_PAUSED_FLOW_TIMEOUT_DAYS` | Maximum pause duration for a paused flow, in days. Cannot exceed `AP_EXECUTION_DATA_RETENTION_DAYS`, and should be at least 1 day smaller than it (see above). Measured cumulatively from `flow_run.created`, not per-pause — a flow with stacked delays whose sum exceeds this fails at waitpoint creation. Webhook waitpoints without an explicit expiry default to this deadline. | `30` || `AP_ISSUE_ARCHIVE_DAYS` | Issues not updated for this many days are automatically archived. | `7` || `AP_MAX_FILE_SIZE_MB` | Maximum size (MB) for files uploaded in steps or triggers. Larger files are rejected. | `25` |+| `AP_AI_CREDIT_USD_VALUE` | Dollar value of one AI credit. A call on the Activepieces AI provider is billed the dollar cost the provider reports for it, divided by this. A call on your own API key is billed one flat credit and ignores this. | `0.0005` || `AP_MAX_STORE_ENTRY_VALUE_SIZE_KB` | Maximum size (KB) of a single value written by the Store piece or `context.store`. Larger writes are rejected with HTTP 413. | `512` || `AP_MAX_FLOW_RUN_LOG_SIZE_MB` | Maximum combined size (MB) of all step inputs and outputs in a single run. Exceeding it ends the run with `LOG_SIZE_EXCEEDED`. | `50` || `AP_FLOW_RUN_LOG_SLICE_THRESHOLD_KB` | Step outputs larger than this (KB) are offloaded to object storage instead of inlined in the run log. | `32` |diff --git a/packages/core/execution/src/lib/flows/flow-version.ts b/packages/core/execution/src/lib/flows/flow-version.tsindex ff68de29609..a76b8168301 100755--- a/packages/core/execution/src/lib/flows/flow-version.ts+++ b/packages/core/execution/src/lib/flows/flow-version.ts@@ -4,7 +4,7 @@ import { UserWithMetaInformation } from '@activepieces/core-piece-types'import { Note } from './note'import { FlowTrigger } from './triggers/trigger'-export const LATEST_FLOW_SCHEMA_VERSION = '26'+export const LATEST_FLOW_SCHEMA_VERSION = '27'export enum FlowVersionState {LOCKED = 'LOCKED',diff --git a/packages/core/shared/src/lib/management/ai-providers/index.ts b/packages/core/shared/src/lib/management/ai-providers/index.tsindex 2bdd7c0e9c5..8ecd9f0465c 100644--- a/packages/core/shared/src/lib/management/ai-providers/index.ts+++ b/packages/core/shared/src/lib/management/ai-providers/index.ts@@ -461,3 +461,5 @@ export {aiProviderUtils,} from '@activepieces/core-piece-types'export type { ActivepiecesChatTier, AIProviderCapabilities, AIWebSearchMode, OpenAiCompatibleVendor } from '@activepieces/core-piece-types'++export const AI_PIECE_COST_BILLING_VERSION = '0.11.0'diff --git a/packages/pieces/community/ai/package.json b/packages/pieces/community/ai/package.jsonindex 03281a67820..b5fd67b5566 100644--- a/packages/pieces/community/ai/package.json+++ b/packages/pieces/community/ai/package.json@@ -7,19 +7,8 @@"dependencies": {"@activepieces/pieces-common": "workspace:*","@activepieces/pieces-framework": "workspace:*",- "@ai-sdk/amazon-bedrock": "3.0.97",- "@ai-sdk/anthropic": "3.0.72",- "@ai-sdk/azure": "3.0.55",- "@ai-sdk/google": "3.0.65",- "@ai-sdk/google-vertex": "4.0.113","@ai-sdk/mcp": "1.0.11",- "@ai-sdk/openai": "3.0.54",- "@ai-sdk/openai-compatible": "2.0.42",- "@ai-sdk/provider-utils": "4.0.24","@modelcontextprotocol/sdk": "1.26.0",- "@openrouter/ai-sdk-provider": "2.1.1",- "ai": "6.0.170",- "ai-gateway-provider": "3.1.1","ajv": "8.18.0","mime-types": "2.1.35","zod": "4.3.6",diff --git a/packages/pieces/community/ai/src/index.ts b/packages/pieces/community/ai/src/index.tsindex 69570d4343c..9434d9d9ca1 100644--- a/packages/pieces/community/ai/src/index.ts+++ b/packages/pieces/community/ai/src/index.ts@@ -23,5 +23,4 @@ export const ai = createPiece({triggers: [],});-export * from './lib/common/props';-export * from './lib/common/ai-sdk';\ No newline at end of file+export * from './lib/common/props';\ No newline at end of filediff --git a/packages/pieces/community/ai/src/lib/common/ai-sdk.ts b/packages/pieces/community/ai/src/lib/common/ai-sdk.tsdeleted file mode 100644index 77f63564d1a..00000000000--- a/packages/pieces/community/ai/src/lib/common/ai-sdk.ts+++ /dev/null@@ -1,425 +0,0 @@-import { anthropic, createAnthropic } from '@ai-sdk/anthropic'-import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock'-import { createOpenAI, openai } from '@ai-sdk/openai'-import { createGoogleGenerativeAI, google } from '@ai-sdk/google'-import { createVertex } from '@ai-sdk/google-vertex'-import { createVertexAnthropic } from '@ai-sdk/google-vertex/anthropic'-import { createVertexMaas } from '@ai-sdk/google-vertex/maas'-import { createOpenAICompatible } from '@ai-sdk/openai-compatible'-import { createAzure } from '@ai-sdk/azure'-import { createOpenRouter } from '@openrouter/ai-sdk-provider'-import { EmbeddingModel, ImageModel, LanguageModel } from 'ai'-import { ProviderOptions } from '@ai-sdk/provider-utils'-import { httpClient, HttpMethod } from '@activepieces/pieces-common'-import { AI_PROVIDER_CAPABILITIES, AIProviderName, AzureProviderConfig, BaseAIProviderAuthConfig, BedrockProviderAuthConfig, BedrockProviderConfig, CloudflareGatewayProviderConfig, GetProviderConfigResponse, OPENAI_COMPATIBLE_VENDOR_BASE_URLS, OpenAICompatibleProviderConfig, splitCloudflareGatewayModelId, spreadIfDefined, VertexProviderAuthConfig, VertexProviderConfig } from '@activepieces/pieces-framework'-import { createAiGateway } from 'ai-gateway-provider';-import { createAnthropic as createAnthropicGateway } from 'ai-gateway-provider/providers/anthropic';-import { createGoogleGenerativeAI as createGoogleGateway } from 'ai-gateway-provider/providers/google';--const AUTHORIZATION_HEADER = 'authorization'-const VERTEX_MAAS_SUFFIX = '-maas'-const VERTEX_ANTHROPIC_PREFIX = 'claude'--async function fetchProviderConfig(params: { provider: AIProviderName, engineToken: string, apiUrl: string, configId?: string }) {- const { body } = await httpClient.sendRequest<GetProviderConfigResponse>({- method: HttpMethod.GET,- url: `${params.apiUrl}v1/ai-providers/${params.provider}/config`,- headers: {- Authorization: `Bearer ${params.engineToken}`,- },- ...(params.configId === undefined ? {} : { queryParams: { configId: params.configId } }),- })- return body-}--export function createAIModel(params: CreateAIModelParams<false>): Promise<LanguageModel>;-export function createAIModel(params: CreateAIModelParams<true>): Promise<ImageModel>;-export async function createAIModel({- provider,- configId,- modelId,- engineToken,- projectId,- flowId,- runId,- apiUrl,- openaiResponsesModel = false,- isImage,-}: CreateAIModelParams<boolean>): Promise<ImageModel | LanguageModel> {- const { config, auth, platformId } = await fetchProviderConfig({ provider, engineToken, apiUrl, configId });-- if (isImage && !AI_PROVIDER_CAPABILITIES[provider].supportsImageGeneration) {- throw new Error(`Provider ${provider} does not support image models`)- }-- if (provider === AIProviderName.CLOUDFLARE_GATEWAY) {- return buildCloudflareGatewayModel({ auth, config, modelId, isImage, openaiResponsesModel, projectId, flowId, runId })- }-- const metadataHeaders = buildCustomMetadataHeaders({ projectId, platformId, flowId, runId })-- if (isImage) {- const imageModel = buildNativeImageModel({ provider, auth, config, modelId, metadataHeaders })- if (imageModel) {- return imageModel- }- }-- return buildLanguageModel({ provider, auth, config, modelId, openaiResponsesModel, metadataHeaders })-}--export const anthropicSearchTool = anthropic.tools.webSearch_20250305;-export const openaiSearchTool = openai.tools.webSearchPreview;-export const googleSearchTool = google.tools.googleSearch;--const EMBEDDING_DIMENSIONS = 768--const OPENAI_EMBEDDING_PROVIDER_OPTIONS = {- openai: { dimensions: EMBEDDING_DIMENSIONS },-}--export async function createEmbeddingModel({- provider,- engineToken,- apiUrl,-}: CreateEmbeddingModelParams): Promise<CreateEmbeddingModelResult> {- const { config, auth } = await fetchProviderConfig({ provider, engineToken, apiUrl })-- const embeddingModelId = AI_PROVIDER_CAPABILITIES[provider].defaultEmbeddingModel- if (!embeddingModelId) {- throw new Error(`Provider ${provider} does not have a default embedding model configured`)- }-- const { apiKey } = auth as BaseAIProviderAuthConfig-- switch (provider) {- case AIProviderName.OPENAI: {- const p = createOpenAI({ apiKey })- return { model: p.embeddingModel(embeddingModelId), embeddingModelId, providerOptions: OPENAI_EMBEDDING_PROVIDER_OPTIONS }- }- case AIProviderName.GOOGLE: {- const p = createGoogleGenerativeAI({ apiKey })- return { model: p.textEmbeddingModel(embeddingModelId), embeddingModelId, providerOptions: {} }- }- case AIProviderName.AZURE: {- const { resourceName, apiVersion } = config as AzureProviderConfig- const p = createAzure({ resourceName, apiKey, apiVersion })- return { model: p.embeddingModel(embeddingModelId), embeddingModelId, providerOptions: OPENAI_EMBEDDING_PROVIDER_OPTIONS }- }- case AIProviderName.ACTIVEPIECES:- case AIProviderName.OPENROUTER: {- const openRouterProvider = createOpenRouter({ apiKey })- return { model: openRouterProvider.textEmbeddingModel(embeddingModelId), embeddingModelId, providerOptions: OPENAI_EMBEDDING_PROVIDER_OPTIONS }- }- default:- throw new Error(`Provider ${provider} does not support embedding models`)- }-}--// Duplicated from @activepieces/ai-providers on purpose: that package is on ai@7, while this piece,-// pieces-framework and the engine are on ai@6, and the engine runs generateText with the model this-// builds — a v4 model cannot cross that boundary.-// Unify with createLanguageModel once the ai package version is bumped across the repo.-function buildLanguageModel({ provider, auth, config, modelId, openaiResponsesModel, metadataHeaders }: {- provider: AIProviderName- auth: unknown- config: unknown- modelId: string- openaiResponsesModel: boolean- metadataHeaders: Record<string, string>-}): LanguageModel {- switch (provider) {- case AIProviderName.OPENAI: {- const { apiKey } = auth as BaseAIProviderAuthConfig- const client = createOpenAI({ apiKey })- return openaiResponsesModel ? client.responses(modelId) : client.chat(modelId)- }- case AIProviderName.ANTHROPIC: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createAnthropic({ apiKey })(modelId)- }- case AIProviderName.GOOGLE: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createGoogleGenerativeAI({ apiKey })(modelId)- }- case AIProviderName.AZURE: {- const { apiKey } = auth as BaseAIProviderAuthConfig- const { resourceName, apiVersion } = config as AzureProviderConfig- return createAzure({ resourceName, apiKey, apiVersion }).chat(modelId)- }- case AIProviderName.BEDROCK: {- const { accessKeyId, secretAccessKey } = auth as BedrockProviderAuthConfig- const { region } = config as BedrockProviderConfig- return createAmazonBedrock({ region, accessKeyId, secretAccessKey })(modelId)- }- case AIProviderName.VERTEX: {- return vertexClientFor({ modelId })(buildVertexSettings({ auth, config }))(modelId)- }- case AIProviderName.CUSTOM: {- const { apiKey } = auth as BaseAIProviderAuthConfig- const { apiKeyHeader, baseUrl, defaultHeaders, apiStyle } = config as OpenAICompatibleProviderConfig- const headers = {- ...metadataHeaders,- ...(defaultHeaders ?? {}),- [apiKeyHeader]: apiKey,- }- if (apiStyle === 'responses') {- return createOpenAI({- baseURL: baseUrl,- apiKey,- headers,- ...spreadIfDefined('fetch', stripDefaultAuthorization(headers)),- }).responses(modelId)- }- return createOpenAICompatible({- name: 'openai-compatible',- baseURL: baseUrl,- headers,- }).chatModel(modelId)- }- case AIProviderName.MISTRAL: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createOpenAICompatible({ name: 'mistral', baseURL: 'https://api.mistral.ai/v1', apiKey }).chatModel(modelId)- }- case AIProviderName.XAI:- case AIProviderName.DEEPSEEK:- case AIProviderName.ZAI:- case AIProviderName.QWEN:- case AIProviderName.MINIMAX:- case AIProviderName.MOONSHOT: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createOpenAICompatible({- name: provider,- baseURL: OPENAI_COMPATIBLE_VENDOR_BASE_URLS[provider],- apiKey,- }).chatModel(modelId)- }- case AIProviderName.ACTIVEPIECES: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createOpenRouter({ apiKey, headers: metadataHeaders }).chat(modelId) as LanguageModel- }- case AIProviderName.OPENROUTER: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createOpenRouter({ apiKey }).chat(modelId) as LanguageModel- }- default:- throw new Error(`Provider ${provider} is not supported`)- }-}--function vertexClientFor({ modelId }: { modelId: string }): typeof createVertex | typeof createVertexAnthropic | typeof createVertexMaas {- if (modelId.includes('/') || modelId.endsWith(VERTEX_MAAS_SUFFIX)) {- return createVertexMaas- }- if (modelId.toLowerCase().startsWith(VERTEX_ANTHROPIC_PREFIX)) {- return createVertexAnthropic- }- return createVertex-}--function buildVertexSettings({ auth, config }: { auth: unknown, config: unknown }): { project: string, location: string, googleAuthOptions: { credentials: { client_email?: string, private_key?: string } } } {- const { serviceAccountJson } = auth as VertexProviderAuthConfig- const { project, region } = config as VertexProviderConfig- return { project, location: region, googleAuthOptions: { credentials: parseServiceAccount(serviceAccountJson) } }-}--function parseServiceAccount(serviceAccountJson: string): { client_email?: string, private_key?: string } {- const parsed: unknown = JSON.parse(serviceAccountJson)- const fields: Record<string, unknown> = typeof parsed === 'object' && parsed !== null ? { ...parsed } : {}- const clientEmail = fields['client_email']- const privateKey = fields['private_key']- return {- client_email: typeof clientEmail === 'string' ? clientEmail : undefined,- private_key: typeof privateKey === 'string' ? privateKey.replace(/\\n/g, '\n') : undefined,- }-}--function stripDefaultAuthorization(headers: Record<string, string>): typeof globalThis.fetch | undefined {- const carriesAuthorization = Object.keys(headers).some((key) => key.trim().toLowerCase() === AUTHORIZATION_HEADER)- if (carriesAuthorization) {- return undefined- }- return (input, init) => {- const sent = new Headers(init?.headers)- sent.delete(AUTHORIZATION_HEADER)- return fetch(input, { ...init, headers: sent })- }-}--function buildCustomMetadataHeaders({ projectId, platformId, flowId, runId }: {- projectId: string- platformId: string- flowId: string- runId: string-}): Record<string, string> {- return {- 'x-ap-project-id': projectId,- 'x-ap-platform-id': platformId,- 'x-ap-flow-id': flowId,- 'x-ap-run-id': runId,- }-}--function buildNativeImageModel({ provider, auth, config, modelId, metadataHeaders }: {- provider: AIProviderName- auth: unknown- config: unknown- modelId: string- metadataHeaders: Record<string, string>-}): ImageModel | undefined {- switch (provider) {- case AIProviderName.OPENAI: {- const { apiKey } = auth as BaseAIProviderAuthConfig- return createOpenAI({ apiKey }).imageModel(modelId)- }- case AIProviderName.AZURE: {- const { apiKey } = auth as BaseAIProviderAuthConfig- const { resourceName, apiVersion } = config as AzureProviderConfig- return createAzure({ resourceName, apiKey, apiVersion }).imageModel(modelId)- }- case AIProviderName.BEDROCK: {- const { accessKeyId, secretAccessKey } = auth as BedrockProviderAuthConfig- const { region } = config as BedrockProviderConfig- return createAmazonBedrock({ region, accessKeyId, secretAccessKey }).imageModel(modelId)- }- case AIProviderName.VERTEX: {- return createVertex(buildVertexSettings({ auth, config })).imageModel(modelId)- }- case AIProviderName.CUSTOM: {- const { apiKey } = auth as BaseAIProviderAuthConfig- const { apiKeyHeader, baseUrl, defaultHeaders } = config as OpenAICompatibleProviderConfig- return createOpenAICompatible({- name: 'openai-compatible',- baseURL: baseUrl,- headers: {- ...metadataHeaders,- ...(defaultHeaders ?? {}),- [apiKeyHeader]: apiKey,- },- }).imageModel(modelId)- }- default:- return undefined- }-}--function buildCloudflareGatewayModel({ auth, config, modelId, isImage, openaiResponsesModel, projectId, flowId, runId }: {- auth: unknown- config: unknown- modelId: string- isImage?: boolean- openaiResponsesModel: boolean- projectId: string- flowId: string- runId: string-}): ImageModel | LanguageModel {- const { apiKey } = auth as BaseAIProviderAuthConfig- const { accountId, gatewayId, vertexProject, vertexRegion } = config as CloudflareGatewayProviderConfig- const aigateway = createAiGateway({- accountId: accountId,- gateway: gatewayId,- apiKey,- });- const { provider: providerPrefix, model: actualModelId, publisher } = splitCloudflareGatewayModelId(modelId)- const cfMetadataHeaders = {- 'cf-aig-metadata': JSON.stringify({- projectId,- flowId,- runId,- }),- }-- const headers = {- 'cf-aig-authorization': `Bearer ${apiKey}`,- ...cfMetadataHeaders,- }- switch (providerPrefix) {- case 'anthropic': {- const anthropicProvider = createAnthropicGateway({- headers- });- return aigateway(anthropicProvider(actualModelId));- }- case 'google-ai-studio': {- const googleProvider = createGoogleGateway({- headers- });- return aigateway(googleProvider(actualModelId));- }- case 'google-vertex-ai': {- if (vertexProject && vertexRegion && publisher) {- const provider = createGoogleGenerativeAI({- apiKey,- baseURL: `https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/google-vertex-ai/v1/projects/${vertexProject}/locations/${vertexRegion}/publishers/${publisher}/`,- headers,- })- return provider(actualModelId);- }- return handleDefaultAiGatewayProvider({ accountId, gatewayId, headers, isImage, modelId })- }- case 'openai': {- const openaiProvider = createOpenAI({- apiKey: 'no-key',- baseURL: `https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/openai`,- headers,- fetch: (input, init) => {- const hdrs = new Headers(init?.headers)- hdrs.delete('Authorization')- return fetch(input, { ...init, headers: hdrs })- },- })- if (isImage) {- return openaiProvider.imageModel(actualModelId)- }- return openaiResponsesModel- ? openaiProvider.responses(actualModelId)- : openaiProvider.chat(actualModelId)- }- default: {- return handleDefaultAiGatewayProvider({ accountId, gatewayId, headers, isImage, modelId })- }- }-}--const handleDefaultAiGatewayProvider = ({accountId, gatewayId, headers, isImage, modelId}: {- accountId: string;- gatewayId: string;- headers: Record<string, string>;- isImage?: boolean;- modelId: string;-})=>{- const provider = createOpenAICompatible({- name: 'cloudflare',- baseURL: `https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/compat`,- headers,- })- if (isImage) {- return provider.imageModel(modelId)- }- return provider.chatModel(modelId)-}--type CreateAIModelParams<IsImage extends boolean = false> = {- provider: AIProviderName;- configId?: string;- modelId: string;- engineToken: string;- projectId: string;- flowId: string;- runId: string;- apiUrl: string;- openaiResponsesModel?: boolean;- isImage?: IsImage;-}--type CreateEmbeddingModelParams = {- provider: AIProviderName- engineToken: string- apiUrl: string-}--type CreateEmbeddingModelResult = {- model: EmbeddingModel- embeddingModelId: string- providerOptions: ProviderOptions-}diff --git a/packages/pieces/community/ai/src/lib/common/web-search.ts b/packages/pieces/community/ai/src/lib/common/web-search.tsindex 015f39492c5..6c6ee9c2255 100644--- a/packages/pieces/community/ai/src/lib/common/web-search.ts+++ b/packages/pieces/community/ai/src/lib/common/web-search.ts@@ -3,10 +3,7 @@ import {PieceAuth,Property,} from '@activepieces/pieces-framework';-import { ToolSet } from 'ai';-import { ProviderOptions } from '@ai-sdk/provider-utils';import { spreadIfDefined, AIProviderName, getEffectiveProviderAndModel } from '@activepieces/pieces-framework';-import { anthropicSearchTool, openaiSearchTool, googleSearchTool } from './ai-sdk';function buildWebSearchOptionsProps(provider: string, params?: { showIncludeSources?: boolean }): InputPropertyMap {const showIncludeSources = params?.showIncludeSources ?? true;@@ -124,98 +121,6 @@ function buildWebSearchOptionsProps(provider: string, params?: { showIncludeSourreturn options;}-function buildUserLocation(- options: UserLocationOptions-): (UserLocationOptions & { type: 'approximate' }) | undefined {- if (- !options.userLocationCity &&- !options.userLocationRegion &&- !options.userLocationCountry &&- !options.userLocationTimezone- ) {- return undefined;- }-- return {- type: 'approximate' as const,- ...spreadIfDefined('city', options.userLocationCity),- ...spreadIfDefined('region', options.userLocationRegion),- ...spreadIfDefined('country', options.userLocationCountry),- ...spreadIfDefined('timezone', options.userLocationTimezone),- };-}--function createWebSearchTool(- provider: string,- options: WebSearchOptions = {}-): ToolSet {- const defaultMaxUses = 5;-- switch (provider) {- case AIProviderName.ANTHROPIC: {- const anthropicOptions = options as AnthropicWebSearchOptions;-- let allowedDomains: string[] | undefined;- let blockedDomains: string[] | undefined;-- if (- anthropicOptions.allowedDomains &&- anthropicOptions.allowedDomains.length > 0- ) {- allowedDomains = anthropicOptions.allowedDomains.map(- ({ domain }) => domain- );- }-- if (- anthropicOptions.blockedDomains &&- anthropicOptions.blockedDomains.length > 0 &&- (!anthropicOptions.allowedDomains ||- anthropicOptions.allowedDomains.length === 0)- ) {- blockedDomains = anthropicOptions.blockedDomains.map(- ({ domain }) => domain- );- }-- return {- web_search: anthropicSearchTool({- maxUses: anthropicOptions.maxUses ?? defaultMaxUses,- ...spreadIfDefined(- 'userLocation',- buildUserLocation(anthropicOptions)- ),- ...spreadIfDefined('allowedDomains', allowedDomains),- ...spreadIfDefined('blockedDomains', blockedDomains),- }),- } as any;- }-- case AIProviderName.OPENAI: {- const openaiOptions = options as OpenAIWebSearchOptions;-- return {- web_search_preview: openaiSearchTool({- ...spreadIfDefined(- 'searchContextSize',- openaiOptions.searchContextSize- ),- ...spreadIfDefined('userLocation', buildUserLocation(openaiOptions)),- }),- } as any;- }-- case AIProviderName.GOOGLE: {- return {- google_search: googleSearchTool({}),- } as any;- }-- default:- throw new Error(`Provider ${provider} is not supported for web search`);- }-}-export function buildWebSearchOptionsProperty(getProviderAndModel: (propsValue: Record<string, unknown>) => { provider: string | undefined, model: string | undefined },refreshers: string[],@@ -241,48 +146,6 @@ export function buildWebSearchOptionsProperty(});}-export function buildWebSearchConfig(params: {- provider: string- model?: string- webSearchEnabled: boolean- webSearchOptions: WebSearchOptions-}): { tools: ToolSet | undefined, providerOptions: ProviderOptions | undefined } {- const { provider, model, webSearchEnabled, webSearchOptions } = params;-- if (!webSearchEnabled) {- return { tools: undefined, providerOptions: undefined };- }-- const { provider: effectiveProvider } = getEffectiveProviderAndModel({ provider, model });- const resolvedProvider = effectiveProvider ?? provider;-- const isOpenRouter =- resolvedProvider === AIProviderName.OPENROUTER ||- resolvedProvider === AIProviderName.ACTIVEPIECES;-- if (isOpenRouter) {- return {- tools: undefined,- providerOptions: {- openrouter: {- plugins: [{- id: 'web' as const,- max_results: Math.min(- Math.max(webSearchOptions?.maxUses ?? 5, 1),- 10- ),- }],- },- },- };- }-- return {- tools: createWebSearchTool(resolvedProvider, webSearchOptions),- providerOptions: undefined,- };-}-export function usesNativeWebSearchTools({ provider, model }: { provider: string; model: string | undefined }): boolean {const { provider: effectiveProvider } = getEffectiveProviderAndModel({ provider, model });return NATIVE_WEB_SEARCH_PROVIDERS.has(effectiveProvider ?? provider);@@ -351,25 +214,3 @@ const NATIVE_WEB_SEARCH_PROVIDERS: ReadonlySet<string> = new Set([AIProviderName.GOOGLE,]);-type BaseWebSearchOptions = {- maxUses?: number- includeSources?: boolean-}--type UserLocationOptions = {- userLocationCity?: string- userLocationRegion?: string- userLocationCountry?: string- userLocationTimezone?: string-}--type AnthropicWebSearchOptions = BaseWebSearchOptions & UserLocationOptions & {- allowedDomains?: { domain: string }[]- blockedDomains?: { domain: string }[]-}--type OpenAIWebSearchOptions = BaseWebSearchOptions & UserLocationOptions & {- searchContextSize?: 'low' | 'medium' | 'high'-}--export type WebSearchOptions = AnthropicWebSearchOptions | OpenAIWebSearchOptionsdiff --git a/packages/server/api/src/app/ai/ai-credits.ts b/packages/server/api/src/app/ai/ai-credits.tsindex 9dc526695a0..42e1599ab75 100644--- a/packages/server/api/src/app/ai/ai-credits.ts+++ b/packages/server/api/src/app/ai/ai-credits.ts@@ -13,6 +13,13 @@ function creditsForModelCall(usage: AiUsageCharge): number {return usage.costUsd / dollarsPerCredit()}+export function costBasisOf(usage: AiUsageCharge): CostBasis | undefined {+ if (usage.type !== 'observed-cost') {+ return undefined+ }+ return { costUsd: usage.costUsd, creditUsdValue: dollarsPerCredit() }+}+function dollarsPerCredit(): number {const value = system.getDecimalOrThrow(AppSystemProp.AI_CREDIT_USD_VALUE)if (value <= 0) {@@ -22,3 +29,8 @@ function dollarsPerCredit(): number {}const CREDITS_PER_TOOL_CALL = 1++export type CostBasis = {+ costUsd: number+ creditUsdValue: number+}diff --git a/packages/server/api/src/app/ai/ai-provider-controller.ts b/packages/server/api/src/app/ai/ai-provider-controller.tsindex 0fb46d7b293..a991a7bc626 100644--- a/packages/server/api/src/app/ai/ai-provider-controller.ts+++ b/packages/server/api/src/app/ai/ai-provider-controller.ts@@ -5,7 +5,6 @@ import { StatusCodes } from 'http-status-codes'import { z } from 'zod'import { ProjectResourceType } from '../core/security/authorization/common'import { securityAccess } from '../core/security/authorization/fastify-security'-import { assertCreditsAndAppSumoNotExceeded } from '../platform/billing-provider'import { aiProviderService } from './ai-provider-service'export const aiProviderController: FastifyPluginAsyncZod = async (app) => {@@ -24,19 +23,6 @@ export const aiProviderController: FastifyPluginAsyncZod = async (app) => {configId: request.params.id,})})- app.get('/:provider/config', GetAIProviderConfig, async (request) => {- const platformId = request.principal.platform.id- const provider = request.params.provider- if (provider === AIProviderName.ACTIVEPIECES) {- await assertCreditsAndAppSumoNotExceeded({ platformId, log: app.log })- }- return aiProviderService(app.log).getConfigOrThrow({- platformId,- provider,- scope: { type: 'project', projectId: request.principal.projectId },- ...spreadIfDefined('configId', request.query.configId),- })- })app.get('/:provider/models', ListModels, async (request) => {return aiProviderService(app.log).listModels({platformId: request.principal.platform.id,@@ -98,20 +84,6 @@ const ListModelsForConfig = {},}-const GetAIProviderConfig = {- config: {- security: securityAccess.engine(),- },- schema: {- params: z.object({- provider: z.nativeEnum(AIProviderName),- }),- querystring: z.object({- configId: z.string().optional(),- }),- },-}-const ListModels = {config: {security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { type: ProjectResourceType.QUERY }),diff --git a/packages/server/api/src/app/ai/ai-usage-service.ts b/packages/server/api/src/app/ai/ai-usage-service.tsindex b49c76daced..e6f0c51bfbd 100644--- a/packages/server/api/src/app/ai/ai-usage-service.ts+++ b/packages/server/api/src/app/ai/ai-usage-service.ts@@ -4,17 +4,18 @@ import { FastifyBaseLogger } from 'fastify'import { platformPlanService } from '../ee/platform/platform-plan/platform-plan.service'import { trackBillingAndSendTelemetry } from '../platform/billing-and-telemetry'import { AiCreditConsumptionProperties, ChatAppSumoConsumptionProperties, ChatCreditConsumptionProperties, CreditUsageSource } from '../platform/billing-provider'-import { chargeFor } from './ai-credits'+import { chargeFor, CostBasis, costBasisOf } from './ai-credits'import { aiUsageHooks } from './ai-usage-hooks'export const aiUsageService = (log: FastifyBaseLogger) => ({async report(input: ReportAiUsageRequest): Promise<void> {const toolCalls = input.toolCalls ?? 0const credits = chargeFor({ usage: input.usage, toolCalls })+ const costBasis = costBasisOf(input.usage)const platformId = input.billing.platformIdconst platformPlan = await platformPlanService(log).getOrCreateForPlatform(platformId)const appSumo = isAppSumoCreditedPlan(platformPlan.plan)- const chat = chatEventOf(input, toolCalls)+ const chat = chatEventOf({ input, toolCalls, costBasis })if (!isNil(chat)) {await trackBillingAndSendTelemetry({log,@@ -24,7 +25,7 @@ export const aiUsageService = (log: FastifyBaseLogger) => ({})}else {- const properties = billingProperties(input, toolCalls)+ const properties = billingProperties({ input, toolCalls, costBasis })await trackBillingAndSendTelemetry({log,licenseKey: platformPlan.licenseKey,@@ -47,7 +48,7 @@ async function addConversationCredits({ input, credits, log }: { input: ReportAi}}-function chatEventOf(input: ReportAiUsageRequest, toolCalls: number): { credits: ChatCreditConsumptionProperties, appSumo: ChatAppSumoConsumptionProperties } | undefined {+function chatEventOf({ input, toolCalls, costBasis }: PropertiesParams): { credits: ChatCreditConsumptionProperties, appSumo: ChatAppSumoConsumptionProperties } | undefined {if (input.billing.scope !== ActivepiecesAiBillingScope.CONVERSATION || isNil(input.chat)) {return undefined}@@ -66,12 +67,13 @@ function chatEventOf(input: ReportAiUsageRequest, toolCalls: number): { credits:provider: input.provider,model: input.modelId,tier,+ ...costBasis,},appSumo: { platformId: input.billing.platformId, projectId, conversationId, turnIndex, tier },}}-function billingProperties(input: ReportAiUsageRequest, toolCalls: number): AiCreditConsumptionProperties {+function billingProperties({ input, toolCalls, costBasis }: PropertiesParams): AiCreditConsumptionProperties {return {platformId: input.billing.platformId,projectId: projectIdOf(input),@@ -86,6 +88,7 @@ function billingProperties(input: ReportAiUsageRequest, toolCalls: number): AiCrmessages: MESSAGES_PER_MODEL_CALL,toolCalls,}],+ ...costBasis,}}@@ -96,6 +99,12 @@ function projectIdOf(input: ReportAiUsageRequest): string {return input.billing.projectId ?? PROJECTLESS_CHAT}+type PropertiesParams = {+ input: ReportAiUsageRequest+ toolCalls: number+ costBasis: CostBasis | undefined+}+const MESSAGES_PER_MODEL_CALL = 1const PROJECTLESS_CHAT = 'chat'const OUTSIDE_A_FLOW = 'none'diff --git a/packages/server/api/src/app/flows/flow-version/migrations/index.ts b/packages/server/api/src/app/flows/flow-version/migrations/index.tsindex 690739f8e4f..a97e43d6476 100644--- a/packages/server/api/src/app/flows/flow-version/migrations/index.ts+++ b/packages/server/api/src/app/flows/flow-version/migrations/index.ts@@ -20,6 +20,7 @@ import { migrateV22AgentStepToThinClient } from './migrate-v22-agent-step-to-thiimport { migrateV23UpgradePieceVersions } from './migrate-v23-upgrade-piece-versions'import { migrateV24OpenaiPieceVersion } from './migrate-v24-openai-piece-version'import { migrateV25HttpPieceVersion } from './migrate-v25-http-piece-version'+import { migrateV26AiPieceCostBilling } from './migrate-v26-ai-piece-cost-billing'import { migrateAgentPieceV3 } from './migrate-v3-agent-piece'import { migrateAgentPieceV4 } from './migrate-v4-agent-piece'import { migrateHttpToWebhookV5 } from './migrate-v5-http-to-webhook'@@ -66,6 +67,7 @@ const migrations: Migration[] = [migrateV23UpgradePieceVersions,migrateV24OpenaiPieceVersion,migrateV25HttpPieceVersion,+ migrateV26AiPieceCostBilling,] as constexport const flowMigrations = {diff --git a/packages/server/api/src/app/flows/flow-version/migrations/migrate-v26-ai-piece-cost-billing.ts b/packages/server/api/src/app/flows/flow-version/migrations/migrate-v26-ai-piece-cost-billing.tsnew file mode 100644index 00000000000..2a1a86a6723--- /dev/null+++ b/packages/server/api/src/app/flows/flow-version/migrations/migrate-v26-ai-piece-cost-billing.ts@@ -0,0 +1,41 @@+import { AgentPieceProps, AI_PIECE_COST_BILLING_VERSION, AI_PIECE_NAME, FlowActionType, flowStructureUtil, FlowVersion } from '@activepieces/shared'+import semver from 'semver'+import { Migration } from '.'++export const migrateV26AiPieceCostBilling: Migration = {+ targetSchemaVersion: '26',+ migrate: async (flowVersion: FlowVersion): Promise<FlowVersion> => {+ const newVersion = flowStructureUtil.transferFlow(flowVersion, (step) => {+ if (step.type !== FlowActionType.PIECE || step.settings.pieceName !== AI_PIECE_NAME) {+ return step+ }+ return {+ ...step,+ settings: {+ ...step.settings,+ pieceVersion: isBelowCostBillingVersion(step.settings.pieceVersion) ? AI_PIECE_COST_BILLING_VERSION : step.settings.pieceVersion,+ input: withAgentMaxSteps({ actionName: step.settings.actionName, input: step.settings.input }),+ },+ }+ })+ return { ...newVersion, schemaVersion: '27' }+ },+}++function withAgentMaxSteps({ actionName, input }: { actionName?: string, input: Record<string, unknown> }): Record<string, unknown> {+ if (actionName !== AGENT_ACTION_NAME || typeof input[AgentPieceProps.MAX_STEPS] === 'number') {+ return input+ }+ return { ...input, [AgentPieceProps.MAX_STEPS]: DEFAULT_MAX_STEPS }+}++function isBelowCostBillingVersion(pieceVersion: string): boolean {+ const current = semver.coerce(pieceVersion)+ if (current === null) {+ return true+ }+ return semver.lt(current, AI_PIECE_COST_BILLING_VERSION)+}++const AGENT_ACTION_NAME = 'run_agent'+const DEFAULT_MAX_STEPS = 20diff --git a/packages/server/api/src/app/platform/billing-provider.ts b/packages/server/api/src/app/platform/billing-provider.tsindex 75c284c6bd5..f809bbdb742 100644--- a/packages/server/api/src/app/platform/billing-provider.ts+++ b/packages/server/api/src/app/platform/billing-provider.ts@@ -190,6 +190,8 @@ export type AiCreditConsumptionProperties = FlowRunCreditConsumptionProperties &messages: numbertoolCalls: numberbreakdown: CreditEventBreakdownEntry[]+ costUsd?: number+ creditUsdValue?: number}export type McpCallCreditConsumptionProperties = {@@ -208,6 +210,8 @@ export type ChatCreditConsumptionProperties = CreditConsumptionPropertiesBase &provider: string | nullmodel: string | nulltier: string+ costUsd?: number+ creditUsdValue?: number}export type ChatAppSumoConsumptionProperties = CreditConsumptionPropertiesBase & {diff --git a/packages/server/api/src/app/tool-search/embedder.ts b/packages/server/api/src/app/tool-search/embedder.tsindex a9899aadb19..0c021d7123c 100644--- a/packages/server/api/src/app/tool-search/embedder.ts+++ b/packages/server/api/src/app/tool-search/embedder.ts@@ -38,7 +38,7 @@ export function l2normalize(vector: number[]): number[] {/*** Search-LOCAL OpenAI embedder at 1024-d. Deliberately does NOT touch AP's shared- * `createEmbeddingModel` (hardcoded 768-d, ai-sdk.ts:222) — it constructs its own provider+ * `aiUtils.createEmbeddingModel` (hardcoded 768-d) — it constructs its own provider* and passes `dimensions: 1024` so the KB/agent path is unaffected (ENGINE_IMPLEMENTATION §3).*/export function createOpenAiEmbedder(apiKey: string): ToolSearchEmbedder {diff --git a/packages/server/api/src/assets/piece-upgrade-register.json b/packages/server/api/src/assets/piece-upgrade-register.jsonindex efe8ee7011d..5fb5395438b 100644--- a/packages/server/api/src/assets/piece-upgrade-register.json+++ b/packages/server/api/src/assets/piece-upgrade-register.json@@ -109,49 +109,49 @@"0.1.4": {"target": "0.1.5"}},"@activepieces/piece-ai": {- "0.0.1": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.2": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.3": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.4": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.5": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.6": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.7": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.8": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.0.9": {"target": "0.4.5", "unsafeSteps": ["run_agent"]},- "0.1.0": {"target": "0.4.5"},- "0.1.1": {"target": "0.4.5"},- "0.1.2": {"target": "0.4.5"},- "0.1.3": {"target": "0.4.5"},- "0.1.4": {"target": "0.4.5"},- "0.1.5": {"target": "0.4.5"},- "0.1.9": {"target": "0.4.5"},- "0.1.10": {"target": "0.4.5"},- "0.1.12": {"target": "0.4.5"},- "0.1.13": {"target": "0.4.5"},- "0.1.14": {"target": "0.4.5"},- "0.1.15": {"target": "0.4.5"},- "0.1.16": {"target": "0.4.5"},- "0.1.17": {"target": "0.4.5"},- "0.1.18": {"target": "0.4.5"},- "0.1.19": {"target": "0.4.5"},- "0.1.20": {"target": "0.4.5"},- "0.1.21": {"target": "0.4.5"},- "0.2.0": {"target": "0.4.5"},- "0.3.0": {"target": "0.4.5"},- "0.3.1": {"target": "0.4.5"},- "0.3.2": {"target": "0.4.5"},- "0.3.3": {"target": "0.4.5"},- "0.3.4": {"target": "0.4.5"},- "0.3.5": {"target": "0.4.5"},- "0.3.6": {"target": "0.4.5"},- "0.3.7": {"target": "0.4.5"},- "0.3.8": {"target": "0.4.5"},- "0.3.9": {"target": "0.4.5"},- "0.4.0": {"target": "0.4.5"},- "0.4.1": {"target": "0.4.5"},- "0.4.2": {"target": "0.4.5"},- "0.4.3": {"target": "0.4.5"},- "0.4.4": {"target": "0.4.5"}+ "0.0.1": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.2": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.3": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.4": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.5": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.6": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.7": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.8": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.0.9": {"target": "0.11.0", "unsafeSteps": ["run_agent"]},+ "0.1.0": {"target": "0.11.0"},+ "0.1.1": {"target": "0.11.0"},+ "0.1.2": {"target": "0.11.0"},+ "0.1.3": {"target": "0.11.0"},+ "0.1.4": {"target": "0.11.0"},+ "0.1.5": {"target": "0.11.0"},+ "0.1.9": {"target": "0.11.0"},+ "0.1.10": {"target": "0.11.0"},+ "0.1.12": {"target": "0.11.0"},+ "0.1.13": {"target": "0.11.0"},+ "0.1.14": {"target": "0.11.0"},+ "0.1.15": {"target": "0.11.0"},+ "0.1.16": {"target": "0.11.0"},+ "0.1.17": {"target": "0.11.0"},+ "0.1.18": {"target": "0.11.0"},+ "0.1.19": {"target": "0.11.0"},+ "0.1.20": {"target": "0.11.0"},+ "0.1.21": {"target": "0.11.0"},+ "0.2.0": {"target": "0.11.0"},+ "0.3.0": {"target": "0.11.0"},+ "0.3.1": {"target": "0.11.0"},+ "0.3.2": {"target": "0.11.0"},+ "0.3.3": {"target": "0.11.0"},+ "0.3.4": {"target": "0.11.0"},+ "0.3.5": {"target": "0.11.0"},+ "0.3.6": {"target": "0.11.0"},+ "0.3.7": {"target": "0.11.0"},+ "0.3.8": {"target": "0.11.0"},+ "0.3.9": {"target": "0.11.0"},+ "0.4.0": {"target": "0.11.0"},+ "0.4.1": {"target": "0.11.0"},+ "0.4.2": {"target": "0.11.0"},+ "0.4.3": {"target": "0.11.0"},+ "0.4.4": {"target": "0.11.0"}},"@activepieces/piece-aianswer": {"0.0.1": {"target": "0.1.6"},diff --git a/packages/server/api/test/integration/ce/ai-provider/ai-provider.test.ts b/packages/server/api/test/integration/ce/ai-provider/ai-provider.test.tsindex 0016f62591a..d8bf2719760 100644--- a/packages/server/api/test/integration/ce/ai-provider/ai-provider.test.ts+++ b/packages/server/api/test/integration/ce/ai-provider/ai-provider.test.ts@@ -87,7 +87,7 @@ describe('AI Providers API', () => {})describe('GET /v1/ai-providers/:provider/config', () => {- it('should return config with defaultHeaders and platformId', async () => {+ it('is removed, so an engine token no longer reaches a provider key', async () => {await mockAndSaveAIProvider({platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,@@ -113,44 +113,7 @@ describe('AI Providers API', () => {headers: { authorization: `Bearer ${engineToken}` },})- expect(response?.statusCode).toBe(StatusCodes.OK)- const body = response?.json()-- expect(body.provider).toBe(AIProviderName.CUSTOM)- expect(body.platformId).toBe(ctx.platform.id)- expect(body.config.defaultHeaders).toEqual({ 'X-Org': 'org-789' })- })-- it('should return platformId even without custom headers config', async () => {- await mockAndSaveAIProvider({- platformId: ctx.platform.id,- provider: AIProviderName.CUSTOM,- displayName: 'Minimal Provider',- config: {- baseUrl: 'https://api.example.com/v1',- apiKeyHeader: 'Authorization',- models: [],- },- })-- const engineToken = await generateMockToken({- type: PrincipalType.ENGINE,- id: apId(),- projectId: ctx.project.id,- platform: { id: ctx.platform.id },- })-- const response = await app!.inject({- method: 'GET',- url: `/api/v1/ai-providers/${AIProviderName.CUSTOM}/config`,- headers: { authorization: `Bearer ${engineToken}` },- })-- expect(response?.statusCode).toBe(StatusCodes.OK)- const body = response?.json()-- expect(body.platformId).toBe(ctx.platform.id)- expect(body.config.defaultHeaders).toBeUndefined()+ expect(response?.statusCode).toBe(StatusCodes.NOT_FOUND)})})@@ -393,23 +356,27 @@ describe('AI Providers API', () => {platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'All projects',- config: customConfig('https://all.example.com'),+ config: customConfig('https://all.example.com', [+ { modelId: 'all-projects-model', modelName: 'All Projects Model', modelType: AIProviderModelType.TEXT },+ ]),created: '2026-08-10T00:00:00.000Z',})await mockAndSaveAIProvider({platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Scoped',- config: { baseUrl: 'https://scoped.example.com', apiKeyHeader: 'Authorization', models: [] },+ config: customConfig('https://scoped.example.com', [+ { modelId: 'scoped-model', modelName: 'Scoped Model', modelType: AIProviderModelType.TEXT },+ ]),projectScope: 'selected',projectIds: [ctx.project.id],created: '2026-08-01T00:00:00.000Z',})- const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config`, ctx.project.id)+ const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models`, ctx.project.id)expect(response?.statusCode).toBe(StatusCodes.OK)- expect(response?.json().config.baseUrl).toBe('https://scoped.example.com')+ expect(response?.json().map((model: { id: string }) => model.id)).toEqual(['scoped-model'])})it('breaks specificity ties by newest created', async () => {@@ -417,21 +384,25 @@ describe('AI Providers API', () => {platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Older',- config: customConfig('https://older.example.com'),+ config: customConfig('https://older.example.com', [+ { modelId: 'older-model', modelName: 'Older Model', modelType: AIProviderModelType.TEXT },+ ]),created: '2026-08-01T00:00:00.000Z',})await mockAndSaveAIProvider({platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Newer',- config: customConfig('https://newer.example.com'),+ config: customConfig('https://newer.example.com', [+ { modelId: 'newer-model', modelName: 'Newer Model', modelType: AIProviderModelType.TEXT },+ ]),created: '2026-08-10T00:00:00.000Z',})- const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config`, ctx.project.id)+ const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models`, ctx.project.id)expect(response?.statusCode).toBe(StatusCodes.OK)- expect(response?.json().config.baseUrl).toBe('https://newer.example.com')+ expect(response?.json().map((model: { id: string }) => model.id)).toEqual(['newer-model'])})it('excludes a project listed in an except scope', async () => {@@ -439,12 +410,12 @@ describe('AI Providers API', () => {platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Except this project',- config: { baseUrl: 'https://except.example.com', apiKeyHeader: 'Authorization', models: [] },+ config: customConfig('https://except.example.com'),projectScope: 'except',projectIds: [ctx.project.id],})- const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config`, ctx.project.id)+ const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models`, ctx.project.id)expect(response?.statusCode).toBe(StatusCodes.NOT_FOUND)})@@ -454,15 +425,17 @@ describe('AI Providers API', () => {platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Except another project',- config: customConfig('https://except-other.example.com'),+ config: customConfig('https://except-other.example.com', [+ { modelId: 'except-other-model', modelName: 'Except Other Model', modelType: AIProviderModelType.TEXT },+ ]),projectScope: 'except',projectIds: [apId()],})- const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config`, ctx.project.id)+ const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models`, ctx.project.id)expect(response?.statusCode).toBe(StatusCodes.OK)- expect(response?.json().config.baseUrl).toBe('https://except-other.example.com')+ expect(response?.json().map((model: { id: string }) => model.id)).toEqual(['except-other-model'])})it('lists one entry per provider for an engine caller, whatever the key count', async () => {@@ -714,24 +687,28 @@ describe('AI Providers API', () => {platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Older',- config: customConfig('https://older.example.com'),+ config: customConfig('https://older.example.com', [+ { modelId: 'older-model', modelName: 'Older Model', modelType: AIProviderModelType.TEXT },+ ]),created: '2026-08-01T00:00:00.000Z',})await mockAndSaveAIProvider({platformId: ctx.platform.id,provider: AIProviderName.CUSTOM,displayName: 'Newer',- config: customConfig('https://newer.example.com'),+ config: customConfig('https://newer.example.com', [+ { modelId: 'newer-model', modelName: 'Newer Model', modelType: AIProviderModelType.TEXT },+ ]),created: '2026-08-10T00:00:00.000Z',})- const pinned = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config?configId=${older.id}`, ctx.project.id)+ const pinned = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models?configId=${older.id}`, ctx.project.id)expect(pinned?.statusCode).toBe(StatusCodes.OK)- expect(pinned?.json().config.baseUrl).toBe('https://older.example.com')- expect(pinned?.json().configId).toBe(older.id)+ expect(pinned?.json().map((model: { id: string }) => model.id)).toEqual(['older-model'])- const automatic = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config`, ctx.project.id)- expect(automatic?.json().config.baseUrl).toBe('https://newer.example.com')+ const automatic = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models`, ctx.project.id)+ expect(automatic?.statusCode).toBe(StatusCodes.OK)+ expect(automatic?.json().map((model: { id: string }) => model.id)).toEqual(['newer-model'])})it('refuses a key whose project scope excludes the caller project', async () => {@@ -750,7 +727,7 @@ describe('AI Providers API', () => {config: customConfig('https://mine.example.com'),})- const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config?configId=${excluded.id}`, ctx.project.id)+ const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models?configId=${excluded.id}`, ctx.project.id)expect(response?.statusCode).toBe(StatusCodes.NOT_FOUND)})@@ -768,7 +745,7 @@ describe('AI Providers API', () => {config: customConfig('https://custom.example.com'),})- const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/config?configId=${openai.id}`, ctx.project.id)+ const response = await engineGet(`/api/v1/ai-providers/${AIProviderName.CUSTOM}/models?configId=${openai.id}`, ctx.project.id)expect(response?.statusCode).toBe(StatusCodes.NOT_FOUND)})diff --git a/packages/server/api/test/unit/app/ai/ai-credits.test.ts b/packages/server/api/test/unit/app/ai/ai-credits.test.tsindex cc652d38e30..7042161bafe 100644--- a/packages/server/api/test/unit/app/ai/ai-credits.test.ts+++ b/packages/server/api/test/unit/app/ai/ai-credits.test.ts@@ -1,3 +1,4 @@+import { AiUsageCharge } from '@activepieces/shared'import { describe, expect, it, vi } from 'vitest'const rate = { value: 0.0005 }@@ -6,7 +7,7 @@ vi.mock('../../../../src/app/helper/system/system', () => ({system: { getDecimalOrThrow: () => rate.value },}))-const { chargeFor } = await import('../../../../src/app/ai/ai-credits')+const { chargeFor, costBasisOf } = await import('../../../../src/app/ai/ai-credits')describe('chargeFor', () => {it('converts an observed dollar cost at the configured rate', () => {@@ -54,3 +55,25 @@ describe('chargeFor', () => {rate.value = 0.0005})})++describe('costBasisOf', () => {+ it('records the dollars the call cost and the rate they were converted at', () => {+ expect(costBasisOf({ type: 'observed-cost', costUsd: 0.005 })).toEqual({ costUsd: 0.005, creditUsdValue: 0.0005 })+ })++ it('records the rate in force at the time, so a later rate change cannot rewrite what was charged', () => {+ rate.value = 0.001+ expect(costBasisOf({ type: 'observed-cost', costUsd: 0.005 })).toEqual({ costUsd: 0.005, creditUsdValue: 0.001 })+ rate.value = 0.0005+ })++ it('reports a basis a reader can divide back into the credits that were billed', () => {+ const usage: AiUsageCharge = { type: 'observed-cost', costUsd: 0.0037 }+ const basis = costBasisOf(usage)+ expect(basis!.costUsd / basis!.creditUsdValue).toBeCloseTo(chargeFor({ usage }), 6)+ })++ it('records nothing for a flat charge, which never went through a dollar rate', () => {+ expect(costBasisOf({ type: 'flat-credits', credits: 1 })).toBeUndefined()+ })+})diff --git a/packages/server/api/test/unit/app/flows/flow-version/migrate-v26-ai-piece-cost-billing.test.ts b/packages/server/api/test/unit/app/flows/flow-version/migrate-v26-ai-piece-cost-billing.test.tsnew file mode 100644index 00000000000..310b10ba830--- /dev/null+++ b/packages/server/api/test/unit/app/flows/flow-version/migrate-v26-ai-piece-cost-billing.test.ts@@ -0,0 +1,136 @@+import {+ AI_PIECE_COST_BILLING_VERSION,+ AI_PIECE_NAME,+ FlowActionType,+ FlowTriggerType,+ FlowVersion,+ FlowVersionState,+} from '@activepieces/shared'+import { describe, expect, it } from 'vitest'+import { migrateV26AiPieceCostBilling } from '../../../../../src/app/flows/flow-version/migrations/migrate-v26-ai-piece-cost-billing'++const baseVersion = (trigger: FlowVersion['trigger']): FlowVersion => ({+ id: 'fv-1',+ displayName: 'fixture',+ flowId: 'flow-1',+ created: new Date().toISOString(),+ updated: new Date().toISOString(),+ updatedBy: null,+ valid: true,+ trigger,+ state: FlowVersionState.DRAFT,+ schemaVersion: '26',+ connectionIds: [],+ agentIds: [],+ notes: [],+})++const trigger = (): FlowVersion['trigger'] => ({+ type: FlowTriggerType.PIECE,+ name: 'trigger',+ displayName: 'Trigger',+ valid: true,+ lastUpdatedDate: new Date().toISOString(),+ settings: {+ pieceName: '@activepieces/piece-webhook',+ pieceVersion: '0.0.1',+ triggerName: 'catch_request',+ input: {},+ propertySettings: {},+ },+})++const withAiStep = ({ pieceVersion, actionName = 'askAi', pieceName = AI_PIECE_NAME, input = {} }: {+ pieceVersion: string+ actionName?: string+ pieceName?: string+ input?: Record<string, unknown>+}): FlowVersion => baseVersion({+ ...trigger(),+ nextAction: {+ type: FlowActionType.PIECE,+ name: 'step_1',+ displayName: 'Step 1',+ skip: false,+ valid: true,+ lastUpdatedDate: new Date().toISOString(),+ settings: {+ pieceName,+ pieceVersion,+ actionName,+ input,+ propertySettings: {},+ },+ },+})++async function migratedVersionOf(version: FlowVersion): Promise<string | undefined> {+ const result = await migrateV26AiPieceCostBilling.migrate(version)+ return result.trigger.nextAction?.settings.pieceVersion+}++async function migratedInputOf(version: FlowVersion): Promise<Record<string, unknown> | undefined> {+ const result = await migrateV26AiPieceCostBilling.migrate(version)+ const step = result.trigger.nextAction+ return step?.type === FlowActionType.PIECE ? step.settings.input : undefined+}++describe('migrateV26AiPieceCostBilling', () => {+ it('moves a step left behind at the old register target onto the cost-reporting version', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: '0.4.5' }))).toBe('0.11.0')+ })++ it('moves an agent step too, so a managed agent run is metered like any other call', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: '0.6.0', actionName: 'run_agent' }))).toBe('0.11.0')+ })++ it('moves the newest version that still predates cost reporting', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: '0.10.1' }))).toBe('0.11.0')+ })++ it('leaves a step already on the cost-reporting version alone', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: '0.11.0' }))).toBe('0.11.0')+ })++ it('never downgrades a step that is ahead of the target', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: '0.12.3' }))).toBe('0.12.3')+ })++ it('moves a step whose version cannot be parsed, since it cannot be reporting cost', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: 'not-a-version' }))).toBe('0.11.0')+ })++ it('leaves every other piece untouched', async () => {+ expect(await migratedVersionOf(withAiStep({ pieceVersion: '0.1.0', pieceName: '@activepieces/piece-openai' }))).toBe('0.1.0')+ })++ it('fills in the max steps an agent step needs, since the new version requires it and the engine applies no default', async () => {+ const input = await migratedInputOf(withAiStep({ pieceVersion: '0.0.5', actionName: 'run_agent', input: { prompt: 'hi' } }))+ expect(input).toEqual({ prompt: 'hi', maxSteps: 20 })+ })++ it('keeps the max steps an agent step already chose', async () => {+ const input = await migratedInputOf(withAiStep({ pieceVersion: '0.6.0', actionName: 'run_agent', input: { maxSteps: 5 } }))+ expect(input).toEqual({ maxSteps: 5 })+ })++ it('leaves the input of a non-agent AI action untouched', async () => {+ const input = await migratedInputOf(withAiStep({ pieceVersion: '0.4.5', actionName: 'askAi', input: { prompt: 'hi' } }))+ expect(input).toEqual({ prompt: 'hi' })+ })++ it('leaves a non-agent input alone when the step is not being moved at all', async () => {+ const input = await migratedInputOf(withAiStep({ pieceVersion: '0.12.3', actionName: 'askAi', input: { prompt: 'hi' } }))+ expect(input).toEqual({ prompt: 'hi' })+ })++ it('fills in max steps for an agent already on the billing version, which the upgrade register can leave without one', async () => {+ const input = await migratedInputOf(withAiStep({ pieceVersion: AI_PIECE_COST_BILLING_VERSION, actionName: 'run_agent', input: { prompt: 'hi' } }))+ expect(input).toEqual({ prompt: 'hi', maxSteps: 20 })+ })++ it('advances the schema version so the migration runs once', async () => {+ const result = await migrateV26AiPieceCostBilling.migrate(withAiStep({ pieceVersion: '0.4.5' }))+ expect(result.schemaVersion).toBe('27')+ })+})diff --git a/packages/web/public/locales/de/translation.json b/packages/web/public/locales/de/translation.jsonindex 1f4e34d6b25..61dadd21191 100644--- a/packages/web/public/locales/de/translation.json+++ b/packages/web/public/locales/de/translation.json@@ -711,7 +711,7 @@"Voice input": "Spracheingabe","Drop files here": "Dateien hier ablegen","Release to add files to your message": "Loslassen, um Dateien zu Ihrer Nachricht hinzuzufügen",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "Abgelaufen","Using this {name} account": "Benutze dieses {name} Konto","Which {name} account should I use?": "Welcher {name} Account soll ich verwenden?",diff --git a/packages/web/public/locales/en/translation.json b/packages/web/public/locales/en/translation.jsonindex 4711ceb6271..bc37ea26420 100644--- a/packages/web/public/locales/en/translation.json+++ b/packages/web/public/locales/en/translation.json@@ -867,7 +867,7 @@"Voice input": "Voice input","Drop files here": "Drop files here","Release to add files to your message": "Release to add files to your message",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.","Expired": "Expired","Using this {name} account": "Using this {name} account","Which {name} account should I use?": "Which {name} account should I use?",diff --git a/packages/web/public/locales/es/translation.json b/packages/web/public/locales/es/translation.jsonindex bea648afb37..1ead5d837ce 100644--- a/packages/web/public/locales/es/translation.json+++ b/packages/web/public/locales/es/translation.json@@ -711,7 +711,7 @@"Voice input": "Entrada de voz","Drop files here": "Soltar archivos aquí","Release to add files to your message": "Suelta para añadir archivos a tu mensaje",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "Caducó","Using this {name} account": "Usando esta cuenta {name}","Which {name} account should I use?": "¿Qué cuenta de {name} debo usar?",diff --git a/packages/web/public/locales/fr/translation.json b/packages/web/public/locales/fr/translation.jsonindex e7084f5b758..068a8ef8e66 100644--- a/packages/web/public/locales/fr/translation.json+++ b/packages/web/public/locales/fr/translation.json@@ -711,7 +711,7 @@"Voice input": "Saisie vocale","Drop files here": "Déposer des fichiers ici","Release to add files to your message": "Relâchez pour ajouter des fichiers à votre message",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "Expiré","Using this {name} account": "Utiliser ce compte {name}","Which {name} account should I use?": "Quel compte {name} dois-je utiliser ?",diff --git a/packages/web/public/locales/ja/translation.json b/packages/web/public/locales/ja/translation.jsonindex 5599d578b76..7e0ba8a0027 100644--- a/packages/web/public/locales/ja/translation.json+++ b/packages/web/public/locales/ja/translation.json@@ -711,7 +711,7 @@"Voice input": "音声入力","Drop files here": "ここにファイルをドロップ","Release to add files to your message": "メッセージにファイルを追加するには、離してください",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "期限切れ","Using this {name} account": "この {name} アカウントを使用する","Which {name} account should I use?": "どの {name} アカウントを使用すればいいですか?",diff --git a/packages/web/public/locales/nl/translation.json b/packages/web/public/locales/nl/translation.jsonindex b2190630f5e..2185d60ed04 100644--- a/packages/web/public/locales/nl/translation.json+++ b/packages/web/public/locales/nl/translation.json@@ -711,7 +711,7 @@"Voice input": "Spraak-invoer","Drop files here": "Sleep bestanden hier naartoe","Release to add files to your message": "Loslaten om bestanden aan je bericht toe te voegen",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "Verlopen","Using this {name} account": "Dit {name} account wordt gebruikt","Which {name} account should I use?": "Welk {name} account moet ik gebruiken?",diff --git a/packages/web/public/locales/pt/translation.json b/packages/web/public/locales/pt/translation.jsonindex 3aaca821da3..6d14eaf37f8 100644--- a/packages/web/public/locales/pt/translation.json+++ b/packages/web/public/locales/pt/translation.json@@ -711,7 +711,7 @@"Voice input": "Entrada por voz","Drop files here": "Solte os arquivos aqui","Release to add files to your message": "Solte para adicionar arquivos em sua mensagem",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "Expirado","Using this {name} account": "Usando esta conta {name}","Which {name} account should I use?": "Qual conta {name} devo usar?",diff --git a/packages/web/public/locales/zh-TW/translation.json b/packages/web/public/locales/zh-TW/translation.jsonindex 85e896ec846..7bb729cdf64 100644--- a/packages/web/public/locales/zh-TW/translation.json+++ b/packages/web/public/locales/zh-TW/translation.json@@ -711,7 +711,7 @@"Voice input": "","Drop files here": "","Release to add files to your message": "",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "","Using this {name} account": "","Which {name} account should I use?": "",diff --git a/packages/web/public/locales/zh/translation.json b/packages/web/public/locales/zh/translation.jsonindex 6db227343d9..a66c4bcb67e 100644--- a/packages/web/public/locales/zh/translation.json+++ b/packages/web/public/locales/zh/translation.json@@ -711,7 +711,7 @@"Voice input": "Voice input","Drop files here": "Drop files here","Release to add files to your message": "Release to add files to your message",- "Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "",+ "Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.": "","Expired": "已过期","Using this {name} account": "Using this {name} account","Which {name} account should I use?": "Which {name} account should I use?",diff --git a/packages/web/src/app/routes/chat-with-ai/components/chat-model-selector.tsx b/packages/web/src/app/routes/chat-with-ai/components/chat-model-selector.tsxindex 33cab94657e..9e8a80ab8d8 100644--- a/packages/web/src/app/routes/chat-with-ai/components/chat-model-selector.tsx+++ b/packages/web/src/app/routes/chat-with-ai/components/chat-model-selector.tsx@@ -186,7 +186,7 @@ export function ChatModelSelector({{showCredits && (<div className="border-t px-3 py-2 text-xs text-muted-foreground">{t(- 'Credits are charged on what each message actually costs, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.',+ 'Credits are charged based on how much work the agent does, plus {count, plural, =1 {1 credit} other {# credits}} per tool call.',{ count: CHAT_CREDITS_PER_TOOL_CALL },)}</div>diff --git a/packages/web/src/features/billing/components/chat-credits-alert.tsx b/packages/web/src/features/billing/components/chat-credits-alert.tsxindex c4d3fba8834..9dbf21f71fa 100644--- a/packages/web/src/features/billing/components/chat-credits-alert.tsx+++ b/packages/web/src/features/billing/components/chat-credits-alert.tsx@@ -36,7 +36,7 @@ export function ChatCreditsAlert({><AlertTriangle className="h-3.5 w-3.5 shrink-0" /><span className="flex-1">{message}</span>- <CreditsActionButton className="shrink-0" variant="accent" />+ <CreditsActionButton className="shrink-0" variant="default" />{!isError && (<Buttonvariant="ghost"diff --git a/packages/web/src/features/billing/components/credits-action-button.tsx b/packages/web/src/features/billing/components/credits-action-button.tsxindex b6c20587ded..313ed89d413 100644--- a/packages/web/src/features/billing/components/credits-action-button.tsx+++ b/packages/web/src/features/billing/components/credits-action-button.tsx@@ -87,4 +87,4 @@ type CreditsActionButtonProps = {variant?: CreditsActionButtonVariant;};-type CreditsActionButtonVariant = 'basic' | 'accent';+type CreditsActionButtonVariant = 'basic' | 'accent' | 'default';diff --git a/packages/web/src/features/billing/components/credits-usage-alert.tsx b/packages/web/src/features/billing/components/credits-usage-alert.tsxindex b455e3eb672..e26be4385e3 100644--- a/packages/web/src/features/billing/components/credits-usage-alert.tsx+++ b/packages/web/src/features/billing/components/credits-usage-alert.tsx@@ -92,7 +92,7 @@ export const CreditsUsageAlert = React.memo(() => {<Alertvariant={isDanger ? 'destructive' : 'warning'}className={cn(- 'flex items-center gap-2 py-2',+ 'flex items-center gap-2 py-2 *:[svg]:translate-y-0',isDanger? 'border-destructive/50 bg-destructive-100/10': 'bg-warning-100/10',@@ -103,7 +103,7 @@ export const CreditsUsageAlert = React.memo(() => {{message}</AlertDescription><div className="ms-auto flex shrink-0 items-center gap-1">- <CreditsActionButton variant="accent" />+ <CreditsActionButton />{!isDanger && (<Buttonvariant="ghost"diff --git a/packages/web/src/features/billing/components/sidebar-usage-limits.tsx b/packages/web/src/features/billing/components/sidebar-usage-limits.tsxindex 6714c931b45..4ed50449787 100644--- a/packages/web/src/features/billing/components/sidebar-usage-limits.tsx+++ b/packages/web/src/features/billing/components/sidebar-usage-limits.tsx@@ -68,7 +68,7 @@ export const SidebarUsageLimits = React.memo(() => {return null;}- const creditsText = billingUtils.formatCredits(Math.round(creditsRemaining));+ const creditsText = billingUtils.formatCredits(creditsRemaining);const resetLine = billingUtils.resolveCreditsReset({creditsNextResetAt: usage.creditsNextResetAt,creditsResetInterval: info?.creditsResetInterval,diff --git a/packages/web/src/features/billing/utils/billing-utils.ts b/packages/web/src/features/billing/utils/billing-utils.tsindex 9664750604b..81cf9024081 100644--- a/packages/web/src/features/billing/utils/billing-utils.ts+++ b/packages/web/src/features/billing/utils/billing-utils.ts@@ -45,9 +45,10 @@ function creditsSeverity(percent: number): CreditsSeverity {}function formatCredits(credits: number): string {- return credits >= COMPACT_CREDITS_FROM- ? formatUtils.formatNumberCompact(credits)- : formatUtils.formatNumber(credits);+ const wholeCredits = Math.round(credits);+ return wholeCredits >= COMPACT_CREDITS_FROM+ ? formatUtils.formatNumberCompact(wholeCredits)+ : formatUtils.formatNumber(wholeCredits);}function shouldShowCreditsAlert({diff --git a/packages/web/test/features/billing/billing-utils.test.ts b/packages/web/test/features/billing/billing-utils.test.tsindex 9b440a23972..58d960d21f8 100644--- a/packages/web/test/features/billing/billing-utils.test.ts+++ b/packages/web/test/features/billing/billing-utils.test.ts@@ -62,6 +62,19 @@ describe('billingUtils.formatCredits', () => {formatUtils.formatNumberCompact(2_500_000),);});++ it('rounds a fractional credit count to a whole credit', () => {+ expect(billingUtils.formatCredits(838.822)).toBe(+ formatUtils.formatNumber(839),+ );+ expect(billingUtils.formatCredits(0.4)).toBe(formatUtils.formatNumber(0));+ });++ it('rounds before choosing compact notation', () => {+ expect(billingUtils.formatCredits(999_999.6)).toBe(+ formatUtils.formatNumberCompact(1_000_000),+ );+ });});describe('billingUtils.shouldShowCreditsAlert', () => {