venice-ai-sdk-provider 1.1.6 → 1.1.7

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/README.md CHANGED
@@ -1,232 +1,232 @@
1
- # Venice Provider for Vercel AI SDK
2
-
3
- The [Venice](https://venice.ai/) provider for the [Vercel AI SDK](https://sdk.vercel.ai/docs) gives access to uncensored, private AI models on the Venice API. Venice offers OpenAI-compatible endpoints with zero data retention and access to models like DeepSeek R1, Llama 3.1, Qwen, and more.
4
-
5
- ## Setup
6
-
7
- ```bash
8
- # For pnpm
9
- pnpm add venice-ai-sdk-provider
10
-
11
- # For npm
12
- npm install venice-ai-sdk-provider
13
-
14
- # For yarn
15
- yarn add venice-ai-sdk-provider
16
- ```
17
-
18
- ## Provider Instance
19
-
20
- You can import the default provider instance `venice` from `venice-ai-sdk-provider` if you have set `VENICE_API_KEY` environment variable:
21
-
22
- ```ts
23
- import { venice } from 'venice-ai-sdk-provider';
24
- const model = venice("venice-uncensored");
25
- ```
26
-
27
- Or instance it manually:
28
- ```ts
29
- import { createVenice } from 'venice-ai-sdk-provider';
30
- const venice = createVenice({ apiKey: "your-api-key" });
31
- const model = venice("venice-uncensored");
32
- ```
33
-
34
- ## Example
35
-
36
- ```ts
37
- import { venice } from 'venice-ai-sdk-provider';
38
- import { generateText } from 'ai';
39
-
40
- const { text } = await generateText({
41
- model: venice('venice-uncensored'),
42
- prompt: 'Write a vegetarian lasagna recipe for 4 people.',
43
- });
44
- ```
45
-
46
- ## Supported models
47
-
48
- This list is not definitive. Venice regularly adds new models to their system. You can find the latest list of models [here](https://docs.venice.ai/models/overview).
49
-
50
- ## Venice-Specific Features
51
-
52
- ### Web Search
53
-
54
- Enable real-time web search with citations on all Venice text models:
55
-
56
- ```ts
57
- import { venice } from 'venice-ai-sdk-provider';
58
- import { generateText } from 'ai';
59
-
60
- const { text } = await generateText({
61
- model: venice('venice-uncensored'),
62
- prompt: 'What are the latest developments in AI?',
63
- providerOptions: {
64
- venice: {
65
- veniceParameters: {
66
- enableWebSearch: 'auto',
67
- },
68
- },
69
- },
70
- });
71
- ```
72
-
73
- ### Reasoning Mode
74
-
75
- Enable advanced step-by-step reasoning with visible thinking process:
76
-
77
- ```ts
78
- import { venice } from 'venice-ai-sdk-provider';
79
- import { generateText } from 'ai';
80
-
81
- const { text } = await generateText({
82
- model: venice('qwen3-235b-a22b-thinking-2507'),
83
- prompt: 'Solve: If x + 2y = 10 and 3x - y = 5, what are x and y?',
84
- providerOptions: {
85
- venice: {
86
- veniceParameters: {
87
- stripThinkingResponse: false,
88
- },
89
- },
90
- },
91
- });
92
- ```
93
-
94
- #### Reasoning Effort
95
-
96
- Control the depth of reasoning for models that support it:
97
-
98
- ```ts
99
- import { venice } from 'venice-ai-sdk-provider';
100
- import { generateText } from 'ai';
101
-
102
- const { text } = await generateText({
103
- model: venice('gemini-3-pro-preview'),
104
- prompt: 'Prove that there are infinitely many primes',
105
- providerOptions: {
106
- venice: {
107
- reasoningEffort: 'high',
108
- },
109
- },
110
- });
111
- ```
112
-
113
- Options: `low` (fast, minimal thinking), `medium` (default, balanced), `high` (deep thinking, best for complex problems).
114
-
115
- ### Tool Calling
116
-
117
- Venice supports function calling on compatible models:
118
-
119
- ```ts
120
- import { venice } from 'venice-ai-sdk-provider';
121
- import { generateText } from 'ai';
122
-
123
- const { text } = await generateText({
124
- model: venice('qwen3-next-80b),
125
- tools: {
126
- get_weather: {
127
- description: 'Get current weather for a location',
128
- parameters: z.object({
129
- location: z.string().describe('City name'),
130
- }),
131
- execute: async ({ location }) => {
132
- return { temperature: 72, condition: 'sunny' };
133
- },
134
- },
135
- },
136
- prompt: 'What is the weather like in New York?',
137
- });
138
- ```
139
-
140
- ### Vision
141
-
142
- Process images with vision-compatible models. Venice supports two ways to provide images:
143
-
144
- #### Option 1: Using image URL
145
-
146
- ```ts
147
- import { venice } from 'venice-ai-sdk-provider';
148
- import { generateText } from 'ai';
149
-
150
- const { text } = await generateText({
151
- model: venice('mistral-31-24b'),
152
- messages: [
153
- {
154
- role: 'user',
155
- content: [
156
- { type: 'text', text: 'What do you see in this image?' },
157
- {
158
- type: 'image_url',
159
- image_url: { url: 'https://example.com/image.jpg' },
160
- },
161
- ],
162
- },
163
- ],
164
- });
165
- ```
166
-
167
- #### Option 2: Using image data (base64)
168
-
169
- ```ts
170
- import { venice } from 'venice-ai-sdk-provider';
171
- import { generateText } from 'ai';
172
- import { readFile } from 'fs/promises';
173
-
174
- const imageBuffer = await readFile('path/to/image.jpg');
175
- const imageBase64 = imageBuffer.toString('base64');
176
-
177
- const { text } = await generateText({
178
- model: venice('mistral-31-24b'),
179
- messages: [
180
- {
181
- role: 'user',
182
- content: [
183
- { type: 'text', text: 'What do you see in this image?' },
184
- {
185
- type: 'image_url',
186
- image_url: { url: `data:image/jpeg;base64,${imageBase64}` },
187
- },
188
- ],
189
- },
190
- ],
191
- });
192
- ```
193
-
194
- Note: Use vision-capable models like `mistral-31-24b` for image analysis.
195
-
196
- ## Embeddings
197
-
198
- Venice supports embedding models for semantic search and RAG pipelines:
199
-
200
- ```ts
201
- import { embed } from 'ai';
202
- import { venice } from 'venice-ai-sdk-provider';
203
-
204
- const { embedding } = await embed({
205
- model: venice.textEmbeddingModel('text-embedding-bge-m3'),
206
- value: 'sunny day at the beach',
207
- });
208
-
209
- console.log(embedding);
210
- ```
211
-
212
- ## API Key Configuration
213
-
214
- Set your Venice API key as an environment variable:
215
-
216
- ```bash
217
- export VENICE_API_KEY=your-api-key-here
218
- ```
219
-
220
- Or pass it directly when creating a provider instance:
221
-
222
- ```ts
223
- import { createVenice } from 'venice-ai-sdk-provider';
224
-
225
- const venice = createVenice({ apiKey: 'your-api-key' });
226
- ```
227
-
228
- ## Learn More
229
-
230
- - [Venice API Documentation](https://docs.venice.ai/)
231
- - [Venice Models Overview](https://docs.venice.ai/models/overview)
232
- - [Vercel AI SDK Documentation](https://sdk.vercel.ai/docs)
1
+ # Venice Provider for Vercel AI SDK
2
+
3
+ The [Venice](https://venice.ai/) provider for the [Vercel AI SDK](https://sdk.vercel.ai/docs) gives access to uncensored, private AI models on the Venice API. Venice offers OpenAI-compatible endpoints with zero data retention and access to models like DeepSeek R1, Llama 3.1, Qwen, and more.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ # For pnpm
9
+ pnpm add venice-ai-sdk-provider
10
+
11
+ # For npm
12
+ npm install venice-ai-sdk-provider
13
+
14
+ # For yarn
15
+ yarn add venice-ai-sdk-provider
16
+ ```
17
+
18
+ ## Provider Instance
19
+
20
+ You can import the default provider instance `venice` from `venice-ai-sdk-provider` if you have set `VENICE_API_KEY` environment variable:
21
+
22
+ ```ts
23
+ import { venice } from 'venice-ai-sdk-provider';
24
+ const model = venice("venice-uncensored");
25
+ ```
26
+
27
+ Or instance it manually:
28
+ ```ts
29
+ import { createVenice } from 'venice-ai-sdk-provider';
30
+ const venice = createVenice({ apiKey: "your-api-key" });
31
+ const model = venice("venice-uncensored");
32
+ ```
33
+
34
+ ## Example
35
+
36
+ ```ts
37
+ import { venice } from 'venice-ai-sdk-provider';
38
+ import { generateText } from 'ai';
39
+
40
+ const { text } = await generateText({
41
+ model: venice('venice-uncensored'),
42
+ prompt: 'Write a vegetarian lasagna recipe for 4 people.',
43
+ });
44
+ ```
45
+
46
+ ## Supported models
47
+
48
+ This list is not definitive. Venice regularly adds new models to their system. You can find the latest list of models [here](https://docs.venice.ai/models/overview).
49
+
50
+ ## Venice-Specific Features
51
+
52
+ ### Web Search
53
+
54
+ Enable real-time web search with citations on all Venice text models:
55
+
56
+ ```ts
57
+ import { venice } from 'venice-ai-sdk-provider';
58
+ import { generateText } from 'ai';
59
+
60
+ const { text } = await generateText({
61
+ model: venice('venice-uncensored'),
62
+ prompt: 'What are the latest developments in AI?',
63
+ providerOptions: {
64
+ venice: {
65
+ veniceParameters: {
66
+ enableWebSearch: 'auto',
67
+ },
68
+ },
69
+ },
70
+ });
71
+ ```
72
+
73
+ ### Reasoning Mode
74
+
75
+ Enable advanced step-by-step reasoning with visible thinking process:
76
+
77
+ ```ts
78
+ import { venice } from 'venice-ai-sdk-provider';
79
+ import { generateText } from 'ai';
80
+
81
+ const { text } = await generateText({
82
+ model: venice('qwen3-235b-a22b-thinking-2507'),
83
+ prompt: 'Solve: If x + 2y = 10 and 3x - y = 5, what are x and y?',
84
+ providerOptions: {
85
+ venice: {
86
+ veniceParameters: {
87
+ stripThinkingResponse: false,
88
+ },
89
+ },
90
+ },
91
+ });
92
+ ```
93
+
94
+ #### Reasoning Effort
95
+
96
+ Control the depth of reasoning for models that support it:
97
+
98
+ ```ts
99
+ import { venice } from 'venice-ai-sdk-provider';
100
+ import { generateText } from 'ai';
101
+
102
+ const { text } = await generateText({
103
+ model: venice('gemini-3-pro-preview'),
104
+ prompt: 'Prove that there are infinitely many primes',
105
+ providerOptions: {
106
+ venice: {
107
+ reasoningEffort: 'high',
108
+ },
109
+ },
110
+ });
111
+ ```
112
+
113
+ Options: `low` (fast, minimal thinking), `medium` (default, balanced), `high` (deep thinking, best for complex problems).
114
+
115
+ ### Tool Calling
116
+
117
+ Venice supports function calling on compatible models:
118
+
119
+ ```ts
120
+ import { venice } from 'venice-ai-sdk-provider';
121
+ import { generateText } from 'ai';
122
+
123
+ const { text } = await generateText({
124
+ model: venice('qwen3-next-80b),
125
+ tools: {
126
+ get_weather: {
127
+ description: 'Get current weather for a location',
128
+ parameters: z.object({
129
+ location: z.string().describe('City name'),
130
+ }),
131
+ execute: async ({ location }) => {
132
+ return { temperature: 72, condition: 'sunny' };
133
+ },
134
+ },
135
+ },
136
+ prompt: 'What is the weather like in New York?',
137
+ });
138
+ ```
139
+
140
+ ### Vision
141
+
142
+ Process images with vision-compatible models. Venice supports two ways to provide images:
143
+
144
+ #### Option 1: Using image URL
145
+
146
+ ```ts
147
+ import { venice } from 'venice-ai-sdk-provider';
148
+ import { generateText } from 'ai';
149
+
150
+ const { text } = await generateText({
151
+ model: venice('mistral-31-24b'),
152
+ messages: [
153
+ {
154
+ role: 'user',
155
+ content: [
156
+ { type: 'text', text: 'What do you see in this image?' },
157
+ {
158
+ type: 'image_url',
159
+ image_url: { url: 'https://example.com/image.jpg' },
160
+ },
161
+ ],
162
+ },
163
+ ],
164
+ });
165
+ ```
166
+
167
+ #### Option 2: Using image data (base64)
168
+
169
+ ```ts
170
+ import { venice } from 'venice-ai-sdk-provider';
171
+ import { generateText } from 'ai';
172
+ import { readFile } from 'fs/promises';
173
+
174
+ const imageBuffer = await readFile('path/to/image.jpg');
175
+ const imageBase64 = imageBuffer.toString('base64');
176
+
177
+ const { text } = await generateText({
178
+ model: venice('mistral-31-24b'),
179
+ messages: [
180
+ {
181
+ role: 'user',
182
+ content: [
183
+ { type: 'text', text: 'What do you see in this image?' },
184
+ {
185
+ type: 'image_url',
186
+ image_url: { url: `data:image/jpeg;base64,${imageBase64}` },
187
+ },
188
+ ],
189
+ },
190
+ ],
191
+ });
192
+ ```
193
+
194
+ Note: Use vision-capable models like `mistral-31-24b` for image analysis.
195
+
196
+ ## Embeddings
197
+
198
+ Venice supports embedding models for semantic search and RAG pipelines:
199
+
200
+ ```ts
201
+ import { embed } from 'ai';
202
+ import { venice } from 'venice-ai-sdk-provider';
203
+
204
+ const { embedding } = await embed({
205
+ model: venice.textEmbeddingModel('text-embedding-bge-m3'),
206
+ value: 'sunny day at the beach',
207
+ });
208
+
209
+ console.log(embedding);
210
+ ```
211
+
212
+ ## API Key Configuration
213
+
214
+ Set your Venice API key as an environment variable:
215
+
216
+ ```bash
217
+ export VENICE_API_KEY=your-api-key-here
218
+ ```
219
+
220
+ Or pass it directly when creating a provider instance:
221
+
222
+ ```ts
223
+ import { createVenice } from 'venice-ai-sdk-provider';
224
+
225
+ const venice = createVenice({ apiKey: 'your-api-key' });
226
+ ```
227
+
228
+ ## Learn More
229
+
230
+ - [Venice API Documentation](https://docs.venice.ai/)
231
+ - [Venice Models Overview](https://docs.venice.ai/models/overview)
232
+ - [Vercel AI SDK Documentation](https://sdk.vercel.ai/docs)