@aihubmix/ai-sdk-provider 2.1.0 → 2.2.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/CHANGELOG.md +7 -0
- package/README.ja.md +37 -0
- package/README.md +44 -0
- package/README.zh.md +37 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @aihubmix/ai-sdk-provider
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 新增 `baseURL` 配置项:`createAihubmix({ baseURL })` 可覆盖请求 host(默认 `https://aihubmix.com`,末尾斜杠会自动去除)。`/v1`、`/gemini/v1beta` 等路径自动拼接,适用于自建网关 / 代理场景。
|
|
8
|
+
- 修复 `fetch` 透传:为 Claude、Gemini、Responses 三类模型补上 `fetch` 选项,使自定义 `fetch` 对所有 sub-model 生效(此前仅 OpenAI-compatible / completion / transcription / speech 生效)。
|
|
9
|
+
|
|
3
10
|
## 2.1.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
package/README.ja.md
CHANGED
|
@@ -66,6 +66,43 @@ const aihubmix = createAihubmix({
|
|
|
66
66
|
});
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
### `appCode`(任意)
|
|
70
|
+
|
|
71
|
+
すべてのリクエストには `APP-Code` ヘッダーが付与されます。デフォルトでは本パッケージに組み込まれた値が使われるため、**通常は設定不要です**。独自の app code がある場合は、`appCode` を渡してデフォルト値を上書きできます:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
75
|
+
|
|
76
|
+
const aihubmix = createAihubmix({
|
|
77
|
+
apiKey: 'your-api-key-here',
|
|
78
|
+
appCode: 'YOUR-APP-CODE', // 任意;省略時は組み込みのデフォルト値にフォールバック
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `baseURL`(任意)
|
|
83
|
+
|
|
84
|
+
デフォルトではすべてのリクエストは `https://aihubmix.com` に送信されます。独自のゲートウェイやプロキシ経由にする場合は `baseURL` を渡します(末尾のスラッシュは自動的に除去されます)。`/v1` や `/gemini/v1beta` などのパスは自動的に付与されます:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
88
|
+
|
|
89
|
+
const aihubmix = createAihubmix({
|
|
90
|
+
apiKey: 'your-api-key-here',
|
|
91
|
+
baseURL: 'https://your-gateway.example.com', // 任意;デフォルトは https://aihubmix.com
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### カスタム `fetch`
|
|
96
|
+
|
|
97
|
+
カスタム `fetch` 実装(プロキシ、ロギング、テスト用)を渡せます。OpenAI互換、Claude、Gemini、Responses、文字起こし、音声のすべてのモデルに転送されます:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const aihubmix = createAihubmix({
|
|
101
|
+
apiKey: 'your-api-key-here',
|
|
102
|
+
fetch: myCustomFetch,
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
69
106
|
## 使用
|
|
70
107
|
|
|
71
108
|
まず、必要な関数をインポートします:
|
package/README.md
CHANGED
|
@@ -67,6 +67,50 @@ const aihubmix = createAihubmix({
|
|
|
67
67
|
});
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
### `appCode` (optional)
|
|
71
|
+
|
|
72
|
+
Every request carries an `APP-Code` header. By default it uses the value
|
|
73
|
+
built into this package, so **you do not need to set it**. If you have your
|
|
74
|
+
own app code, pass `appCode` to override the default:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
78
|
+
|
|
79
|
+
const aihubmix = createAihubmix({
|
|
80
|
+
apiKey: 'your-api-key-here',
|
|
81
|
+
appCode: 'YOUR-APP-CODE', // optional; falls back to the built-in default when omitted
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `baseURL` (optional)
|
|
86
|
+
|
|
87
|
+
By default all requests go to `https://aihubmix.com`. To route through your
|
|
88
|
+
own gateway or proxy, pass `baseURL` (a trailing slash is allowed and
|
|
89
|
+
stripped). Paths such as `/v1` and `/gemini/v1beta` are appended
|
|
90
|
+
automatically:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
94
|
+
|
|
95
|
+
const aihubmix = createAihubmix({
|
|
96
|
+
apiKey: 'your-api-key-here',
|
|
97
|
+
baseURL: 'https://your-gateway.example.com', // optional; defaults to https://aihubmix.com
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Custom `fetch`
|
|
102
|
+
|
|
103
|
+
You may pass a custom `fetch` implementation (for proxies, logging, or
|
|
104
|
+
testing). It is forwarded to every model — OpenAI-compatible, Claude,
|
|
105
|
+
Gemini, Responses, transcription, and speech:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
const aihubmix = createAihubmix({
|
|
109
|
+
apiKey: 'your-api-key-here',
|
|
110
|
+
fetch: myCustomFetch,
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
70
114
|
## Usage
|
|
71
115
|
|
|
72
116
|
First, import the necessary functions:
|
package/README.zh.md
CHANGED
|
@@ -66,6 +66,43 @@ const aihubmix = createAihubmix({
|
|
|
66
66
|
});
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
### `appCode`(可选)
|
|
70
|
+
|
|
71
|
+
每个请求都会携带 `APP-Code` 请求头。默认使用本包内置的值,因此**通常无需设置**。如果你有自己的 app code,可传入 `appCode` 覆盖默认值:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
75
|
+
|
|
76
|
+
const aihubmix = createAihubmix({
|
|
77
|
+
apiKey: 'your-api-key-here',
|
|
78
|
+
appCode: 'YOUR-APP-CODE', // 可选;不传时回退到内置默认值
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `baseURL`(可选)
|
|
83
|
+
|
|
84
|
+
默认所有请求发往 `https://aihubmix.com`。若要走自建网关或代理,可传入 `baseURL`(末尾斜杠会自动去除)。`/v1`、`/gemini/v1beta` 等路径会自动拼接:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { createAihubmix } from '@aihubmix/ai-sdk-provider';
|
|
88
|
+
|
|
89
|
+
const aihubmix = createAihubmix({
|
|
90
|
+
apiKey: 'your-api-key-here',
|
|
91
|
+
baseURL: 'https://your-gateway.example.com', // 可选;默认 https://aihubmix.com
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 自定义 `fetch`
|
|
96
|
+
|
|
97
|
+
可传入自定义 `fetch` 实现(用于代理、日志或测试)。它会透传给所有模型 —— OpenAI 兼容、Claude、Gemini、Responses、转录与语音:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const aihubmix = createAihubmix({
|
|
101
|
+
apiKey: 'your-api-key-here',
|
|
102
|
+
fetch: myCustomFetch,
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
69
106
|
## 使用
|
|
70
107
|
|
|
71
108
|
首先,导入必要的函数:
|