@vibedev-si/dsh-vibedev 0.3.2 → 0.3.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 CHANGED
@@ -95,6 +95,7 @@
95
95
 
96
96
  - VibeDev 的聊天模型按用量计费,价格以 VibeDev 网关为准。
97
97
  - 图片按张计费,视频按秒计费(参考视频的时长也计入),音乐和播客按次计费,语音按原始秒计费(按服务商返回的原始时长,可能和播放时长不同),转写按分钟计费。`media_models` 会列出当前价格;目录没有给出价格的模型显示「未定价」,不代表免费。
98
+ - 按视频 Token 计价的模型(目录里的 `video_pricing`)按分辨率和有无参考视频、参考音频、参考图(含首尾帧)分档,例如「480p 无参考视频 ¥60.06/百万 Token(预计 ¥0.5819/秒)」。生成前的金额只是预估:每秒预估价 ×(输出时长 + 所有参考视频时长),最终按实际视频 Token 结算。参考视频时长未知、目录没有每秒预估价或计价方式当前版本不支持时,显示「无法预估;按实际视频 Token 用量结算」,不会当成免费或未定价。视频生成后费用仍在确认(`billing_status: pending`)时,视频照常保存,只是费用待确认,不会重新生成。
98
99
  - 视频和音频只在成功时扣费,失败和取消的任务不扣。视频提交后无法取消。
99
100
  - 同一次操作只会生成一次:提交没有得到确认时,会用同一个请求键向网关确认结果;查询或下载失败只会重新查询、刷新链接,不会重新提交。结果已经生成、但费用还在结算(`settlement_pending`)时,结果照常保存,不会重新生成。
100
101
  - 余额在每次付费请求结束后(对话回复、生成、转写)马上重新读取,侧栏和设置页几秒内就能看到扣费后的余额。
@@ -173,7 +174,7 @@ Everything is paid from your VibeDev balance; the DeepSeek account stays DeepSee
173
174
 
174
175
  **Audio models**: whether an audio model makes music, a podcast, speech or a transcription comes from its catalog declaration (`audio.generation_kind`), never from its name; a model that declares no kind is listed but cannot generate. Each model is sent only the fields it declares in `request_fields`, with the text in its `prompt_field`: music takes `prompt`, `lyrics`, `genre`, `mood` and `gender`; a podcast `prompt` and `source_url`; speech what it declares (Seed: `text_prompt`, `references`, `audio_config`, `watermark`). Speech reference limits (count, size, length, exclusions) and the sample rates of each output format come from the gateway. Music and podcasts take no references, format, sample rate or duration.
175
176
 
176
- **Cost**: chat models are billed by usage at the gateway's prices; images per image, video per second (reference video length counts), music and podcasts per request, speech per second of original audio (the length the provider reports, which can differ from playback), transcription per minute. A model without a catalog price is shown as "not priced" (未定价), never as free. Failed and cancelled video and audio tasks are not charged, and a submitted video cannot be cancelled. One operation generates once: an unconfirmed submission is settled under the same key, a failed query or download only queries again or renews the link, and a result whose charge is still settling (`settlement_pending`) is kept, never generated again. "Ask before each paid generation" is off by default.
177
+ **Cost**: chat models are billed by usage at the gateway's prices; images per image, video per second (reference video length counts), music and podcasts per request, speech per second of original audio (the length the provider reports, which can differ from playback), transcription per minute. A model without a catalog price is shown as "not priced" (未定价), never as free. Video models priced per video Token (`video_pricing` in the catalog) have one Token price per resolution and presence of reference video, audio and images (first and last frames count as images); before a run the plugin estimates the matching rule's per-second price times the output length plus every reference video's length, and the final charge is the actual video Tokens. When that cannot be estimated (an unmeasured reference video, no per-second estimate, a pricing mode this version does not read) it says "estimate unavailable; billed by actual video Token usage" — never free, never "not priced". A finished video whose billing is still pending (`billing_status: pending`) is saved as usual and never generated again; only the charge is still to be confirmed. Failed and cancelled video and audio tasks are not charged, and a submitted video cannot be cancelled. One operation generates once: an unconfirmed submission is settled under the same key, a failed query or download only queries again or renews the link, and a result whose charge is still settling (`settlement_pending`) is kept, never generated again. "Ask before each paid generation" is off by default.
177
178
 
