@ai-sdk/vercel 0.0.0-1c33ba03-20260114162300 → 0.0.0-4115c213-20260122152721

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,73 @@
1
1
  # @ai-sdk/vercel
2
2
 
3
- ## 0.0.0-1c33ba03-20260114162300
3
+ ## 0.0.0-4115c213-20260122152721
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [261c011]
8
- - @ai-sdk/provider-utils@0.0.0-1c33ba03-20260114162300
9
- - @ai-sdk/openai-compatible@0.0.0-1c33ba03-20260114162300
7
+ - 4caafb2: chore: excluded tests from src folder in npm package
8
+ - Updated dependencies [4caafb2]
9
+ - @ai-sdk/openai-compatible@0.0.0-4115c213-20260122152721
10
+ - @ai-sdk/provider@0.0.0-4115c213-20260122152721
11
+ - @ai-sdk/provider-utils@0.0.0-4115c213-20260122152721
12
+
13
+ ## 2.0.18
14
+
15
+ ### Patch Changes
16
+
17
+ - 2b8369d: chore: add docs to package dist
18
+
19
+ ## 2.0.17
20
+
21
+ ### Patch Changes
22
+
23
+ - 8dc54db: chore: add src folders to package bundle
24
+ - Updated dependencies [8dc54db]
25
+ - @ai-sdk/openai-compatible@2.0.17
26
+
27
+ ## 2.0.16
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [78555ad]
32
+ - @ai-sdk/openai-compatible@2.0.16
33
+
34
+ ## 2.0.15
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [7116ef3]
39
+ - @ai-sdk/openai-compatible@2.0.15
40
+
41
+ ## 2.0.14
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [1612a57]
46
+ - @ai-sdk/openai-compatible@2.0.14
47
+
48
+ ## 2.0.13
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [5c090e7]
53
+ - @ai-sdk/provider@3.0.4
54
+ - @ai-sdk/openai-compatible@2.0.13
55
+ - @ai-sdk/provider-utils@4.0.8
56
+
57
+ ## 2.0.12
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [78a133a]
62
+ - @ai-sdk/openai-compatible@2.0.12
63
+
64
+ ## 2.0.11
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [46f46e4]
69
+ - @ai-sdk/provider-utils@4.0.7
70
+ - @ai-sdk/openai-compatible@2.0.11
10
71
 
11
72
  ## 2.0.10
12
73
 
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_openai_compatible = require("@ai-sdk/openai-compatible");
32
32
  var import_provider_utils = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "0.0.0-1c33ba03-20260114162300" : "0.0.0-test";
35
+ var VERSION = true ? "0.0.0-4115c213-20260122152721" : "0.0.0-test";
36
36
 
37
37
  // src/vercel-provider.ts
