@ai-sdk/deepinfra 3.0.74 → 3.0.76
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 +19 -0
- package/dist/index.js +1 -1
- package/docs/11-deepinfra.mdx +51 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/deepinfra
|
|
2
2
|
|
|
3
|
+
## 3.0.76
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [10026d1]
|
|
8
|
+
- @ai-sdk/provider@4.0.32
|
|
9
|
+
- @ai-sdk/openai-compatible@3.0.76
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.66
|
|
11
|
+
|
|
12
|
+
## 3.0.75
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [b089ce8]
|
|
17
|
+
- Updated dependencies [39a776b]
|
|
18
|
+
- Updated dependencies [e619655]
|
|
19
|
+
- @ai-sdk/provider-utils@5.0.65
|
|
20
|
+
- @ai-sdk/openai-compatible@3.0.75
|
|
21
|
+
|
|
3
22
|
## 3.0.74
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -261,7 +261,7 @@ var DeepInfraChatLanguageModel = class DeepInfraChatLanguageModel extends OpenAI
|
|
|
261
261
|
};
|
|
262
262
|
//#endregion
|
|
263
263
|
//#region src/version.ts
|
|
264
|
-
const VERSION = "3.0.
|
|
264
|
+
const VERSION = "3.0.76";
|
|
265
265
|
//#endregion
|
|
266
266
|
//#region src/deepinfra-provider.ts
|
|
267
267
|
function createDeepInfra(options = {}) {
|
package/docs/11-deepinfra.mdx
CHANGED
|
@@ -1,17 +1,64 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: DeepInfra
|
|
3
|
-
description: Learn how to use DeepInfra
|
|
3
|
+
description: Learn how to use DeepInfra with AI Gateway and the direct provider.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# DeepInfra Provider
|
|
7
7
|
|
|
8
8
|
The [DeepInfra](https://deepinfra.com) provider contains support for state-of-the-art models through the DeepInfra API, including Llama 3, Mixtral, Qwen, and many other popular open-source models.
|
|
9
|
+
Start with [AI Gateway](/providers/ai-sdk-providers/ai-gateway) for models in its catalog (recommended), or use `@ai-sdk/deepinfra` to connect directly to DeepInfra.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
```ts provider="deepinfra" model="meta/llama-4-scout"
|
|
12
|
+
import { generateText } from 'ai';
|
|
13
|
+
__PROVIDER_IMPORT__;
|
|
14
|
+
|
|
15
|
+
const { text } = await generateText({
|
|
16
|
+
model: __MODEL__,
|
|
17
|
+
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
18
|
+
__GATEWAY_OPTIONS__,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log(text);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Using AI Gateway
|
|
25
|
+
|
|
26
|
+
The AI SDK uses AI Gateway by default for model strings. Gateway provides access to models across providers through a single API key, with usage and cost tracking. Install `ai`:
|
|
27
|
+
|
|
28
|
+
<InstallPackages packages="ai" />
|
|
29
|
+
|
|
30
|
+
Set an [AI Gateway API key](https://vercel.com/docs/ai-gateway/getting-started) in your environment:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
export AI_GATEWAY_API_KEY=your_api_key_here
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Vercel deployments can also use [OIDC authentication](/providers/ai-sdk-providers/ai-gateway#oidc-authentication-vercel-deployments).
|
|
37
|
+
See the [AI Gateway provider documentation](/providers/ai-sdk-providers/ai-gateway) for configuration and the [model catalog](https://vercel.com/ai-gateway/models) for available models.
|
|
38
|
+
|
|
39
|
+
The example sets `providerOptions.gateway.order` to `['deepinfra']`. This sends the request to DeepInfra first, then falls back to other available providers of the same model if DeepInfra is unavailable or the request fails. `order` sets a preference; it does not restrict fallback to DeepInfra. See [provider ordering](https://vercel.com/docs/ai-gateway/models-and-providers/provider-filtering-and-ordering).
|
|
40
|
+
|
|
41
|
+
The dropdown lists models served by DeepInfra through Gateway with a corresponding direct-provider example. Provider availability depends on the model and your team's [Provider Allowlist](https://vercel.com/docs/ai-gateway/models-and-providers/provider-filtering-and-ordering).
|
|
42
|
+
|
|
43
|
+
## Using `@ai-sdk/deepinfra`
|
|
44
|
+
|
|
45
|
+
For direct access to DeepInfra, install `ai` and `@ai-sdk/deepinfra`:
|
|
11
46
|
|
|
12
|
-
|
|
47
|
+
<InstallPackages packages="ai @ai-sdk/deepinfra" />
|
|
13
48
|
|
|
14
|
-
|
|
49
|
+
Set your DeepInfra API credential in the `DEEPINFRA_API_KEY` environment variable:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export DEEPINFRA_API_KEY=your_api_key_here
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
AI Gateway does not expose every API in `@ai-sdk/deepinfra`. Use the direct provider for provider-specific APIs or custom connection settings.
|
|
56
|
+
|
|
57
|
+
<Note>
|
|
58
|
+
The following sections document the direct `@ai-sdk/deepinfra` provider,
|
|
59
|
+
including its model factories and settings. Gateway model and feature
|
|
60
|
+
availability can differ.
|
|
61
|
+
</Note>
|
|
15
62
|
|
|
16
63
|
## Provider Instance
|
|
17
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/deepinfra",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.76",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
33
|
-
"@ai-sdk/provider": "4.0.
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
32
|
+
"@ai-sdk/openai-compatible": "3.0.76",
|
|
33
|
+
"@ai-sdk/provider": "4.0.32",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.66"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@ai-sdk/test-server": "2.0.4",
|