Documentation · Governance · Evidence

Vercel AI Gateway Local Text Generation Test

Selected public-safe documentation pages from a private technical documentation hub. The focus is documented, controlled and reviewable technical delivery.

Vercel AI Gateway Local Text Generation Test

Purpose

This document records a local Vercel AI Gateway text-generation test using the Vercel AI SDK from a Windows / Git Bash development environment.

The purpose is to document what was validated, what failed, and what the failure means.

This is a technical troubleshooting note, not a secret store.


Scope

This note covers:

This note does not include actual API keys, recovery codes, tokens, payment details or production application code.


Local environment

The test was run from Git Bash on Windows:

jonne@LAPTOP-UBOE261J MINGW64 ~/ai-text-demo

The test directory was:

~/ai-text-demo

Initial package-manager issue

The Vercel documentation example used pnpm, but pnpm was not installed locally.

Observed result:

bash: pnpm: command not found

This was not a project error. It only meant that the local machine did not have pnpm installed.

The test was continued with npm, which was available.


Agent plugin installation result

The Vercel plugin command was tested:

npx plugins add vercel/vercel-plugin

Result:

No supported targets detected.
Neither 'claude', 'cursor', nor 'codex' binaries were found on PATH.
Use --target to specify one manually.

This means the plugin installer did not find a supported coding-agent binary on PATH.

This did not block the AI Gateway text-generation test, because the local script can call AI Gateway without the coding-agent plugin.


Project initialization

The local Node.js project was initialized with npm:

npm init -y
npm install ai dotenv @types/node tsx typescript

Observed result:

added 17 packages, and audited 18 packages
found 0 vulnerabilities

This validated that the local package installation succeeded.


Environment variable setup

A local .env.local file was created:

touch .env.local
notepad .env.local

The file contained the local AI Gateway API key:

AI_GATEWAY_API_KEY=<stored locally, not documented here>

The actual key must not be committed into GitHub, documentation, screenshots, logs or chat.


Test script

The script was saved as index.ts:

import { streamText } from 'ai';
import { config } from 'dotenv';

config({ path: '.env.local' });

async function main() {
  if (!process.env.AI_GATEWAY_API_KEY) {
    throw new Error('AI_GATEWAY_API_KEY is missing from .env.local');
  }

  const result = streamText({
    model: 'openai/gpt-5.4',
    prompt: 'Invent a new holiday and describe its traditions.',
  });

  for await (const textPart of result.textStream) {
    process.stdout.write(textPart);
  }

  console.log();
  console.log('Token usage:', await result.usage);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});

The important local choice was explicit .env.local loading:

config({ path: '.env.local' });

This avoids relying on default .env loading behavior.


Test command

The script was executed with:

npx tsx index.ts

The environment file was loaded successfully:

injected env (1) from .env.local

This showed that .env.local was present and that AI_GATEWAY_API_KEY was detected by the local process.


Observed failure

The request reached Vercel AI Gateway, but Vercel returned a 403 response:

GatewayInternalServerError: AI Gateway requires a valid credit card on file to service requests.
statusCode: 403

The nested API response included:

type: customer_verification_required

The response body stated:

AI Gateway requires a valid credit card on file to service requests.

The endpoint reached was:

https://ai-gateway.vercel.sh/v3/ai/language-model

This means the local script reached the Vercel AI Gateway service successfully, but the request was blocked by account verification / billing requirements.


Interpretation

The failure was not caused by:

missing npm dependencies
missing TypeScript runtime
missing .env.local file
missing AI_GATEWAY_API_KEY variable
wrong local script execution
coding-agent plugin installation failure

The failure was caused by:

Vercel AI Gateway requires a valid credit card on file before serving requests.

In practice, the test cannot proceed to real text generation through Vercel AI Gateway until the Vercel account has a valid credit card on file.


Local evidence from the run

Key successful steps:

npm init: passed
npm install: passed
.env.local loaded: passed
AI SDK import/runtime: passed
request reached Vercel AI Gateway: passed

Blocking condition:

403 customer_verification_required
valid credit card required by Vercel AI Gateway

What this proves

This test still produced useful evidence.

It proved that the local AI SDK setup was mostly correct and that the request reached Vercel.

The remaining blocker is not local code but Vercel account verification.

Correct summary:

The local AI Gateway text-generation test reached Vercel successfully, but execution was blocked by Vercel account verification because AI Gateway requires a valid credit card on file.

Public/private boundary

Allowed to document:

Not allowed to document:


Next step

There are three valid options:

1. Add a valid credit card to Vercel and rerun `npx tsx index.ts`.
2. Stop the Vercel AI Gateway test here and keep the result as a documented account-verification boundary.
3. Test a similar AI SDK flow with another provider key outside Vercel AI Gateway.

If option 1 is chosen, rerun:

npx tsx index.ts

Expected successful behavior after account verification:

streamed model output
Token usage printed after completion

Final status

Local project setup: successful
Dependencies: installed
.env.local loading: successful
Vercel AI Gateway reached: yes
Generation completed: no
Blocking reason: valid credit card required by Vercel
Further progress without card: no