# How to use Vercel AI Gateway with Subconscious

> To use Subconscious through Vercel AI Gateway, call `zai/glm-5.3` or `deepseek/deepseek-v4.1-flash-1017` with your AI Gateway API key and restrict routing to the `subconscious` provider. Requests then run on Subconscious and bill through your Vercel account, with no Subconscious key.

Canonical page: https://www.subconscious.dev/integrations/gateways/vercel-ai-gateway
Category: [Gateways](https://www.subconscious.dev/integrations/gateways)
Last verified: 2026-10-29
Vercel AI Gateway: https://vercel.com/docs/ai-gateway

## Before you start

- A Vercel account
- Node.js and npm, for the AI SDK example

## Set up Vercel AI Gateway

### 1. Create an AI Gateway API key

In the Vercel dashboard, open AI Gateway, then API Keys, and create a key. Vercel shows it once, so copy it and export it.

```bash
export AI_GATEWAY_API_KEY="your_key"
```

### 2. Install the AI SDK

The AI SDK reads the key from the environment and sends model strings to AI Gateway.

```bash
npm install ai
```

### 3. Route the request to Subconscious

Pass the model ID and set `only` to `subconscious`. Without it, AI Gateway can send the request to any provider that serves the model. To confirm, `providerMetadata.gateway.routing.finalProvider` on the result reads `subconscious`.

```ts
import { generateText } from "ai";

const { text } = await generateText({
  model: "zai/glm-5.3",
  prompt: "Summarize the open issues in this repo.",
  providerOptions: {
    gateway: { only: ["subconscious"] },
  },
});

console.log(text);
```

### 4. Or call the OpenAI compatible endpoint

Any OpenAI client works too. Point it at AI Gateway and send the same provider filter in the request body.

```bash
curl https://ai-gateway.vercel.sh/v1/chat/completions \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai/glm-5.3",
    "messages": [{ "role": "user", "content": "Hello" }],
    "providerOptions": { "gateway": { "only": ["subconscious"] } }
  }'
```

## Frequently asked questions

### Which models does Subconscious serve on Vercel AI Gateway?

GLM-5.3 (zai/glm-5.3) and DeepSeek V4.1 1017 (deepseek/deepseek-v4.1-flash-1017). Vercel lists both on its Subconscious provider page: https://vercel.com/ai-gateway/models/providers/subconscious

### Do I need a Subconscious account?

No. With AI Gateway’s own credentials, Vercel bills you at the prices on its Subconscious provider page. Talk to us directly for higher rate limits or a dedicated deployment.

### Can I prefer Subconscious but fall back to other providers?

Yes. Set order to ["subconscious"] instead of only. AI Gateway tries Subconscious first and moves to the next healthy provider if a request fails.
