# zidane/providers/vercel-ai-gateway

> The Vercel AI Gateway provider, with models from many labs on one API key.

Import: `import { … } from 'zidane/providers/vercel-ai-gateway'`. Source: [src/providers/vercel-ai-gateway.ts](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts).

Use `vercelAIGateway()` when your agent runs on the Vercel AI Gateway. It reads `AI_GATEWAY_API_KEY` when you pass no key, and its default model is `anthropic/claude-opus-5.5`. Model ids take the gateway's `creator/model` form. `anthropic/*` models go over the gateway's Anthropic Messages API, every other model over its chat completions (`isVercelAIGatewayAnthropicModel()` tells which). `planVercelAIGatewayReasoning()` maps a thinking level to the gateway's `reasoning` field.

```ts
import { createAgent } from 'zidane'
import { vercelAIGateway } from 'zidane/providers/vercel-ai-gateway'

const agent = createAgent({ provider: vercelAIGateway() })
const stats = await agent.run({ prompt: 'Summarize README.md in three bullets.', model: 'openai/gpt-6-sol' })
console.log(stats.turns)
```

## Functions

### `isVercelAIGatewayAnthropicModel`

Function.

Whether a model goes over the gateway's Anthropic Messages API.

```ts
function isVercelAIGatewayAnthropicModel(model: string): boolean
```

**Parameters**

- `model` (`string`): Gateway model id.

**Returns** `boolean`

Source: [src/providers/vercel-ai-gateway.ts:71](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L71)

### `planVercelAIGatewayReasoning`

Function.

Maps zidane's thinking level and budget to the gateway's `reasoning` field
on chat completions. It takes an `effort` or a `max_tokens` budget, never
both: an explicit budget wins. Unset, `'off'` and `'adaptive'` send
nothing, so the model keeps its own default.

```ts
function planVercelAIGatewayReasoning(
  ctx: { thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'adaptive'; thinkingBudget?: number },
): Record<string, unknown> | undefined
```

**Parameters**

- `ctx` (`{ thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'adaptive'; thinkingBudget?: number }`): Request thinking level and budget.

**Returns** `Record<string, unknown> | undefined`

Source: [src/providers/vercel-ai-gateway.ts:85](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L85)

### `vercelAIGateway`

Function.

Vercel AI Gateway provider. Claude models go over the gateway's Anthropic
Messages API, every other model over its chat completions (see the module
comment).

```ts
function vercelAIGateway(params?: VercelAIGatewayParams): Provider
```

**Parameters**

- `params?` (`VercelAIGatewayParams`): API key, base URL, default model, capabilities and extra headers.

**Returns** `Provider`

**Example**

```ts
import { createAgent } from 'zidane'
import { vercelAIGateway } from 'zidane/providers/vercel-ai-gateway'

const agent = createAgent({
  provider: vercelAIGateway({ apiKey: process.env.AI_GATEWAY_API_KEY }),
})
await agent.run({ prompt: 'Say hello.', model: 'openai/gpt-6-sol' })
```

Source: [src/providers/vercel-ai-gateway.ts:113](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L113)

## Constants

### `VERCEL_AI_GATEWAY_API_KEY_ENV`

Constant.

Environment variable the Vercel AI Gateway provider reads its API key from.

```ts
const VERCEL_AI_GATEWAY_API_KEY_ENV = 'AI_GATEWAY_API_KEY'
```

Source: [src/providers/vercel-ai-gateway.ts:29](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L29)

### `VERCEL_AI_GATEWAY_DECISION_MODELS`

Constant.

Decision models the gateway serves on TypeSafe's System One protocol. The first is the default.

```ts
const VERCEL_AI_GATEWAY_DECISION_MODELS: readonly ['typesafe-ai/jev', 'typesafe-ai/jev-1.14.0', 'typesafe-ai/jev-1.13.0']
```

Source: [src/providers/vercel-ai-gateway.ts:35](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L35)

### `VERCEL_AI_GATEWAY_DEFAULT_MODEL`

Constant.

Model the Vercel AI Gateway provider uses when none is configured.

```ts
const VERCEL_AI_GATEWAY_DEFAULT_MODEL = 'anthropic/claude-opus-5.5'
```

Source: [src/providers/vercel-ai-gateway.ts:32](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L32)

### `VERCEL_AI_GATEWAY_PROVIDER_KEY`

Constant.

Provider key, credentials-file key and pi-ai provider id of the gateway.

```ts
const VERCEL_AI_GATEWAY_PROVIDER_KEY = 'vercel-ai-gateway'
```

Source: [src/providers/vercel-ai-gateway.ts:26](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L26)

## Interfaces

### `VercelAIGatewayParams`

Interface.

Options for [`vercelAIGateway`](https://zidane.si/docs/reference/providers-vercel-ai-gateway.md#vercelAIGateway).

```ts
interface VercelAIGatewayParams
```

**Properties**

- `apiKey?` (`string`): API key. Falls back to the `AI_GATEWAY_API_KEY` environment variable.
- `baseURL?` (`string`, default `'https://ai-gateway.vercel.sh'`): Gateway origin, without `/v1`: Claude goes to `<baseURL>/v1/messages`,
  other models to `<baseURL>/v1/chat/completions`. With a base URL of its
  own the provider has no `decisions` and no `images`.
- `capabilities?` (`ProviderCapabilities`): Provider capability flags. The gateway routes to many models, so the
  default fits the default model: `{ vision: true, imageInToolResult: false,
  documents: true }`. Set `vision: false` when pinning a text-only model.
- `defaultModel?` (`string`, default `'anthropic/claude-opus-5.5'`): Model used when a request does not set one.
- `extraHeaders?` (`Record<string, string>`): Extra HTTP headers sent on every request, on both routes.

Source: [src/providers/vercel-ai-gateway.ts:41](https://github.com/Tahul/zidane/blob/main/src/providers/vercel-ai-gateway.ts#L41)
