@ai-sdk/togetherai 3.0.75 → 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 +10 -0
- package/dist/index.js +1 -1
- package/docs/24-togetherai.mdx +51 -5
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ai-sdk/togetherai
|
|
2
2
|
|
|
3
|
+
## 3.0.76
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b089ce8]
|
|
8
|
+
- Updated dependencies [39a776b]
|
|
9
|
+
- Updated dependencies [e619655]
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.65
|
|
11
|
+
- @ai-sdk/openai-compatible@3.0.75
|
|
12
|
+
|
|
3
13
|
## 3.0.75
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -217,7 +217,7 @@ const togetheraiImageResponseSchema = z.object({ data: z.array(z.object({ b64_js
|
|
|
217
217
|
const togetheraiErrorSchema = z.object({ error: z.object({ message: z.string() }) });
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/version.ts
|
|
220
|
-
const VERSION = "3.0.
|
|
220
|
+
const VERSION = "3.0.76";
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region src/togetherai-provider.ts
|
|
223
223
|
function loadDeprecatedApiKey() {
|
package/docs/24-togetherai.mdx
CHANGED
|
@@ -1,18 +1,64 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Together.ai
|
|
3
|
-
description: Learn how to use Together.ai
|
|
3
|
+
description: Learn how to use Together.ai with AI Gateway and the direct provider.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Together.ai Provider
|
|
7
7
|
|
|
8
8
|
The [Together.ai](https://together.ai) provider contains support for 200+ open-source models through the [Together.ai API](https://docs.together.ai/reference).
|
|
9
|
+
Start with [AI Gateway](/providers/ai-sdk-providers/ai-gateway) for models in its catalog (recommended), or use `@ai-sdk/togetherai` to connect directly to Together.ai.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
```ts provider="togetherai" model="deepseek/deepseek-v4-flash-0731"
|
|
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 `['togetherai']`. This sends the request to Together.ai first, then falls back to other available providers of the same model if Together.ai is unavailable or the request fails. `order` sets a preference; it does not restrict fallback to Together.ai. See [provider ordering](https://vercel.com/docs/ai-gateway/models-and-providers/provider-filtering-and-ordering).
|
|
40
|
+
|
|
41
|
+
The dropdown lists models served by Together.ai 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/togetherai`
|
|
44
|
+
|
|
45
|
+
For direct access to Together.ai, install `ai` and `@ai-sdk/togetherai`:
|
|
11
46
|
|
|
12
|
-
|
|
13
|
-
install it with
|
|
47
|
+
<InstallPackages packages="ai @ai-sdk/togetherai" />
|
|
14
48
|
|
|
15
|
-
|
|
49
|
+
Set your Together.ai API credential in the `TOGETHER_API_KEY` environment variable:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export TOGETHER_API_KEY=your_api_key_here
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
AI Gateway does not expose every API in `@ai-sdk/togetherai`. Use the direct provider for provider-specific APIs or custom connection settings.
|
|
56
|
+
|
|
57
|
+
<Note>
|
|
58
|
+
The following sections document the direct `@ai-sdk/togetherai` provider,
|
|
59
|
+
including its model factories and settings. Gateway model and feature
|
|
60
|
+
availability can differ.
|
|
61
|
+
</Note>
|
|
16
62
|
|
|
17
63
|
## Provider Instance
|
|
18
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/togetherai",
|
|
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.
|
|
32
|
+
"@ai-sdk/openai-compatible": "3.0.75",
|
|
33
33
|
"@ai-sdk/provider": "4.0.31",
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.65"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@ai-sdk/test-server": "2.0.4",
|