@wavespeed/cli 0.4.12 → 0.4.13
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/dist/commands/price.js +3 -3
- package/dist/commands/schema.js +2 -2
- package/dist/lib/api.js +6 -3
- package/package.json +1 -1
package/dist/commands/price.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
|
-
import { fetchPricing,
|
|
3
|
+
import { fetchPricing, modelDocsUrl } from '../lib/api.js';
|
|
4
4
|
import { parseInputs } from '../lib/inputs.js';
|
|
5
5
|
import { resolveModelToken } from '../lib/config.js';
|
|
6
6
|
import { collectLocalFiles, resolveLocalFiles } from '../lib/local-files.js';
|
|
@@ -80,7 +80,7 @@ export function registerPrice(program) {
|
|
|
80
80
|
...data,
|
|
81
81
|
estimate: true,
|
|
82
82
|
disclaimer,
|
|
83
|
-
|
|
83
|
+
docs_url: modelDocsUrl(resolved.model),
|
|
84
84
|
uploaded: uploadedUrls,
|
|
85
85
|
}, null, 2) + '\n');
|
|
86
86
|
return;
|
|
@@ -102,7 +102,7 @@ export function registerPrice(program) {
|
|
|
102
102
|
}
|
|
103
103
|
console.log();
|
|
104
104
|
console.log(chalk.gray('Run it: ') + chalk.cyan(`wavespeed run ${modelArg}` + (opts.prompt ? ` -p "${opts.prompt}"` : '')));
|
|
105
|
-
console.log(chalk.gray('Model
|
|
105
|
+
console.log(chalk.gray('Model docs: ') + chalk.cyan(modelDocsUrl(resolved.model)));
|
|
106
106
|
console.log(chalk.gray(disclaimer));
|
|
107
107
|
console.log();
|
|
108
108
|
}
|
package/dist/commands/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
|
-
import { fetchModels,
|
|
3
|
+
import { fetchModels, modelDocsUrl } from '../lib/api.js';
|
|
4
4
|
function getRequestSchema(model) {
|
|
5
5
|
return model.api_schema?.api_schemas?.[0]?.request_schema;
|
|
6
6
|
}
|
|
@@ -116,7 +116,7 @@ export function registerSchema(program) {
|
|
|
116
116
|
chalk.white(model.type ?? 'unknown') +
|
|
117
117
|
(model.base_price !== undefined ? chalk.gray(' base price: ') + chalk.green(`$${model.base_price}`) : ''));
|
|
118
118
|
console.log(chalk.gray(' page: ') + chalk.cyan(`https://wavespeed.ai/models/${model.model_id}`));
|
|
119
|
-
console.log(chalk.gray('
|
|
119
|
+
console.log(chalk.gray(' docs: ') + chalk.cyan(modelDocsUrl(model.model_id)));
|
|
120
120
|
if (model.description) {
|
|
121
121
|
console.log(wrap(model.description, ' '));
|
|
122
122
|
}
|
package/dist/lib/api.js
CHANGED
|
@@ -130,9 +130,12 @@ async function apiPost(path, body, opts = {}) {
|
|
|
130
130
|
export async function fetchBalance() {
|
|
131
131
|
return apiGet('/api/v3/balance');
|
|
132
132
|
}
|
|
133
|
-
// The model
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
// The model's page on the docs site (same rule as the dashboard's model page
|
|
134
|
+
// link): provider folder, then the id without a leading "wavespeed-ai/" and
|
|
135
|
+
// with "/" turned into "-".
|
|
136
|
+
export function modelDocsUrl(modelId) {
|
|
137
|
+
const provider = modelId.split('/')[0];
|
|
138
|
+
return `https://wavespeed.ai/docs/docs-api/${provider}/${modelId.replace('wavespeed-ai/', '').split('/').join('-')}`;
|
|
136
139
|
}
|
|
137
140
|
export async function fetchPricing(modelId, inputs) {
|
|
138
141
|
// /model/price is the documented pricing endpoint; /model/pricing is a
|