38
38
  function createVercel(options = {}) {
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "0.0.0-1c33ba03-20260114162300" : "0.0.0-test";
13
+ var VERSION = true ? "0.0.0-4115c213-20260122152721" : "0.0.0-test";
14
14
 
15
15
  // src/vercel-provider.ts
16
16
  function createVercel(options = {}) {
@@ -0,0 +1,129 @@
1
+ ---
2
+ title: Vercel
3
+ description: Learn how to use Vercel's v0 models with the AI SDK.
4
+ ---
5
+
6
+ # Vercel Provider
7
+
8
+ The [Vercel](https://vercel.com) provider gives you access to the [v0 API](https://v0.app/docs/api/model), designed for building modern web applications. The v0 models support text and image inputs and provide fast streaming responses.
9
+
10
+ You can create your Vercel API key at [v0.dev](https://v0.dev/chat/settings/keys).
11
+
12
+ <Note>
13
+ The v0 API is currently in beta and requires a Premium or Team plan with
14
+ usage-based billing enabled. For details, visit the [pricing
15
+ page](https://v0.dev/pricing). To request a higher limit, contact Vercel at
16
+ support@v0.dev.
17
+ </Note>
18
+
19
+ ## Features
20
+
21
+ - **Framework aware completions**: Evaluated on modern stacks like Next.js and Vercel
22
+ - **Auto-fix**: Identifies and corrects common coding issues during generation
23
+ - **Quick edit**: Streams inline edits as they're available
24
+ - **Multimodal**: Supports both text and image inputs
25
+
26
+ ## Setup
27
+
28
+ The Vercel provider is available via the `@ai-sdk/vercel` module. You can install it with:
29
+
30
+ <Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
31
+ <Tab>
32
+ <Snippet text="pnpm add @ai-sdk/vercel" dark />
33
+ </Tab>
34
+ <Tab>
35
+ <Snippet text="npm install @ai-sdk/vercel" dark />
36
+ </Tab>
37
+ <Tab>
38
+ <Snippet text="yarn add @ai-sdk/vercel" dark />
39
+ </Tab>
40
+
41
+ <Tab>
42
+ <Snippet text="bun add @ai-sdk/vercel" dark />
43
+ </Tab>
44
+ </Tabs>
45
+
46
+ ## Provider Instance
47
+
48
+ You can import the default provider instance `vercel` from `@ai-sdk/vercel`:
49
+
50
+ ```ts
51
+ import { vercel } from '@ai-sdk/vercel';
52
+ ```
53
+
54
+ If you need a customized setup, you can import `createVercel` from `@ai-sdk/vercel` and create a provider instance with your settings:
55
+
56
+ ```ts
57
+ import { createVercel } from '@ai-sdk/vercel';
58
+
59
+ const vercel = createVercel({
60
+ apiKey: process.env.VERCEL_API_KEY ?? '',
61
+ });
62
+ ```
63
+
64
+ You can use the following optional settings to customize the Vercel provider instance:
65
+
66
+ - **baseURL** _string_
67
+
68
+ Use a different URL prefix for API calls. The default prefix is `https://api.v0.dev/v1`.
69
+
70
+ - **apiKey** _string_
71
+
72
+ API key that is being sent using the `Authorization` header. It defaults to
73
+ the `VERCEL_API_KEY` environment variable.
74
+
75
+ - **headers** _Record&lt;string,string&gt;_
76
+
77
+ Custom headers to include in the requests.
78
+
79
+ - **fetch** _(input: RequestInfo, init?: RequestInit) => Promise&lt;Response&gt;_
80
+
81
+ Custom [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) implementation.
82
+ Defaults to the global `fetch` function.
83
+ You can use it as a middleware to intercept requests,
84
+ or to provide a custom fetch implementation for e.g. testing.
85
+
86
+ ## Language Models
87
+
88
+ You can create language models using a provider instance. The first argument is the model ID, for example:
89
+
90
+ ```ts
91
+ import { vercel } from '@ai-sdk/vercel';
92
+ import { generateText } from 'ai';
93
+
94
+ const { text } = await generateText({
95
+ model: vercel('v0-1.0-md'),
96
+ prompt: 'Create a Next.js AI chatbot',
97
+ });
98
+ ```
99
+
100
+ Vercel language models can also be used in the `streamText` function (see [AI SDK Core](/docs/ai-sdk-core)).
101
+
102
+ ## Models
103
+
104
+ ### v0-1.5-md
105
+
106
+ The `v0-1.5-md` model is for everyday tasks and UI generation.
107
+
108
+ ### v0-1.5-lg
109
+
110
+ The `v0-1.5-lg` model is for advanced thinking or reasoning.
111
+
112
+ ### v0-1.0-md (legacy)
113
+
114
+ The `v0-1.0-md` model is the legacy model served by the v0 API.
115
+
116
+ All v0 models have the following capabilities:
117
+
118
+ - Supports text and image inputs (multimodal)
119
+ - Supports function/tool calls
120
+ - Streaming responses with low latency
121
+ - Optimized for frontend and full-stack web development
122
+
123
+ ## Model Capabilities
124
+
125
+ | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
126
+ | ----------- | ------------------- | ------------------- | ------------------- | ------------------- |
127
+ | `v0-1.5-md` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
128
+ | `v0-1.5-lg` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
129
+ | `v0-1.0-md` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/vercel",
3
- "version": "0.0.0-1c33ba03-20260114162300",
3
+ "version": "0.0.0-4115c213-20260122152721",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -8,9 +8,18 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist/**/*",
11
+ "docs/**/*",
12
+ "src",
13
+ "!src/**/*.test.ts",
14
+ "!src/**/*.test-d.ts",
15
+ "!src/**/__snapshots__",
16
+ "!src/**/__fixtures__",
11
17
  "CHANGELOG.md",
12
18
  "README.md"
13
19
  ],
20
+ "directories": {
21
+ "doc": "./docs"
22
+ },
14
23
  "exports": {
15
24
  "./package.json": "./package.json",
16
25
  ".": {
@@ -20,9 +29,9 @@
20
29
  }
21
30
  },
22
31
  "dependencies": {
23
- "@ai-sdk/openai-compatible": "0.0.0-1c33ba03-20260114162300",
24
- "@ai-sdk/provider-utils": "0.0.0-1c33ba03-20260114162300",
25
- "@ai-sdk/provider": "3.0.3"
32
+ "@ai-sdk/openai-compatible": "0.0.0-4115c213-20260122152721",
33
+ "@ai-sdk/provider": "0.0.0-4115c213-20260122152721",
34
+ "@ai-sdk/provider-utils": "0.0.0-4115c213-20260122152721"
26
35
  },
27
36
  "devDependencies": {
28
37
  "@types/node": "20.17.24",
@@ -54,7 +63,7 @@
54
63
  "scripts": {
55
64
  "build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
56
65
  "build:watch": "pnpm clean && tsup --watch",
57
- "clean": "del-cli dist *.tsbuildinfo",
66
+ "clean": "del-cli dist docs *.tsbuildinfo",
58
67
  "lint": "eslint \"./**/*.ts*\"",
59
68
  "type-check": "tsc --build",
60
69
  "prettier-check": "prettier --check \"./**/*.ts*\"",
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { createVercel, vercel } from './vercel-provider';
2
+ export type { VercelProvider, VercelProviderSettings } from './vercel-provider';
3
+ export type { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';
4
+ export { VERSION } from './version';
@@ -0,0 +1,6 @@
1
+ // https://v0.dev/docs/v0-model-api
2
+ export type VercelChatModelId =
3
+ | 'v0-1.0-md'
4
+ | 'v0-1.5-md'
5
+ | 'v0-1.5-lg'
6
+ | (string & {});
@@ -0,0 +1,107 @@
1
+ import {
2
+ LanguageModelV3,
3
+ NoSuchModelError,
4
+ ProviderV3,
5
+ } from '@ai-sdk/provider';
6
+ import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';
7
+ import {
8
+ FetchFunction,
9
+ loadApiKey,
10
+ withoutTrailingSlash,
11
+ withUserAgentSuffix,
12
+ } from '@ai-sdk/provider-utils';
13
+ import { VercelChatModelId } from './vercel-chat-options';
14
+ import { VERSION } from './version';
15
+
16
+ export interface VercelProviderSettings {
17
+ /**
18
+ Vercel API key.
19
+ */
20
+ apiKey?: string;
21
+ /**
22
+ Base URL for the API calls.
23
+ */
24
+ baseURL?: string;
25
+ /**
26
+ Custom headers to include in the requests.
27
+ */
28
+ headers?: Record<string, string>;
29
+ /**
30
+ Custom fetch implementation. You can use it as a middleware to intercept requests,
31
+ or to provide a custom fetch implementation for e.g. testing.
32
+ */
33
+ fetch?: FetchFunction;
34
+ }
35
+
36
+ export interface VercelProvider extends ProviderV3 {
37
+ /**
38
+ Creates a model for text generation.
39
+ */
40
+ (modelId: VercelChatModelId): LanguageModelV3;
41
+
42
+ /**
43
+ Creates a language model for text generation.
44
+ */
45
+ languageModel(modelId: VercelChatModelId): LanguageModelV3;
46
+
47
+ /**
48
+ * @deprecated Use `embeddingModel` instead.
49
+ */
50
+ textEmbeddingModel(modelId: string): never;
51
+ }
52
+
53
+ export function createVercel(
54
+ options: VercelProviderSettings = {},
55
+ ): VercelProvider {
56
+ const baseURL = withoutTrailingSlash(
57
+ options.baseURL ?? 'https://api.v0.dev/v1',
58
+ );
59
+ const getHeaders = () =>
60
+ withUserAgentSuffix(
61
+ {
62
+ Authorization: `Bearer ${loadApiKey({
63
+ apiKey: options.apiKey,
64
+ environmentVariableName: 'VERCEL_API_KEY',
65
+ description: 'Vercel',
66
+ })}`,
67
+ ...options.headers,
68
+ },
69
+ `ai-sdk/vercel/${VERSION}`,
70
+ );
71
+
72
+ interface CommonModelConfig {
73
+ provider: string;
74
+ url: ({ path }: { path: string }) => string;
75
+ headers: () => Record<string, string>;
76
+ fetch?: FetchFunction;
77
+ }
78
+
79
+ const getCommonModelConfig = (modelType: string): CommonModelConfig => ({
80
+ provider: `vercel.${modelType}`,
81
+ url: ({ path }) => `${baseURL}${path}`,
82
+ headers: getHeaders,
83
+ fetch: options.fetch,
84
+ });
85
+
86
+ const createChatModel = (modelId: VercelChatModelId) => {
87
+ return new OpenAICompatibleChatLanguageModel(modelId, {
88
+ ...getCommonModelConfig('chat'),
89
+ });
90
+ };
91
+
92
+ const provider = (modelId: VercelChatModelId) => createChatModel(modelId);
93
+
94
+ provider.specificationVersion = 'v3' as const;
95
+ provider.languageModel = createChatModel;
96
+ provider.embeddingModel = (modelId: string) => {
97
+ throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });
98
+ };
99
+ provider.textEmbeddingModel = provider.embeddingModel;
100
+ provider.imageModel = (modelId: string) => {
101
+ throw new NoSuchModelError({ modelId, modelType: 'imageModel' });
102
+ };
103
+
104
+ return provider;
105
+ }
106
+
107
+ export const vercel = createVercel();
package/src/version.ts ADDED
@@ -0,0 +1,6 @@
1
+ // Version string of this package injected at build time.
2
+ declare const __PACKAGE_VERSION__: string | undefined;
3
+ export const VERSION: string =
4
+ typeof __PACKAGE_VERSION__ !== 'undefined'
5
+ ? __PACKAGE_VERSION__
6
+ : '0.0.0-test';