178
179
  **Settings**: open "VibeDev Account & Models" on the Plugins page for the spending confirmation, the output folder and the default media models. `displayName`, `preferredModels`, `openBrowserOnSignIn`, `catalogRefreshMinutes`, `client` (the client name sent with the sign-in, default `vibedev-plugin`) and `primary` (show the account as the app's main account; off by default, on in the VibeDev app) are set in the profile's `cordis.patch.yml` row `dsh-vibedev`.
179
180
 
@@ -181,7 +182,7 @@ Everything is paid from your VibeDev balance; the DeepSeek account stays DeepSee
181
182
 
182
183
  **Privacy**: prompts and reference media are sent to the VibeDev gateway, which forwards them to the model provider. The plugin's own sign-in is kept in the DeepSeek Harness credential store, and task records under `dsh-media/` in the DeepSeek Harness data folder (the former name, kept so an upgrade loses nothing).
183
184
 
184
- **For other plugins**: the `vibedevMedia` service generates images, videos and audio (`startAudio`: music, podcasts and speech) through the same model choice, reference checks, idempotent submission and background saving; the film workbench ([dsh-film](https://github.com/VibeDev-Si/dsh-film)) storyboard uses it. `audioForms()` describes the form of each audio model (only its declared fields, choices and limits, and its price). Every task is read the same way: `task` (as recorded), `refreshTask` (ask the gateway again — fresh links, settlement; a query, never a submission), `onTask` (each change) and `result` (the files to play or download). Pass the same `operationId` when one click is retried: its task is returned and nothing is submitted twice.
185
+ **For other plugins**: the `vibedevMedia` service generates images, videos and audio (`startAudio`: music, podcasts and speech) through the same model choice, reference checks, idempotent submission and background saving; the film workbench ([dsh-film](https://github.com/VibeDev-Si/dsh-film)) storyboard uses it. `audioForms()` describes the form of each audio model (only its declared fields, choices and limits, and its price). `videoQuote(request)` quotes a video request from the cached catalog alone (no upload, no submission): a video Token estimate with its rule and basis, a legacy estimate, or why there is none. Task views carry `settlement`, `settlementPendingReason`, `chargedCny` (only once settled, exactly as the gateway wrote it) and `billing.tokens`. Every task is read the same way: `task` (as recorded), `refreshTask` (ask the gateway again — fresh links, settlement; a query, never a submission), `onTask` (each change) and `result` (the files to play or download). Pass the same `operationId` when one click is retried: its task is returned and nothing is submitted twice.
185
186
 
186
187
  **Third-party code**: the model route in `src/llm/` is ported from the VibeDev app; `context.ts`, `replay.ts` and `stream.ts` are copied from DeepSeek Harness's `@deepseek-ai/dsh-llm-pi-ai` (MIT). The licences of the bundled pi-ai, Anthropic SDK, OpenAI SDK and their dependencies are in `THIRD-PARTY-NOTICES.txt`.
187
188
 
@@ -1,4 +1,4 @@
1
- THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.3.2
1
+ THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.3.4
2
2
 
3
3
  This package bundles code from the projects below. Each is used under the licence that
4
4
  follows its name; the licence texts are reproduced as the projects ship them.
@@ -108,6 +108,37 @@ export interface MediaPricing {
108
108
  readonly amount: number;
109
109
  };
110
110
  }
111
+ /**
112
+ * One video Token price rule (`video_pricing.rules[]`). A condition that is
113
+ * absent matches anything; `false` means the request must carry none of that
114
+ * reference, `true` at least one. First and last frames count as images.
115
+ */
116
+ export interface VideoTokenRule {
117
+ /** The exact resolution tier, such as `480p`. */
118
+ readonly resolution: string;
119
+ readonly referenceVideo?: boolean;
120
+ readonly referenceAudio?: boolean;
121
+ readonly referenceImage?: boolean;
122
+ /** The final selling price: CNY per 1,000,000 billable video Tokens (>= 0). */
123
+ readonly pricePerMillionTokensCny: number;
124
+ /** The provisional estimate per second of output plus reference video; absent is unknown, never zero. */
125
+ readonly estimatedPricePerSecondCny?: number;
126
+ }
127
+ /**
128
+ * A video model's Token pricing (`video_pricing`, schema 1): the charge is the
129
+ * provider's billable video Tokens times the matching rule's price; the
130
+ * per-second figure only estimates it before the task runs.
131
+ */
132
+ export interface VideoTokenPricing {
133
+ readonly schemaVersion: 1;
134
+ readonly currency: 'CNY';
135
+ readonly finalBasis: 'provider_tokens';
136
+ readonly estimateBasis: 'output_plus_reference_video_seconds';
137
+ readonly estimateOnly: boolean;
138
+ readonly rules: readonly VideoTokenRule[];
139
+ }
140
+ /** Why a model's `video_pricing` cannot be used: a schema this plugin does not read, or a malformed object. */
141
+ export type VideoPricingIssue = 'unknown-schema' | 'invalid';
111
142
  /** What an audio model does, as the catalog declares it (`audio.generation_kind`). */
112
143
  export declare const AUDIO_GENERATION_KINDS: readonly ["music", "podcast", "speech", "transcription"];
113
144
  export type AudioGenerationKind = typeof AUDIO_GENERATION_KINDS[number];
@@ -172,6 +203,13 @@ export interface MediaModel {
172
203
  readonly endpoints: readonly string[];
173
204
  readonly inputModalities: readonly string[];
174
205
  readonly pricing?: MediaPricing;
206
+ /** Video Token pricing (`video_pricing`); a model with it is never quoted from `pricing`. */
207
+ readonly videoPricing?: VideoTokenPricing;
208
+ /**
209
+ * Set instead of `videoPricing` when the catalog sends `video_pricing` this plugin
210
+ * cannot use. Such a model has no estimate at all: it never falls back to `pricing`.
211
+ */
212
+ readonly videoPricingIssue?: VideoPricingIssue;
175
213
  readonly video?: VideoCapabilities;
176
214
  readonly audio?: AudioCapabilities;
177
215
  }
@@ -195,6 +233,16 @@ export declare function effectiveVideoModes(video: VideoCapabilities): Partial<R
195
233
  * @returns the declared capabilities; `generationKind` is absent unless declared.
196
234
  */
197
235
  export declare function parseAudioCapabilities(raw: Json): AudioCapabilities;
236
+ /**
237
+ * Parse `video_pricing`. Every rule is checked: one unreadable rule makes the
238
+ * whole object unusable, since dropping it could make another rule look unique.
239
+ * @param value - the entry's `video_pricing`.
240
+ * @returns the pricing, the reason it cannot be used, or nothing when the entry has none.
241
+ */
242
+ export declare function parseVideoPricing(value: unknown): {
243
+ videoPricing?: VideoTokenPricing;
244
+ videoPricingIssue?: VideoPricingIssue;
245
+ };
198
246
  /**
199
247
  * Parse a `/v1/models` body into its media models.
200
248
  * @param body - `{data:[...]}` or a bare array.
package/lib/index.d.ts CHANGED
@@ -26,11 +26,11 @@ export { MediaError } from './gateway/errors.js';
26
26
  export { MediaHostService } from './service.js';
27
27
  export type { HostTarget, MediaOutputView, MediaTaskView } from './service.js';
28
28
  export type { AudioForm, AudioFormField, AudioMakeKind, AudioRequest } from './audio/request.js';
29
- export type { AudioQuote } from './pricing.js';
29
+ export type { AudioQuote, Bilingual, VideoLegacyEstimate, VideoQuote, VideoQuoteReason, VideoQuoteRequest, VideoQuoteRule, VideoQuoteUnavailable, VideoTokenEstimate, } from './pricing.js';
30
30
  export type { ImageRequest } from './tools/image.js';
31
31
  export type { VideoRequest } from './tools/video.js';
32
32
  export { parseMediaCatalog } from './gateway/catalog.js';
33
- export type { AudioCapabilities, AudioGenerationKind, MediaModel, PriceUnit, VideoCapabilities, VideoMode } from './gateway/catalog.js';
33
+ export type { AudioCapabilities, AudioGenerationKind, MediaModel, PriceUnit, VideoCapabilities, VideoMode, VideoPricingIssue, VideoTokenPricing, VideoTokenRule, } from './gateway/catalog.js';
34
34
  export { ACCOUNT_ROUTE_PREFIX, AccountService } from './account/index.js';
35
35
  export type { AccountSource, AccountView } from './account/index.js';
36
36
  export { GATEWAY_SEARCH_PROVIDER_ID as SEARCH_PROVIDER_ID } from './search/provider.js';