Skip to main content
Last Updated: September 17, 2026 Mastra is a framework for building AI agents and workflows. Connect an agent directly to Salad AI Gateway using the published SaladCloud AI SDK provider and qwen3.6-35b-a3b. AI Gateway is in beta with pay-per-token billing.

Prerequisites

Step 1: Install the Packages

In a new project directory:
For an existing project, keep its configuration and install the packages in that project. Mastra added support for AI SDK 7 model providers in @mastra/core version 1.47.0; this guide uses the newer 1.67.0 release line. See Mastra’s AI SDK 7 support documentation.

Step 2: Set Your API Key

Create .env:
Add .env to .gitignore. Keep this key server-side and do not use your regular SaladCloud API key in its place. The SaladCloud provider supplies the Gateway endpoint and Bearer authentication automatically.

Step 3: Create the Agent

Create agent.js:
agent.js
Pass the model object returned by saladCloud(...). Do not replace it with the string salad-cloud/qwen3.6-35b-a3b: the models.dev listing does not currently add SaladCloud to Mastra’s built-in model registry. This direct SDK setup does not depend on that registry.

Step 4: Generate a Response

Create test.js:
test.js
You should see the model’s answer in the terminal. Requests are billed to your SaladCloud organization.

Stream a Response

Create stream.js:
stream.js

Troubleshooting

  • Unknown provider or model: use saladCloud('qwen3.6-35b-a3b') as shown, not a model-router string.
  • Unsupported model version: upgrade @mastra/core to the version range above. The SaladCloud 0.2.0 package uses the AI SDK 7 provider interface.
  • Missing API key or HTTP 401: check that .env contains SALAD_CLOUD_API_KEY, run Node with --env-file=.env, and use your organization’s AI Gateway key.