v0-sdk 0.0.2 → 0.0.4
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 +5 -11
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,10 +17,10 @@ pnpm add v0-sdk
|
|
|
17
17
|
Get your API key from [v0.dev/chat/settings/keys](https://v0.dev/chat/settings/keys) and start creating chats.
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
|
-
import {
|
|
20
|
+
import { V0Client } from 'v0-sdk'
|
|
21
21
|
|
|
22
22
|
// Initialize with your API key
|
|
23
|
-
const client = new
|
|
23
|
+
const client = new V0Client('your_v0_api_key')
|
|
24
24
|
|
|
25
25
|
// Create a new chat
|
|
26
26
|
const chat = await client.createChat({
|
|
@@ -45,7 +45,7 @@ The client requires a v0 API key, which you can create at [v0.dev/chat/settings/
|
|
|
45
45
|
|
|
46
46
|
```javascript
|
|
47
47
|
// Initialize with API key
|
|
48
|
-
const client = new
|
|
48
|
+
const client = new V0Client('your_v0_api_key')
|
|
49
49
|
|
|
50
50
|
// Or set it later
|
|
51
51
|
client.setApiKey('your_v0_api_key')
|
|
@@ -65,7 +65,6 @@ const result = await client.createChat({
|
|
|
65
65
|
attachments: [{ url: 'https://example.com/design.png' }],
|
|
66
66
|
modelConfiguration: {
|
|
67
67
|
modelId: 'v0-1.5-md',
|
|
68
|
-
thinking: true,
|
|
69
68
|
imageGenerations: false,
|
|
70
69
|
},
|
|
71
70
|
})
|
|
@@ -97,9 +96,7 @@ Add a message to an existing chat.
|
|
|
97
96
|
const response = await client.addMessage('abc123', {
|
|
98
97
|
message: 'Add password strength indicator',
|
|
99
98
|
attachments: [{ url: 'https://example.com/mockup.jpg' }],
|
|
100
|
-
modelConfiguration: {
|
|
101
|
-
thinking: true,
|
|
102
|
-
},
|
|
99
|
+
modelConfiguration: {},
|
|
103
100
|
})
|
|
104
101
|
```
|
|
105
102
|
|
|
@@ -151,9 +148,6 @@ const response = await client.createChat({
|
|
|
151
148
|
|
|
152
149
|
// Enable AI-generated images in the response
|
|
153
150
|
imageGenerations: true,
|
|
154
|
-
|
|
155
|
-
// Show the AI's reasoning process
|
|
156
|
-
thinking: true,
|
|
157
151
|
},
|
|
158
152
|
})
|
|
159
153
|
```
|
|
@@ -217,7 +211,7 @@ The API has rate limits of 100 requests per minute and 1,000 requests per hour.
|
|
|
217
211
|
Enable debug mode to see detailed request and response information:
|
|
218
212
|
|
|
219
213
|
```javascript
|
|
220
|
-
const client = new
|
|
214
|
+
const client = new V0Client('your_api_key', undefined, { debug: true })
|
|
221
215
|
```
|
|
222
216
|
|
|
223
217
|
## Resources
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @param options Client configuration options
|
|
19
19
|
*/ constructor(options){
|
|
20
20
|
this.apiKey = options.apiKey;
|
|
21
|
-
this.baseUrl = options.baseUrl || 'https://api.v0.dev/
|
|
21
|
+
this.baseUrl = options.baseUrl || 'https://api.v0.dev/';
|
|
22
22
|
this.fetchFn = options.fetch || fetch;
|
|
23
23
|
}
|
|
24
24
|
/**
|