@azinove_group/ai-sdk-provider 0.0.0-stage → 1.0.0-beta.0
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/LICENSE +202 -0
- package/README.md +225 -2
- package/dist/azinove-chat-language-model.d.ts +42 -0
- package/dist/azinove-chat-language-model.d.ts.map +1 -0
- package/dist/azinove-chat-language-model.js +79 -0
- package/dist/azinove-chat-language-model.js.map +1 -0
- package/dist/azinove-provider.d.ts +67 -0
- package/dist/azinove-provider.d.ts.map +1 -0
- package/dist/azinove-provider.js +86 -0
- package/dist/azinove-provider.js.map +1 -0
- package/dist/contract.generated.d.ts +367 -0
- package/dist/contract.generated.d.ts.map +1 -0
- package/dist/contract.generated.js +387 -0
- package/dist/contract.generated.js.map +1 -0
- package/dist/errors.d.ts +64 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +138 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateway-fetch.d.ts +74 -0
- package/dist/gateway-fetch.d.ts.map +1 -0
- package/dist/gateway-fetch.js +250 -0
- package/dist/gateway-fetch.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata.d.ts +19 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +39 -0
- package/dist/metadata.js.map +1 -0
- package/dist/options.d.ts +42 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +90 -0
- package/dist/options.js.map +1 -0
- package/dist/request-filter.d.ts +14 -0
- package/dist/request-filter.d.ts.map +1 -0
- package/dist/request-filter.js +199 -0
- package/dist/request-filter.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +67 -3
- package/src/azinove-chat-language-model.ts +116 -0
- package/src/azinove-provider.ts +149 -0
- package/src/contract.generated.ts +454 -0
- package/src/errors.ts +172 -0
- package/src/gateway-fetch.ts +314 -0
- package/src/index.ts +29 -0
- package/src/metadata.ts +59 -0
- package/src/options.ts +114 -0
- package/src/request-filter.ts +229 -0
- package/src/version.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 AZINOVE SAS
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,226 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @azinove_group/ai-sdk-provider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Azinove provider for the [AI SDK](https://ai-sdk.dev): call Azinove's OpenAI-compatible API
|
|
4
|
+
(`https://api.ai.azinove.com/v1`) from `generateText`, `streamText` and tool loops, with the
|
|
5
|
+
waits of a sovereign GPU (eco mode, queues) reported as they happen.
|
|
6
|
+
|
|
7
|
+
It is built on Vercel's `@ai-sdk/openai-compatible`, like Vercel's own providers for
|
|
8
|
+
OpenAI-compatible APIs, and adapted to Azinove's API:
|
|
9
|
+
|
|
10
|
+
- parameters and fields the API does not accept (top-level parameters, message, content-part,
|
|
11
|
+
tool and option keys the API checks strictly) are dropped before sending, each reported as an
|
|
12
|
+
SDK warning; the test suite runs every request body it prepares through the API's own request
|
|
13
|
+
schema;
|
|
14
|
+
- a streaming request that waits for the GPU or for a free channel reports it through `onStatus`;
|
|
15
|
+
- an error that ends a stream before its first token becomes a normal `APICallError`, with the
|
|
16
|
+
`Retry-After` the API uses for its code, so the AI SDK retries it like any other; a stream that
|
|
17
|
+
closes before its first token without saying why is reported as a retryable 502
|
|
18
|
+
`upstream_error`, never as an empty answer;
|
|
19
|
+
- a usage limit is never retried automatically;
|
|
20
|
+
- the request id, cold start and queue time are in `providerMetadata.azinove`.
|
|
21
|
+
|
|
22
|
+
Requirements: Node.js 22 or later, `ai` 7, and `zod` 3.25.76 or a later 3.x, or 4.1.8 or a later 4.x
|
|
23
|
+
(the peer range `^3.25.76 || ^4.1.8`, the same as the AI SDK's). ES modules only.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install @azinove_group/ai-sdk-provider ai zod
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Create an API key in the Azinove console and set it in the environment. The key belongs on a
|
|
32
|
+
server: never put it in browser code, where anyone can read it.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
export AZINOVE_API_KEY=sk_azn_…
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { azinove } from '@azinove_group/ai-sdk-provider';
|
|
42
|
+
import { streamText } from 'ai';
|
|
43
|
+
|
|
44
|
+
const result = streamText({
|
|
45
|
+
model: azinove('lazuli'),
|
|
46
|
+
prompt: 'Explique la souveraineté des données en trois phrases.',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
for await (const text of result.textStream) process.stdout.write(text);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The model id is the name of your offer (`lazuli`), the one listed by `GET /v1/models` for your
|
|
53
|
+
key. `generateText` works the same way and returns the whole answer.
|
|
54
|
+
|
|
55
|
+
To set the key, the base URL or headers yourself, create your own instance:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { createAzinove } from '@azinove_group/ai-sdk-provider';
|
|
59
|
+
|
|
60
|
+
const azinove = createAzinove({
|
|
61
|
+
apiKey: process.env.MY_AZINOVE_KEY, // default: AZINOVE_API_KEY
|
|
62
|
+
baseURL: 'https://api.ai.azinove.com/v1', // the default; https: only (http: on localhost)
|
|
63
|
+
headers: { 'x-my-header': 'value' },
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Only named exports are provided: `createAzinove`, `azinove`, `AzinoveChatLanguageModel`,
|
|
68
|
+
`getAzinoveErrorDetails`, `GATEWAY_ERRORS`, `AZINOVE_RECOMMENDED_TIMEOUT_MS`,
|
|
69
|
+
`AZINOVE_DEFAULT_BASE_URL`, `AZINOVE_API_KEY_ENV`, `VERSION` and their types.
|
|
70
|
+
|
|
71
|
+
## Tool calling
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { azinove } from '@azinove_group/ai-sdk-provider';
|
|
75
|
+
import { generateText, stepCountIs, tool } from 'ai';
|
|
76
|
+
import { z } from 'zod';
|
|
77
|
+
|
|
78
|
+
const { text } = await generateText({
|
|
79
|
+
model: azinove('lazuli'),
|
|
80
|
+
prompt: 'Quel temps fait-il à Manama ?',
|
|
81
|
+
stopWhen: stepCountIs(3),
|
|
82
|
+
tools: {
|
|
83
|
+
get_weather: tool({
|
|
84
|
+
description: 'The current weather of a city',
|
|
85
|
+
inputSchema: z.object({ city: z.string() }),
|
|
86
|
+
execute: async ({ city }) => ({ city, celsius: 31 }),
|
|
87
|
+
}),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Up to 64 tools per request, each schema at most 32 KB. Structured output (`Output.object`) is
|
|
93
|
+
supported with JSON schema.
|
|
94
|
+
|
|
95
|
+
## Reasoning
|
|
96
|
+
|
|
97
|
+
The model reasons before it answers. Choose how much with the AI SDK's `reasoning` option or with
|
|
98
|
+
the provider options:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const result = await generateText({
|
|
102
|
+
model: azinove('lazuli'),
|
|
103
|
+
prompt: 'Plan a three-day trip to Bahrain.',
|
|
104
|
+
providerOptions: {
|
|
105
|
+
azinove: {
|
|
106
|
+
reasoningEffort: 'high', // 'low' | 'medium' | 'high'
|
|
107
|
+
// enableThinking: false, // answer without thinking: faster and cheaper
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
console.log(result.finalStep.reasoningText); // the reasoning, when the model returned it
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`reasoning: 'none'` turns thinking off; `minimal` is sent as `low` and `xhigh` / `max` as `high`
|
|
116
|
+
(with a compatibility warning). Other provider options: `parallelToolCalls` (boolean),
|
|
117
|
+
`strictJsonSchema` (boolean, default true) and `user` (accepted and ignored: nothing is stored).
|
|
118
|
+
Invalid values throw before any request; unknown keys are reported as warnings and not sent.
|
|
119
|
+
|
|
120
|
+
## Warming up and queues
|
|
121
|
+
|
|
122
|
+
To save energy the GPU sleeps when it is idle. The first request after a pause wakes it up, which
|
|
123
|
+
takes a few minutes; the request waits and then streams normally. When every channel of your
|
|
124
|
+
project is busy, a request waits in a queue first. Streaming requests report both:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
const azinove = createAzinove({
|
|
128
|
+
onStatus: ({ state }, { requestId, requestHeaders }) => {
|
|
129
|
+
const chat = requestHeaders['x-chat-id']; // set per call, see below
|
|
130
|
+
if (state === 'warming_up')
|
|
131
|
+
showBanner(chat, 'Starting the model, this can take a few minutes…');
|
|
132
|
+
if (state === 'queued') showBanner(chat, 'Waiting for a free channel…');
|
|
133
|
+
if (state === 'streaming') hideBanner(chat);
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const result = streamText({
|
|
138
|
+
model: azinove('lazuli'),
|
|
139
|
+
prompt: 'Bonjour',
|
|
140
|
+
headers: { 'x-chat-id': 'chat-42' }, // sent with this call, and handed to onStatus
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`onStatus` is called once per change of state and must not throw. `streaming` comes once, when the
|
|
145
|
+
answer starts after a reported wait; a call that never waited reports nothing, and a wait that ends
|
|
146
|
+
with an error reports no `streaming` (the error reaches the AI SDK as usual). The second argument
|
|
147
|
+
tells concurrent calls apart: `requestId` is the gateway's `x-request-id` of the call, and
|
|
148
|
+
`requestHeaders` holds the headers it was sent with, lower-case, without `Authorization` or any
|
|
149
|
+
other header whose name suggests a credential (cookie, key, token, secret, session, signature).
|
|
150
|
+
Prefer streaming: a non-streaming request waits the same way but cannot report it.
|
|
151
|
+
|
|
152
|
+
After the call, `providerMetadata.azinove` holds what the API said about it:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
const result = streamText({ model: azinove('lazuli'), prompt: 'Bonjour' });
|
|
156
|
+
await result.consumeStream();
|
|
157
|
+
const { requestId, coldStart, queuedMs, warmingUpMs } =
|
|
158
|
+
(await result.finalStep).providerMetadata?.azinove ?? {};
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Timeouts
|
|
162
|
+
|
|
163
|
+
A request that wakes the GPU up can wait for minutes before its first token. Give each call at
|
|
164
|
+
least 300 seconds:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
import { AZINOVE_RECOMMENDED_TIMEOUT_MS, azinove } from '@azinove_group/ai-sdk-provider';
|
|
168
|
+
|
|
169
|
+
await generateText({
|
|
170
|
+
model: azinove('lazuli'),
|
|
171
|
+
prompt: 'Bonjour',
|
|
172
|
+
abortSignal: AbortSignal.timeout(AZINOVE_RECOMMENDED_TIMEOUT_MS),
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
If your HTTP stack or a proxy has its own timeout, raise it too.
|
|
177
|
+
|
|
178
|
+
## Errors
|
|
179
|
+
|
|
180
|
+
Failures are thrown (or streamed) as the AI SDK's `APICallError`, whose `isRetryable` follows the
|
|
181
|
+
API's advice for each error code. The AI SDK retries retryable errors (2 retries by default,
|
|
182
|
+
`maxRetries` to change it) and waits for `Retry-After` when it is under 60 seconds.
|
|
183
|
+
|
|
184
|
+
| Situation | Status | Retried by the SDK |
|
|
185
|
+
| ---------------------------------------------------------- | ------ | ------------------------------------------------- |
|
|
186
|
+
| Invalid request, invalid key, unknown model | 4xx | no: fix the request or the key |
|
|
187
|
+
| Longer than the context window (`context_length_exceeded`) | 400 | no: shorten the conversation or `maxOutputTokens` |
|
|
188
|
+
| No subscription, organization suspended | 403 | no: an organization admin acts |
|
|
189
|
+
| Every channel busy (`channels_busy`) | 429 | yes, after `Retry-After` |
|
|
190
|
+
| GPU still starting (`gpu_starting`) | 503 | yes, after `Retry-After` |
|
|
191
|
+
| Usage limit reached (`usage_limit_reached`) | 429 | never: wait until the limit resets |
|
|
192
|
+
| Server or model error | 5xx | yes, with exponential backoff |
|
|
193
|
+
|
|
194
|
+
An error that ends a stream before its first token has no headers of its own; it gets the
|
|
195
|
+
`Retry-After` the API sends with the same code before a stream: 30 seconds for `gpu_starting`,
|
|
196
|
+
5 for `channels_busy` and `gpu_unavailable`, 300 for `maintenance` (too long for the SDK to wait,
|
|
197
|
+
so not retried), 5 for any other code that carries one.
|
|
198
|
+
|
|
199
|
+
`getAzinoveErrorDetails` reads the code, the advice and the request id from any thrown error:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import { azinove, getAzinoveErrorDetails } from '@azinove_group/ai-sdk-provider';
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
await generateText({ model: azinove('lazuli'), prompt: 'Bonjour' });
|
|
206
|
+
} catch (error) {
|
|
207
|
+
const details = getAzinoveErrorDetails(error);
|
|
208
|
+
// { code: 'channels_busy', status: 429, retryable: true, retryAfterSeconds: 5,
|
|
209
|
+
// whatToDo: 'Retry after the Retry-After header. …', requestId: 'req_…' }
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Quote the `requestId` when you contact support. `GATEWAY_ERRORS` lists every code with its
|
|
214
|
+
meaning and advice.
|
|
215
|
+
|
|
216
|
+
## Limits
|
|
217
|
+
|
|
218
|
+
Context 65,536 tokens, up to 8,192 output tokens per request, text input only: no images, audio
|
|
219
|
+
or video. Through the AI SDK, PDF files (with a text layer) and text files can be attached; the API
|
|
220
|
+
reads them as text.
|
|
221
|
+
Parameters the API does not accept are dropped with a warning (see above). Embedding and image
|
|
222
|
+
models are not offered by this provider.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
Apache-2.0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';
|
|
2
|
+
import type { LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, SharedV4Warning } from '@ai-sdk/provider';
|
|
3
|
+
import type { FetchFunction, Resolvable } from '@ai-sdk/provider-utils';
|
|
4
|
+
/** The chat model ids: the offer names of the API (`lazuli`), or any id a key is allowed. */
|
|
5
|
+
export type AzinoveChatModelId = 'lazuli' | (string & {});
|
|
6
|
+
/** What the provider hands to each chat model. */
|
|
7
|
+
export interface AzinoveChatConfig {
|
|
8
|
+
/** `azinove.chat`. */
|
|
9
|
+
provider: string;
|
|
10
|
+
/** The full URL of a path such as `/chat/completions`. */
|
|
11
|
+
url: (options: {
|
|
12
|
+
modelId: string;
|
|
13
|
+
path: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
/** Headers of every request (Authorization, User-Agent, custom headers). */
|
|
16
|
+
headers: Resolvable<Record<string, string | undefined>>;
|
|
17
|
+
/** The gateway fetch (see createGatewayFetch). */
|
|
18
|
+
fetch: FetchFunction;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An Azinove chat model for the AI SDK, built on OpenAICompatibleChatLanguageModel.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const model = new AzinoveChatLanguageModel('lazuli', config); // usually: azinove('lazuli')
|
|
25
|
+
*/
|
|
26
|
+
export declare class AzinoveChatLanguageModel extends OpenAICompatibleChatLanguageModel {
|
|
27
|
+
private readonly endpoint;
|
|
28
|
+
constructor(modelId: AzinoveChatModelId, config: AzinoveChatConfig);
|
|
29
|
+
/** {@inheritDoc OpenAICompatibleChatLanguageModel.prepareRequest} */
|
|
30
|
+
prepareRequest(options: LanguageModelV4CallOptions): Promise<{
|
|
31
|
+
body: Record<string, unknown>;
|
|
32
|
+
warnings: SharedV4Warning[];
|
|
33
|
+
}>;
|
|
34
|
+
/** Generates a whole answer; `providerMetadata.azinove` carries the gateway's headers. */
|
|
35
|
+
doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Streams an answer. A failure before the first token is thrown as an APICallError (and
|
|
38
|
+
* retried by the AI SDK when retryable); a later one is streamed as an APICallError part.
|
|
39
|
+
*/
|
|
40
|
+
doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=azinove-chat-language-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azinove-chat-language-model.d.ts","sourceRoot":"","sources":["../src/azinove-chat-language-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EACV,0BAA0B,EAC1B,6BAA6B,EAE7B,2BAA2B,EAC3B,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOxE,6FAA6F;AAC7F,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE1D,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,GAAG,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC5D,4EAA4E;IAC5E,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACxD,kDAAkD;IAClD,KAAK,EAAE,aAAa,CAAC;CACtB;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,iCAAiC;IAC7E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,iBAAiB;IAgBlE,qEAAqE;IACtD,cAAc,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC;QAC1E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,QAAQ,EAAE,eAAe,EAAE,CAAC;KAC7B,CAAC;IAMF,0FAA0F;IAC3E,UAAU,CACvB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,6BAA6B,CAAC;IAUzC;;;OAGG;IACY,QAAQ,CACrB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC;CA2BxC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// The chat model: Vercel's OpenAICompatibleChatLanguageModel (prompt conversion, tool calls,
|
|
2
|
+
// reasoning deltas, usage, finish reasons) configured for the gateway and wrapped where the
|
|
3
|
+
// gateway differs from a stock OpenAI-compatible server: provider options, the request filter,
|
|
4
|
+
// in-stream errors and the gateway's response headers.
|
|
5
|
+
import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';
|
|
6
|
+
import { azinoveErrorStructure, toStreamError } from './errors.js';
|
|
7
|
+
import { withAzinoveMetadata } from './metadata.js';
|
|
8
|
+
import { mapReasoning, prepareCallOptions } from './options.js';
|
|
9
|
+
import { filterChatRequestBody } from './request-filter.js';
|
|
10
|
+
/**
|
|
11
|
+
* An Azinove chat model for the AI SDK, built on OpenAICompatibleChatLanguageModel.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const model = new AzinoveChatLanguageModel('lazuli', config); // usually: azinove('lazuli')
|
|
15
|
+
*/
|
|
16
|
+
export class AzinoveChatLanguageModel extends OpenAICompatibleChatLanguageModel {
|
|
17
|
+
endpoint;
|
|
18
|
+
constructor(modelId, config) {
|
|
19
|
+
super(modelId, {
|
|
20
|
+
...config,
|
|
21
|
+
// The gateway sends usage on streams when asked, and supports json_schema output.
|
|
22
|
+
includeUsage: true,
|
|
23
|
+
supportsStructuredOutputs: true,
|
|
24
|
+
// Nothing is fetched by the API: the AI SDK downloads URLs and sends the data inline.
|
|
25
|
+
supportedUrls: () => ({}),
|
|
26
|
+
errorStructure: azinoveErrorStructure,
|
|
27
|
+
mapReasoning,
|
|
28
|
+
transformRequestBody: (body, warnings) => filterChatRequestBody(body, warnings ?? [], modelId),
|
|
29
|
+
});
|
|
30
|
+
this.endpoint = config.url({ modelId, path: '/chat/completions' });
|
|
31
|
+
}
|
|
32
|
+
/** {@inheritDoc OpenAICompatibleChatLanguageModel.prepareRequest} */
|
|
33
|
+
async prepareRequest(options) {
|
|
34
|
+
const prepared = await prepareCallOptions(options);
|
|
35
|
+
const result = await super.prepareRequest(prepared.options);
|
|
36
|
+
return { body: result.body, warnings: [...result.warnings, ...prepared.warnings] };
|
|
37
|
+
}
|
|
38
|
+
/** Generates a whole answer; `providerMetadata.azinove` carries the gateway's headers. */
|
|
39
|
+
async doGenerate(options) {
|
|
40
|
+
const prepared = await prepareCallOptions(options);
|
|
41
|
+
const result = await super.doGenerate(prepared.options);
|
|
42
|
+
return {
|
|
43
|
+
...result,
|
|
44
|
+
warnings: [...result.warnings, ...prepared.warnings],
|
|
45
|
+
providerMetadata: withAzinoveMetadata(result.providerMetadata, result.response?.headers),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Streams an answer. A failure before the first token is thrown as an APICallError (and
|
|
50
|
+
* retried by the AI SDK when retryable); a later one is streamed as an APICallError part.
|
|
51
|
+
*/
|
|
52
|
+
async doStream(options) {
|
|
53
|
+
const prepared = await prepareCallOptions(options);
|
|
54
|
+
const result = await super.doStream(prepared.options);
|
|
55
|
+
const headers = result.response?.headers;
|
|
56
|
+
const requestBody = result.request?.body;
|
|
57
|
+
const endpoint = this.endpoint;
|
|
58
|
+
const stream = result.stream.pipeThrough(new TransformStream({
|
|
59
|
+
transform(part, controller) {
|
|
60
|
+
if (part.type === 'stream-start')
|
|
61
|
+
controller.enqueue({ ...part, warnings: [...part.warnings, ...prepared.warnings] });
|
|
62
|
+
else if (part.type === 'finish')
|
|
63
|
+
controller.enqueue({
|
|
64
|
+
...part,
|
|
65
|
+
providerMetadata: withAzinoveMetadata(part.providerMetadata, headers),
|
|
66
|
+
});
|
|
67
|
+
else if (part.type === 'error')
|
|
68
|
+
controller.enqueue({
|
|
69
|
+
...part,
|
|
70
|
+
error: toStreamError(part.error, endpoint, requestBody),
|
|
71
|
+
});
|
|
72
|
+
else
|
|
73
|
+
controller.enqueue(part);
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
76
|
+
return { ...result, stream };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=azinove-chat-language-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azinove-chat-language-model.js","sourceRoot":"","sources":["../src/azinove-chat-language-model.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,4FAA4F;AAC5F,+FAA+F;AAC/F,uDAAuD;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAU9E,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAiB5D;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iCAAiC;IAC5D,QAAQ,CAAS;IAElC,YAA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,CAAC;QACF,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type LanguageModelV4, type ProviderV4 } from '@ai-sdk/provider';
|
|
2
|
+
import { type FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { type AzinoveChatModelId } from './azinove-chat-language-model.js';
|
|
4
|
+
import { type AzinoveStatusListener } from './gateway-fetch.js';
|
|
5
|
+
/** The API's base URL. */
|
|
6
|
+
export declare const AZINOVE_DEFAULT_BASE_URL = "https://api.ai.azinove.com/v1";
|
|
7
|
+
/**
|
|
8
|
+
* The timeout to give each call, in milliseconds (300 s): a request that wakes the GPU up waits
|
|
9
|
+
* for minutes before its first token.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* await generateText({ model: azinove('lazuli'), prompt, abortSignal: AbortSignal.timeout(AZINOVE_RECOMMENDED_TIMEOUT_MS) });
|
|
13
|
+
*/
|
|
14
|
+
export declare const AZINOVE_RECOMMENDED_TIMEOUT_MS: number;
|
|
15
|
+
/** The environment variable read when no `apiKey` is given. */
|
|
16
|
+
export declare const AZINOVE_API_KEY_ENV = "AZINOVE_API_KEY";
|
|
17
|
+
/** Settings of {@link createAzinove}. */
|
|
18
|
+
export interface AzinoveProviderSettings {
|
|
19
|
+
/** An API key (`sk_azn_…`); defaults to the `AZINOVE_API_KEY` environment variable. */
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Defaults to `https://api.ai.azinove.com/v1`. Must use `https:`; `http:` only for a loopback
|
|
23
|
+
* host (`localhost`, `127.0.0.1`, `[::1]`), since every request carries the API key.
|
|
24
|
+
*/
|
|
25
|
+
baseURL?: string;
|
|
26
|
+
/** Extra headers sent with every request. */
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
/** A fetch implementation (middleware, tests); defaults to the global fetch. */
|
|
29
|
+
fetch?: FetchFunction;
|
|
30
|
+
/**
|
|
31
|
+
* Called when a streaming request starts waiting: `warming_up` while the GPU starts (minutes),
|
|
32
|
+
* `queued` while every channel of the project is busy, then `streaming` once when the answer
|
|
33
|
+
* starts. Called once per change, with the call's request id and headers (credentials removed);
|
|
34
|
+
* must not throw.
|
|
35
|
+
*/
|
|
36
|
+
onStatus?: AzinoveStatusListener;
|
|
37
|
+
}
|
|
38
|
+
/** The Azinove provider: call it with a model id, as in `azinove('lazuli')`. */
|
|
39
|
+
export interface AzinoveProvider extends ProviderV4 {
|
|
40
|
+
/** A chat model. */
|
|
41
|
+
(modelId: AzinoveChatModelId): LanguageModelV4;
|
|
42
|
+
/** A chat model. */
|
|
43
|
+
languageModel(modelId: AzinoveChatModelId): LanguageModelV4;
|
|
44
|
+
/** A chat model. */
|
|
45
|
+
chatModel(modelId: AzinoveChatModelId): LanguageModelV4;
|
|
46
|
+
/** Not provided: throws NoSuchModelError. */
|
|
47
|
+
embeddingModel(modelId: string): never;
|
|
48
|
+
/** Not provided: throws NoSuchModelError. */
|
|
49
|
+
imageModel(modelId: string): never;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates an Azinove provider. Throws InvalidArgumentError when `baseURL` is not `https:` (or
|
|
53
|
+
* `http:` on a loopback host).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const azinove = createAzinove({ onStatus: ({ state }) => console.warn(state) });
|
|
57
|
+
* const { text } = await generateText({ model: azinove('lazuli'), prompt: 'Bonjour' });
|
|
58
|
+
*/
|
|
59
|
+
export declare function createAzinove(settings?: AzinoveProviderSettings): AzinoveProvider;
|
|
60
|
+
/**
|
|
61
|
+
* The default provider, reading `AZINOVE_API_KEY`.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* const result = streamText({ model: azinove('lazuli'), prompt: 'Explain eco mode' });
|
|
65
|
+
*/
|
|
66
|
+
export declare const azinove: AzinoveProvider;
|
|
67
|
+
//# sourceMappingURL=azinove-provider.d.ts.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