> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salad.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> For autonomous tasks, use live SaladCloud API responses for current state, availability, quotas, models, and other dynamic values. Use current OpenAPI specifications where provided for paths, schemas, required fields, and enums. Never invent endpoints, fields, prices, availability, quotas, models, or state. Prefer API workflows over Portal steps. Read before changing and never expose credentials, signed media URLs, prompts, or sensitive outputs. Retry only safe or idempotent operations with bounded backoff, honoring Retry-After. Verify every write with a read. Stop rather than repeat an uncertain non-idempotent or billable request. AI Gateway uses an organization-specific Bearer key and live /v1/models discovery. Do not delete, cancel, stop, or reduce capacity without explicit user intent. Bind shared operation IDs to the selected product path. Treat Container Engine instances as interruptible and local state as ephemeral. Install the SaladCloud skills (npx skills add https://docs.salad.com), start from the salad skill and /agents/overview; docs MCP: https://docs.salad.com/mcp.

# Getting Started with Salad AI Gateway

> Make your first API call to Salad AI Gateway in under 5 minutes.

*Last Updated: October 19, 2026*

> Treat examples as minimal templates, not live model or account facts. Use the `salad-ai-gateway-request` skill,
> confirm the exact model with `/v1/models`, keep `SALAD_AI_GATEWAY_API_KEY` and all prompt/output content secret, and
> stop rather than retry an uncertain completion or partial stream.

> [!WARNING]
>
> Salad AI Gateway is currently in **beta**. Pay-per-token access is self-service.

## Prerequisites

* A SaladCloud organization with a positive credit balance
* An organization-specific AI Gateway API key. Follow
  [Pay-Per-Token Onboarding](https://docs.salad.com/ai-gateway/tutorials/pay-per-token-onboarding.md) to create one.

## Base URL

All requests go to:

```
https://ai.salad.cloud/v1
```

## Authentication

Pass your organization-specific AI Gateway API key as a Bearer token in the `Authorization` header. Usage is billed to
the organization associated with that key:

```
Authorization: Bearer <your-ai-gateway-api-key>
```

> [!NOTE]
>
> Use the key created on your organization's **AI Gateway** page, not the account's **Current API Key**. The
> `Salad-Api-Key` header used by other SaladCloud APIs does not authenticate AI Gateway requests.

Store your key in the environment before running any example below:

```bash theme={null}
export SALAD_AI_GATEWAY_API_KEY="<your-ai-gateway-api-key>"
```

Keep the key server-side and out of source control. See
[Manage Your AI Gateway API Key](https://docs.salad.com/ai-gateway/how-to-guides/manage-api-key.md) to copy, regenerate, or delete it.

## Step 1: Test with curl

The quickest way to verify access is a single curl call:

```bash theme={null}
curl https://ai.salad.cloud/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SALAD_AI_GATEWAY_API_KEY" \
  -d '{
    "model": "qwen3.6-35b-a3b",
    "messages": [
      {"role": "user", "content": "Say hello in one sentence."}
    ]
  }'
```

You should receive a JSON response containing the model's reply.

## Step 2: Use the SaladCloud AI SDK Provider

For JavaScript and TypeScript applications built with the Vercel AI SDK, use the official
`@saladtechnologies-oss/ai-sdk-provider`. The provider requires Node.js 22 or later and automatically uses the Salad AI
Gateway base URL.

Install the provider, Vercel AI SDK, and Zod:

```bash theme={null}
npm install @saladtechnologies-oss/ai-sdk-provider ai zod
```

The provider reads your key from `SALAD_CLOUD_API_KEY`. If you followed the pay-per-token onboarding guide, map the
existing variable before running your application:

```bash theme={null}
export SALAD_CLOUD_API_KEY="$SALAD_AI_GATEWAY_API_KEY"
```

Create `index.mjs`:

```javascript index.mjs theme={null}
import { generateText } from 'ai'
import { saladCloud } from '@saladtechnologies-oss/ai-sdk-provider'

const result = await generateText({
  model: saladCloud('qwen3.6-35b-a3b'),
  prompt: 'Say hello in one sentence.',
})

console.log(result.text)
```

Run the example:

```bash theme={null}
node index.mjs
```

The provider also supports streaming, tool calling, structured output, reasoning options, and image inputs. See the
[SaladCloud AI SDK Provider repository](https://github.com/SaladTechnologies/ai-sdk-provider) for configuration and
additional examples.

## Step 3: Use the OpenAI Python SDK

Salad AI Gateway is fully compatible with the OpenAI Python SDK — just point it at a different base URL:

```bash theme={null}
pip install openai
```

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://ai.salad.cloud/v1",
    api_key=os.environ["SALAD_AI_GATEWAY_API_KEY"],
)

response = client.chat.completions.create(
    model="qwen3.6-35b-a3b",
    messages=[{"role": "user", "content": "Explain what Salad AI Gateway is in two sentences."}],
)

print(response.choices[0].message.content)
```

## Step 4: Streaming

For real-time output, enable streaming:

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://ai.salad.cloud/v1",
    api_key=os.environ["SALAD_AI_GATEWAY_API_KEY"],
)

stream = client.chat.completions.create(
    model="qwen3.6-35b-a3b",
    messages=[{"role": "user", "content": "Write a short poem about distributed computing."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
```

## Step 5: Use the OpenAI JavaScript/TypeScript SDK

```bash theme={null}
npm install openai
```

```javascript theme={null}
import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://ai.salad.cloud/v1',
  apiKey: process.env.SALAD_AI_GATEWAY_API_KEY,
})

const response = await client.chat.completions.create({
  model: 'qwen3.6-35b-a3b',
  messages: [{ role: 'user', content: 'Hello from Salad AI Gateway!' }],
})

console.log(response.choices[0].message.content)
```

## Available Models

| Model | Context Window | Best For |
| :- | :- | :- |
| `qwen3.6-35b-a3b` | 262,144 tokens | Complex reasoning, agentic tasks, coding |
| `qwen3.6-27b` | 195,200 tokens | General purpose, balanced speed and capability |
| `qwen3.5-35b-a3b` | 262,144 tokens | Cost-efficient agentic tasks |
| `qwen3.5-9b` | 196,608 tokens | High-volume, simple queries |

See the [Models Reference](https://docs.salad.com/ai-gateway/reference/models.md) for full details.

## Next Steps

* Browse [integration guides](https://docs.salad.com/ai-gateway/integrations/overview.md) for agentic tools, IDEs, and frameworks
* Read the [Models Reference](https://docs.salad.com/ai-gateway/reference/models.md) for model capabilities and limits
* Review [AI Gateway Pricing](https://docs.salad.com/ai-gateway/reference/pricing.md) for input and output token rates
* Check [AI Gateway Errors](https://docs.salad.com/ai-gateway/reference/errors.md) for credit or access failures


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.