@meterapp/car-image-sdk 1.40.1 → 1.42.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/README.md +8 -7
- package/dist/client.d.ts +13 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +49 -16
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +60 -7
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +105 -68
- package/dist/mcp/index.js.map +1 -1
- package/dist/packs.d.ts +10 -0
- package/dist/packs.d.ts.map +1 -1
- package/dist/params.d.ts +5 -0
- package/dist/params.d.ts.map +1 -1
- package/dist/params.js +17 -1
- package/dist/params.js.map +1 -1
- package/dist/signed-url.d.ts.map +1 -1
- package/dist/signed-url.js +2 -0
- package/dist/signed-url.js.map +1 -1
- package/dist/types.d.ts +142 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -8
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/mcp/index.js
CHANGED
|
@@ -12,13 +12,13 @@ import { checkoutLinkToolSchema, checkoutStatusResultSchema, checkoutStatusSchem
|
|
|
12
12
|
*/
|
|
13
13
|
import * as z from "zod";
|
|
14
14
|
import { isColor } from "../params.js";
|
|
15
|
-
import { CATALOG, CHECK_STATUSES, COLORS, CREDITS_PER_3D_MODEL, CREDITS_PER_DOLLAR, CREDITS_PER_IMAGE, DEFAULT_BASE_URL, FITS, FORMATS, FRAMINGS, FREE_CREDITS, FREE_VEHICLE_IMAGES, PLAN_ALLOWANCES, IDEMPOTENCY_KEY_PATTERN, MAX_CHECK_VEHICLES, MAX_CHECK_VIEWS_VEHICLES, ASPECT_RATIOS, RESOLUTIONS, MAX_PADDING_PERCENT, MIN_YEAR, MODEL_3D_FILE_KINDS, REFERRAL_SOURCES, REQUEST_FORMATS, REQUEST_KINDS, REQUEST_SORTS, REQUEST_STATUSES, SIZES, VEHICLE_ID_PATTERN, VIEWS, } from "../types.js";
|
|
15
|
+
import { CATALOG, CHECK_STATUSES, COLORS, CREDITS_PER_3D_MODEL, CREDITS_PER_DOLLAR, CREDITS_PER_IMAGE, DEFAULT_BASE_URL, FITS, FORMATS, FRAMINGS, FREE_CREDITS, FREE_COURTESY_VEHICLE_IMAGES, FREE_VEHICLE_IMAGES, PLAN_ALLOWANCES, IDEMPOTENCY_KEY_PATTERN, MAX_CHECK_VEHICLES, MAX_CHECK_VIEWS_VEHICLES, ASPECT_RATIOS, RESOLUTIONS, MAX_PADDING_PERCENT, MIN_YEAR, MODEL_3D_FILE_KINDS, REFERRAL_SOURCES, REQUEST_FORMATS, REQUEST_KINDS, REQUEST_SORTS, REQUEST_STATUSES, SIZES, MARKET_PATTERN, VEHICLE_ID_PATTERN, VIEWS, } from "../types.js";
|
|
16
16
|
import { SDK_VERSION } from "../version.js";
|
|
17
17
|
/** The 3D price as agents read it: "100 credits ($1.00)". */
|
|
18
18
|
const RESOLUTION_NAMES = Object.keys(RESOLUTIONS);
|
|
19
19
|
/** What an image's own size is, wherever the tools state a size limit. */
|
|
20
20
|
const STORED_SIZE_NOTE = "1024 px square for older renders, up to 2560 px for new ones";
|
|
21
|
-
const MODEL_3D_PRICE = `${CREDITS_PER_3D_MODEL.toLocaleString("en-US")} credits
|
|
21
|
+
const MODEL_3D_PRICE = `${CREDITS_PER_3D_MODEL.toLocaleString("en-US")} credits`;
|
|
22
22
|
/**
|
|
23
23
|
* Catalog size as agents read it in the instructions and tool descriptions.
|
|
24
24
|
* Derived from CATALOG so the figures cannot drift from the database; agents
|
|
@@ -47,7 +47,7 @@ export const MCP_SERVER_INFO = {
|
|
|
47
47
|
*/
|
|
48
48
|
export const MCP_SERVER_CAPABILITIES = { tools: { listChanged: false } };
|
|
49
49
|
/**
|
|
50
|
-
* Which tools a server exposes. `core`, the default, is what an agent needs to
|
|
50
|
+
* Which tools a server exposes. `core`, the stdio default, is what an agent needs to
|
|
51
51
|
* look a vehicle up, render it and watch the balance (the 2026-09-29 audit of
|
|
52
52
|
* the public surface found those carrying all of the MCP traffic), plus the
|
|
53
53
|
* four feedback tools every fleet product puts in its default list
|
|
@@ -55,8 +55,7 @@ export const MCP_SERVER_CAPABILITIES = { tools: { listChanged: false } };
|
|
|
55
55
|
* review. `all`
|
|
56
56
|
* adds make logos, 3D models, image options, the API reference, pricing, help
|
|
57
57
|
* and billing links, plus the tools that are served but kept out of the public
|
|
58
|
-
* reference ({@link MCP_UNLISTED_TOOLS}),
|
|
59
|
-
* on the remote URL, `car-image mcp --toolset all` locally). Fewer, sharper
|
|
58
|
+
* reference ({@link MCP_UNLISTED_TOOLS}), on the hosted endpoint by default and with `car-image mcp --toolset all` locally. Fewer, sharper
|
|
60
59
|
* tools cost less context and make the right one easier to pick. `all` lists
|
|
61
60
|
* the core tools first: tools/list order is what a host shows.
|
|
62
61
|
*/
|
|
@@ -157,8 +156,8 @@ export function isMcpToolset(value) {
|
|
|
157
156
|
* the rest, which used to be everything from the third workflow step on: the
|
|
158
157
|
* rule about signed URLs, the one about a 402, the missing-vehicle rule. What
|
|
159
158
|
* an agent must know to use the tools well and safely is therefore written
|
|
160
|
-
*
|
|
161
|
-
*
|
|
159
|
+
* in the shared instructions and kept under this length ({@link mcpInstructionsHead}).
|
|
160
|
+
* Tool-specific guidance belongs in the tool descriptions.
|
|
162
161
|
*/
|
|
163
162
|
export const MCP_INSTRUCTIONS_HEAD_LIMIT = 2048;
|
|
164
163
|
/**
|
|
@@ -167,8 +166,6 @@ export const MCP_INSTRUCTIONS_HEAD_LIMIT = 2048;
|
|
|
167
166
|
* instructions no longer steer an agent to them.
|
|
168
167
|
*/
|
|
169
168
|
const HEAD_MISSING = "tell the human the catalog does not carry it and stop";
|
|
170
|
-
/** When to use the feedback tools, which every toolset has. */
|
|
171
|
-
const HEAD_FEEDBACK = "Feedback (free): when a call fails in a way that looks like our bug, offer report_issue with its request_id; when the human wishes the API did something, request_feature. Both return similar items first: upvote_feedback a match instead. After real use, offer submit_review.";
|
|
172
169
|
/** The 3D rule, shown only where create_3d_model is a tool the host has. */
|
|
173
170
|
const HEAD_3D = "Confirm with the human before calling create_3d_model. ";
|
|
174
171
|
function toolsetHas(toolset, tool) {
|
|
@@ -183,32 +180,19 @@ function toolsetHas(toolset, tool) {
|
|
|
183
180
|
* the rest.
|
|
184
181
|
*/
|
|
185
182
|
export function mcpInstructionsHead(toolset = DEFAULT_MCP_TOOLSET) {
|
|
186
|
-
return `Car Image API by Meter
|
|
183
|
+
return `Car Image API by Meter provides vehicle images from the @meterapp/vehicle-db catalog in nine views and any paint color.
|
|
187
184
|
|
|
188
|
-
First look the vehicle up
|
|
185
|
+
First look the vehicle up with resolve_vehicle, search_vehicles or decode_vin. Use check_vehicles for up to ${MAX_MCP_CHECK_VEHICLES} vehicles at once. Include the requested year. If the user gave no year, state which year you selected. Use the returned vehicle id as vehicle for subsequent calls. If confidence is low or the year differs, ask the user before proceeding. If there is no match, ${HEAD_MISSING}. Never substitute another vehicle.
|
|
189
186
|
|
|
190
|
-
In ChatGPT,
|
|
187
|
+
Use get_image_availability to check prepared views and quality without rendering. In ChatGPT, create_car_image_urls shows the image card. For an image in chat, request ttl_seconds: 604800, max_uses: 0 and renew: false. Other chat hosts can display get_car_image. Use signed URLs for pages, apps, emails and documents, or when the host cannot display image bytes. Reuse a valid URL and link to it if the card is unavailable. Use one image call per requested image. Never place the API key in URLs, logs or client code.
|
|
191
188
|
|
|
192
|
-
|
|
189
|
+
Catalog lookups are free. A new account includes ${FREE_VEHICLE_IMAGES} free vehicle images in total and ${FREE_COURTESY_VEHICLE_IMAGES} more as a one-time courtesy after those run out. A vehicle image is one vehicle in one color from one view. Confirm the count before expanding a batch the user did not size. ${toolsetHas(toolset, "create_3d_model") ? HEAD_3D : ""}On HTTP 402, stop and share any link in the response. On HTTP 429, honor retry_after or reset_at when present.
|
|
193
190
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
${HEAD_FEEDBACK}`;
|
|
191
|
+
Use feedback tools when requested. Confirm the text before posting or replacing a public review.`;
|
|
197
192
|
}
|
|
198
|
-
|
|
199
|
-
{ needs: [], text: `Reference.\n\nImages: nine camera views (front, rear, both side profiles, all four three-quarter corners and top, straight down from above), any paint color (fifteen named presets or any hex such as #1a2b3c), PNG/WebP/JPG up to 1024 px, any width and height (fit contain|cover|inside), transparent or a solid background color. Every catalog vehicle has a stable id (veh_ followed by 13 characters) that search_vehicles, resolve_vehicle, decode_vin and check_vehicles return and every tool that names a vehicle accepts as \`vehicle\` in place of make, model and year.` },
|
|
200
|
-
{ needs: ["create_3d_model", "get_3d_model", "publish_3d_model"], text: `3D models: for a textured 3D model (GLB, USDZ, FBX), call create_3d_model once the human has agreed to the cost, then poll get_3d_model every few seconds until status is ready and hand over files.<kind>.url; the first model of a vehicle takes 10–20 minutes; further colors take 1–2 minutes. To put a model on a web page, pass publish: true to create_3d_model (or call publish_3d_model later) and paste data.public.embed.html: a script tag and a <car-3d> element, hosted by Car Image, no key in the page; data.public.files are the key-free GLB, USDZ and poster URLs for any other viewer. create_3d_model is charged when the request is made, and billing.already_owned is true when it was free.` },
|
|
201
|
-
{ needs: ["get_make_logo"], text: `Make logos: get_make_logo returns a catalog make logo inline for 1 credit per successful call, cached or generated. It accepts make and image transforms, with no vehicle selector, view or paint color. There is no signed logo URL: use car-image logo or client.getMakeLogo to download for a site. Inspect generated logos before use. Logos are third-party trademarks for referential display only; no license is granted and they sit outside every VehiclesDB indemnity. See ${DEFAULT_BASE_URL}/terms?ref=mcp#logos.` },
|
|
202
|
-
{ needs: [], text: `Security: never place the API key in URLs, HTML, logs, screenshots or client-side code. Signed delivery URLs are the only thing that should ever reach a browser.` },
|
|
203
|
-
{ needs: [], text: `Batches: before expanding views or colors, look each distinct vehicle up once; check_vehicles takes a whole list (up to ${MAX_MCP_CHECK_VEHICLES} per call) and answers each as match, suggestion, miss or invalid. On a vehicle 404, skip that vehicle across every view and color until its input or the catalog changes; never automatically substitute a suggestion. Image validation errors expose parameter and retryable: false.` },
|
|
204
|
-
{ needs: [], text: `Limits: on a rate limit (HTTP 429) wait the number of seconds in retry_after before trying again; with code account_generation_cap, cached images keep serving and new renders resume at reset_at (midnight UTC). On HTTP 402 stop and hand the human the link in the response.` },
|
|
205
|
-
{ needs: ["purchase_plan", "pay_invoice", "checkout_status"], text: `Agent purchases: purchase_plan buys Pro or Business, and pay_invoice pays an open plan invoice (billing.renewal_due in get_account), with a Stripe Shared Payment Token (spt_…) from the agent platform, never a card number. They work only for a key the owner allowed (billing:purchase) and within the owner's monthly agent spending limit (billing.agent_spend in get_account); without one they refuse with checkout_url, which you hand the human. Call with dry_run: true first, tell the human the amount and card unless their mandate covers it, then repeat with the same purchase_id; a repeat never charges twice. A token pays once, so renewals need a card the owner saves or pay_invoice with a fresh token. Paying in the browser with an agent card or Link instead: create_checkout_link, then poll checkout_status with its session_id until complete.` },
|
|
206
|
-
{ needs: ["search_help", "get_pricing", "create_checkout_link", "get_billing_link"], text: `Product support: use search_help for source-linked answers, terms, licensing, privacy and Enterprise questions. Search each distinct question separately and cite sources; never invent missing context or account-specific promises. Do not send full customer emails, personal data or secrets. Queries are privately recorded to improve articles. Use get_pricing for live prices. When the human asks to purchase, create_checkout_link prepares a link without charging; get_billing_link opens settings. The human completes any payment or account change in the browser. Never claim a link means payment succeeded.` },
|
|
207
|
-
];
|
|
208
|
-
/** The server instructions for a toolset: the head every host shows, then the reference paragraphs whose tools the toolset has. */
|
|
193
|
+
/** The server instructions are concise so every host can show them in full. */
|
|
209
194
|
export function mcpInstructions(toolset = DEFAULT_MCP_TOOLSET) {
|
|
210
|
-
|
|
211
|
-
return [mcpInstructionsHead(toolset), ...paragraphs].join("\n\n");
|
|
195
|
+
return mcpInstructionsHead(toolset);
|
|
212
196
|
}
|
|
213
197
|
/** Instructions for the full toolset; kept for callers that predate toolsets. */
|
|
214
198
|
export const MCP_INSTRUCTIONS = mcpInstructions("all");
|
|
@@ -235,6 +219,15 @@ export const colorSchema = z
|
|
|
235
219
|
.max(24)
|
|
236
220
|
.refine(isColor, { message: `color must be one of ${COLORS.join(", ")}, a CSS color name such as navy, or a hex like #1a2b3c` })
|
|
237
221
|
.describe(`Paint color: one of the presets (${COLORS.join(", ")}), a CSS color name such as navy (grey is the gray preset) or a hex like #1a2b3c. Responses echo any paint but a preset as #rrggbb.`);
|
|
222
|
+
/**
|
|
223
|
+
* The market of sale, where a tool takes one. A plain two-letter string: the
|
|
224
|
+
* server reads it in any case, answers in upper case and refuses a code no
|
|
225
|
+
* country holds.
|
|
226
|
+
*/
|
|
227
|
+
export const marketSchema = z
|
|
228
|
+
.string()
|
|
229
|
+
.regex(MARKET_PATTERN, "market must be an ISO 3166-1 alpha-2 country code such as US, GB, DE, AU or JP")
|
|
230
|
+
.describe("Market of sale, an ISO 3166-1 alpha-2 country code such as US, GB, DE, AU or JP. Send it only when the human named a market or the vehicles are for one: some model years look different in different markets. Today every market gets the default appearance, and the answer's appearance says which was served. Omit it otherwise: the account's default market applies, if it set one. Never guess it from where the human is.");
|
|
238
231
|
/** A stable catalog vehicle id, as every catalog tool returns it. */
|
|
239
232
|
export const vehicleIdSchema = z
|
|
240
233
|
.string()
|
|
@@ -264,6 +257,7 @@ const checkEntrySchema = z.object({
|
|
|
264
257
|
model: z.string().max(120).optional().describe('Model as the list spells it, e.g. "MX-5 Miata". Send it as written: the check reads it by the image tools\' rules.'),
|
|
265
258
|
year: z.coerce.number().int().optional().describe("Model year, e.g. 2018."),
|
|
266
259
|
ref: z.coerce.string().max(200).optional().describe("Your id for the entry (a row, a SKU), echoed back with its answer."),
|
|
260
|
+
market: z.string().max(80).optional().describe("This entry's own market of sale (a two-letter country code), when it differs from the list's market. Any other value is ignored."),
|
|
267
261
|
});
|
|
268
262
|
export const imageInputSchema = z
|
|
269
263
|
.object({
|
|
@@ -316,6 +310,7 @@ export const imageInputSchema = z
|
|
|
316
310
|
.enum(REQUEST_FORMATS)
|
|
317
311
|
.default("png")
|
|
318
312
|
.describe("png keeps the transparent background (default); webp is smallest; jpg is flattened onto white; auto lets each viewer's Accept header choose webp or png, negotiated on every load of a signed URL. An inline image (get_car_image) is delivered as png for auto."),
|
|
313
|
+
market: marketSchema.optional(),
|
|
319
314
|
})
|
|
320
315
|
.refine(namesOneVehicle, ONE_VEHICLE);
|
|
321
316
|
/** Logos share image transforms, but never vehicle selectors, views or paint. */
|
|
@@ -375,6 +370,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
375
370
|
.max(365)
|
|
376
371
|
.optional()
|
|
377
372
|
.describe("How long a renewable URL keeps renewing, 1 to 365 days from creation (default 365). Only with renew: true."),
|
|
373
|
+
market: marketSchema.optional().describe("Market of sale for every image that names none of its own: a two-letter country code such as AU. Only when the human named a market; otherwise omit (the account's default applies, if set)."),
|
|
378
374
|
idempotency_key: z
|
|
379
375
|
.string()
|
|
380
376
|
.regex(IDEMPOTENCY_KEY_PATTERN, 'Use 1-255 characters of letters, digits, ".", "_", ":" or "-".')
|
|
@@ -394,6 +390,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
394
390
|
...vehicleFields,
|
|
395
391
|
view: z.enum(VIEWS).optional().describe("Check one camera view; omit to check all nine views."),
|
|
396
392
|
color: colorSchema.default("silver"),
|
|
393
|
+
market: marketSchema.optional(),
|
|
397
394
|
}).refine(namesOneVehicle, ONE_VEHICLE),
|
|
398
395
|
check_vehicles: z.object({
|
|
399
396
|
vehicles: z
|
|
@@ -404,7 +401,8 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
404
401
|
views: z
|
|
405
402
|
.boolean()
|
|
406
403
|
.optional()
|
|
407
|
-
.describe("true: each match also says which of its nine camera views are prepared now, as get_image_availability reports them (views.prepared 0-9 and views.missing). Free and read-only. Default false."),
|
|
404
|
+
.describe("true: each match also says which of its nine camera views are prepared now, as get_image_availability reports them (views.prepared 0-9 and views.missing), and which of the prepared ones are verified (views.verified). Free and read-only. Default false."),
|
|
405
|
+
market: marketSchema.optional().describe("Market of sale the list is for: a two-letter country code such as AU. Only when the human named a market or the list is for one; otherwise omit (the account's default applies, if set). An entry may name its own."),
|
|
408
406
|
}),
|
|
409
407
|
resolve_vehicle: z.object({
|
|
410
408
|
query: z
|
|
@@ -412,6 +410,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
412
410
|
.min(1)
|
|
413
411
|
.max(200)
|
|
414
412
|
.describe('What the human asked for, in words: year, make and model, plus the view and color when they named them, e.g. "red 2024 porsche 911 side view".'),
|
|
413
|
+
market: marketSchema.optional(),
|
|
415
414
|
}),
|
|
416
415
|
list_image_options: z.object({}),
|
|
417
416
|
get_account: z.object({}),
|
|
@@ -500,6 +499,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
500
499
|
model: z.string().min(1).max(80).describe('Model, e.g. "R1T".'),
|
|
501
500
|
year: z.coerce.number().int().min(1900).max(2035).optional().describe("Model year, if it matters. Omit to ask for the model in general."),
|
|
502
501
|
note: z.string().max(2000).optional().describe("Why it is needed, body style, trim; anything that helps prioritise."),
|
|
502
|
+
market: marketSchema.optional().describe("The market of sale the request is about, a two-letter country code such as AU, when the human named one."),
|
|
503
503
|
}),
|
|
504
504
|
request_feature: z.object({
|
|
505
505
|
title: z.string().min(1).max(140).describe('Short summary, e.g. "Interior views".'),
|
|
@@ -992,6 +992,8 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
992
992
|
views: z.array(z.looseObject({
|
|
993
993
|
view: z.enum(VIEWS),
|
|
994
994
|
cached: z.boolean(),
|
|
995
|
+
/** The stored image of this view is verified; false says only that it has not been verified yet. */
|
|
996
|
+
verified: z.boolean().optional(),
|
|
995
997
|
quality: z.enum(["standard", "enhanced", "premium"]).nullable(),
|
|
996
998
|
paint_generation: z.number().int().nullable(),
|
|
997
999
|
upgradable: z.boolean(),
|
|
@@ -1000,7 +1002,7 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
1000
1002
|
render_eta: z.looseObject({ typical_seconds: z.number(), slow_seconds: z.number(), samples: z.number().int() }).nullable(),
|
|
1001
1003
|
upgrade_eta: z.looseObject({ typical_seconds: z.number(), slow_seconds: z.number(), samples: z.number().int() }).nullable(),
|
|
1002
1004
|
})),
|
|
1003
|
-
summary: z.looseObject({ cached: z.number().int(), high_quality: z.number().int(), upgradable: z.number().int() }),
|
|
1005
|
+
summary: z.looseObject({ cached: z.number().int(), verified: z.number().int().optional(), high_quality: z.number().int(), upgradable: z.number().int() }),
|
|
1004
1006
|
latest_paint_generation: z.number().int(),
|
|
1005
1007
|
estimates: z.record(z.string(), z.looseObject({ typical_seconds: z.number(), slow_seconds: z.number(), samples: z.number().int() })),
|
|
1006
1008
|
}),
|
|
@@ -1018,6 +1020,8 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
1018
1020
|
distinct_vehicles: z.number().int(),
|
|
1019
1021
|
/** With views: distinct matched vehicles whose nine views are all prepared. */
|
|
1020
1022
|
views_complete: z.number().int().optional(),
|
|
1023
|
+
/** With views: distinct matched vehicles with a prepared view whose every prepared view is verified. */
|
|
1024
|
+
views_verified: z.number().int().optional(),
|
|
1021
1025
|
}),
|
|
1022
1026
|
results: z.array(z.looseObject({
|
|
1023
1027
|
/** Position in `vehicles`. */
|
|
@@ -1044,8 +1048,8 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
1044
1048
|
suggestions: z.array(vehicleSuggestionSchema).optional(),
|
|
1045
1049
|
search: z.string().optional(),
|
|
1046
1050
|
error: z.string().optional(),
|
|
1047
|
-
/** With views, for a match: how many of the nine views are prepared and which are
|
|
1048
|
-
views: z.looseObject({ prepared: z.number().int(), missing: z.array(z.string()) }).optional(),
|
|
1051
|
+
/** With views, for a match: how many of the nine views are prepared, which are missing and which prepared ones are verified. */
|
|
1052
|
+
views: z.looseObject({ prepared: z.number().int(), missing: z.array(z.string()), verified: z.array(z.string()).optional() }).optional(),
|
|
1049
1053
|
})),
|
|
1050
1054
|
}),
|
|
1051
1055
|
request_id: z.string(),
|
|
@@ -1290,16 +1294,43 @@ export function webhooksSummary(result) {
|
|
|
1290
1294
|
const receives = result.entitlement && result.entitlement.receives !== "all" ? " This plan receives webhook.test only; image, 3D and upgrade events need a paid plan." : "";
|
|
1291
1295
|
return `${count(result.data.length, "webhook endpoint")}, ${active} active.${receives} Endpoints are added, tested and deleted by a person on the dashboard or with an API key (REST, SDK or CLI); never claim you changed one.`;
|
|
1292
1296
|
}
|
|
1297
|
+
/** From this share of a Free month's vehicle images the summaries name the next plan (the server's lib/near-limit-offer.ts). */
|
|
1298
|
+
export const NEAR_LIMIT_SHARE = 0.8;
|
|
1293
1299
|
/** Below this balance the account summary tells the agent to ask before rendering more. */
|
|
1294
1300
|
export const LOW_BALANCE_CREDITS = 10;
|
|
1301
|
+
/**
|
|
1302
|
+
* The sentence an agent relays once a Free account has used 80% of its free
|
|
1303
|
+
* images, one allowance per account since 2026-11-11 (`vehicle_images.upgrade`
|
|
1304
|
+
* on image answers, `next_plan` on get_account): what
|
|
1305
|
+
* is left and the next plan's Checkout link, which only the human opens.
|
|
1306
|
+
*/
|
|
1307
|
+
export function nearLimitSentence(upgrade,
|
|
1308
|
+
/** False where the caller already said the allowance is used up. */
|
|
1309
|
+
sayState = true) {
|
|
1310
|
+
const left = !sayState
|
|
1311
|
+
? ""
|
|
1312
|
+
: upgrade.state === "reached"
|
|
1313
|
+
? " The free vehicle images are used up."
|
|
1314
|
+
: ` ${upgrade.remaining.toLocaleString("en-US")} free vehicle image${upgrade.remaining === 1 ? "" : "s"} left.`;
|
|
1315
|
+
const price = upgrade.next_plan.price.monthly === null ? "" : ` ($${upgrade.next_plan.price.monthly}/month)`;
|
|
1316
|
+
return `${left} Tell the human the ${upgrade.next_plan.name} plan${price} includes more: ${upgrade.next_plan.checkout_url} (they open it; never buy it for them).`;
|
|
1317
|
+
}
|
|
1295
1318
|
/** The one-line summary both servers put above an account: the balance in dollars, the plan, and a stop when it runs low. */
|
|
1296
1319
|
export function accountSummary(data) {
|
|
1297
|
-
|
|
1320
|
+
// Free counts one allowance per account (vehicle_images_total); paid plans count the month.
|
|
1321
|
+
const total = data.limits_usage?.vehicle_images_total ?? null;
|
|
1322
|
+
const images = total ?? data.limits_usage?.vehicle_images_this_month;
|
|
1298
1323
|
if (data.limits_usage?.meter === "vehicle_images" && images) {
|
|
1324
|
+
const period = total ? "free vehicle images used (per account, not per month)" : "vehicle images used this month";
|
|
1325
|
+
const kept = total ? "images already received still serve" : "images already received this month still serve";
|
|
1299
1326
|
const of = (usage) => `${usage.used.toLocaleString("en-US")} of ${usage.limit === null ? "unlimited" : usage.limit.toLocaleString("en-US")}`;
|
|
1300
1327
|
const full = (usage) => Boolean(usage && usage.limit !== null && usage.used >= usage.limit);
|
|
1301
|
-
const stop = full(images) ?
|
|
1302
|
-
|
|
1328
|
+
const stop = full(images) ? ` The allowance is used up: ${kept}; ask the human before asking for new ones.` : "";
|
|
1329
|
+
const next = data.next_plan;
|
|
1330
|
+
const near = data.plan?.name === "Free" && next?.checkout_url && images.limit !== null && images.used >= images.limit * NEAR_LIMIT_SHARE
|
|
1331
|
+
? nearLimitSentence({ state: full(images) ? "reached" : "near", remaining: Math.max(0, images.limit - images.used), next_plan: { name: next.name, price: next.price, checkout_url: next.checkout_url } }, !stop)
|
|
1332
|
+
: "";
|
|
1333
|
+
return `${data.plan ? `${data.plan.name} plan: ` : ""}${of(images)} ${period}; every image serves as often as needed in any size.${stop}${near}`;
|
|
1303
1334
|
}
|
|
1304
1335
|
const perDollar = data.pricing?.credits_per_dollar ?? CREDITS_PER_DOLLAR;
|
|
1305
1336
|
const perImage = data.pricing?.credits_per_image ?? CREDITS_PER_IMAGE;
|
|
@@ -1340,7 +1371,7 @@ export function searchSummary(query, count) {
|
|
|
1340
1371
|
export function imageAvailabilitySummary(data) {
|
|
1341
1372
|
const upgrade = (view) => !view.upgradable ? ""
|
|
1342
1373
|
: view.upgrade_reason === "paint_generation" ? ", upgradable (older paint generation)" : ", upgradable (below enhanced quality)";
|
|
1343
|
-
return "Free availability check; nothing rendered or queued. " + data.views.map((view) => `${view.view}: ${view.cached ? `prepared (cached), ${view.quality ?? "quality unknown"}${upgrade(view)}, serves quickly from storage` : `not prepared; first render ${view.render_eta ? `about ${view.render_eta.typical_seconds} seconds` : "time unavailable"}`}`).join("; ") + ".";
|
|
1374
|
+
return "Free availability check; nothing rendered or queued. " + data.views.map((view) => `${view.view}: ${view.cached ? `prepared (cached)${view.verified ? ", verified" : ""}, ${view.quality ?? "quality unknown"}${upgrade(view)}, serves quickly from storage` : `not prepared; first render ${view.render_eta ? `about ${view.render_eta.typical_seconds} seconds` : "time unavailable"}`}`).join("; ") + ".";
|
|
1344
1375
|
}
|
|
1345
1376
|
/**
|
|
1346
1377
|
* The one-line summary both servers put above a vehicle check: the counts, then what to do with each kind of answer.
|
|
@@ -1360,6 +1391,10 @@ export function checkSummary(summary, origin = DEFAULT_BASE_URL) {
|
|
|
1360
1391
|
summary.views_complete !== undefined && summary.match
|
|
1361
1392
|
? `${summary.views_complete} of ${summary.distinct_vehicles} have all nine views prepared; views.missing names the views of the others that are not prepared yet.`
|
|
1362
1393
|
: "",
|
|
1394
|
+
// Said only when there is something to say: a view that is not verified is never described as a problem.
|
|
1395
|
+
summary.views_verified && summary.match
|
|
1396
|
+
? `${plural(summary.views_verified, "vehicle has", "vehicles have")} every prepared view verified; views.verified names each match's verified views.`
|
|
1397
|
+
: "",
|
|
1363
1398
|
summary.suggestion ? "Each suggestion names other vehicles than the one listed: ask the human before using one." : "",
|
|
1364
1399
|
summary.miss
|
|
1365
1400
|
? `Skip each miss in every view and color; the human can request a missing vehicle at ${origin}/requests?ref=mcp and gets an email when it is added.`
|
|
@@ -1388,7 +1423,7 @@ export function imageUrlsSummary(result) {
|
|
|
1388
1423
|
const urls = `${count} signed URL${count === 1 ? "" : "s"}`;
|
|
1389
1424
|
const images = result.billing.vehicle_images;
|
|
1390
1425
|
const charged = images
|
|
1391
|
-
? `${images.used.toLocaleString("en-US")} of ${images.included === null ? "unlimited" : images.included.toLocaleString("en-US")} vehicle images used
|
|
1426
|
+
? `${images.used.toLocaleString("en-US")} of ${images.included === null ? "unlimited" : images.included.toLocaleString("en-US")} vehicle images used`
|
|
1392
1427
|
: `${result.billing.credits_charged} credit${result.billing.credits_charged === 1 ? "" : "s"}`;
|
|
1393
1428
|
const renewsUntil = result.data.find((item) => item.renews_until)?.renews_until ?? null;
|
|
1394
1429
|
const lifetime = `they expire at ${result.data[0]?.expires_at ?? "the stated time"}${renewsUntil ? ` and renew on load${images ? "" : ", one credit per window,"} until ${renewsUntil}` : ""}`;
|
|
@@ -1396,7 +1431,7 @@ export function imageUrlsSummary(result) {
|
|
|
1396
1431
|
return result.idempotent_replayed
|
|
1397
1432
|
? `Replayed the result stored for this idempotency_key: ${urls}, ${images ? charged : `charged ${charged} the first time and nothing now`}. ${display}`
|
|
1398
1433
|
: images
|
|
1399
|
-
? `Created ${urls}; ${charged}. Each image serves as often as needed
|
|
1434
|
+
? `Created ${urls}; ${charged}. Each image serves as often as needed.${images.upgrade ? nearLimitSentence(images.upgrade) : ""} ${display}`
|
|
1400
1435
|
: `Created ${urls}; charged ${charged}, ${result.billing.credits_remaining} remaining. ${display}`;
|
|
1401
1436
|
}
|
|
1402
1437
|
export const MCP_TOOLS = {
|
|
@@ -1493,7 +1528,7 @@ export const MCP_TOOLS = {
|
|
|
1493
1528
|
get_account: {
|
|
1494
1529
|
name: "get_account",
|
|
1495
1530
|
title: "Get account",
|
|
1496
|
-
description: `Free. Show the organization this connection acts for (data.organization, with the caller's role), usage this month (limits_usage: vehicle images used and included, keys, request rates) and the key's scopes. Every new account includes ${FREE_VEHICLE_IMAGES} free vehicle images
|
|
1531
|
+
description: `Free. Show the organization this connection acts for (data.organization, with the caller's role), usage this month (limits_usage: vehicle images used and included, keys, request rates) and the key's scopes. Every new account includes ${FREE_VEHICLE_IMAGES} free vehicle images, once per account (limits_usage.vehicle_images_total), and ${FREE_COURTESY_VEHICLE_IMAGES} more once they run out. Check this before large batches.`,
|
|
1497
1532
|
inputSchema: MCP_TOOL_SCHEMAS.get_account,
|
|
1498
1533
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_account,
|
|
1499
1534
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
@@ -1540,7 +1575,7 @@ export const MCP_TOOLS = {
|
|
|
1540
1575
|
get_image_availability: {
|
|
1541
1576
|
name: "get_image_availability",
|
|
1542
1577
|
title: "Check prepared images and quality",
|
|
1543
|
-
description: "Free, read-only check before generating an image. Look the vehicle up first and pass its vehicle id. Check one view or omit view for all nine; pass the requested paint as color. cached true means the view is prepared: it serves quickly from storage, without waiting for a new render. Returns each view's quality (standard, enhanced or premium; null when no stored image), its paint_generation against latest_paint_generation, upgrade state (upgradable with upgrade_reason paint_generation or quality: an upgrade redraws the view with the latest paint generation at enhanced quality and stores the new version), and render_eta for views not cached. It renders nothing, queues nothing and counts no image usage. This does not authorize a render or an upgrade. Unlike a public preview, this checks what an authenticated image request would serve, including the requested color.",
|
|
1578
|
+
description: "Free, read-only check before generating an image. Look the vehicle up first and pass its vehicle id. Check one view or omit view for all nine; pass the requested paint as color. cached true means the view is prepared: it serves quickly from storage, without waiting for a new render. verified true means the image served for that view was compared with the manufacturer's own material for that model year and matched; false says only that the view has not been verified yet, as most have not, never that it is wrong. Returns each view's quality (standard, enhanced or premium; null when no stored image), its paint_generation against latest_paint_generation, upgrade state (upgradable with upgrade_reason paint_generation or quality: an upgrade redraws the view with the latest paint generation at enhanced quality and stores the new version), and render_eta for views not cached. It renders nothing, queues nothing and counts no image usage. This does not authorize a render or an upgrade. Unlike a public preview, this checks what an authenticated image request would serve, including the requested color.",
|
|
1544
1579
|
inputSchema: MCP_TOOL_SCHEMAS.get_image_availability,
|
|
1545
1580
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_image_availability,
|
|
1546
1581
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
@@ -1548,7 +1583,7 @@ export const MCP_TOOLS = {
|
|
|
1548
1583
|
check_vehicles: {
|
|
1549
1584
|
name: "check_vehicles",
|
|
1550
1585
|
title: "Check which vehicles the catalog carries",
|
|
1551
|
-
description: `Free. Check a list of up to ${MAX_MCP_CHECK_VEHICLES} vehicles in one call before rendering any: which ones the catalog carries and under which vehicle id. Send each as the list spells it ({make, model, year}) or as a stored id ({vehicle}), with an optional ref that is echoed back. Each entry is read exactly as get_car_image would read it and answered as match (vehicle.id is the id to store and render by; vehicle.match is exact, or the looser rule that read the name), suggestion (not in the catalog as named; suggestions are real vehicles close to it, such as the same model in its nearest year, which is another car: ask the human before using one), miss (nothing close: skip it in every view and color) or invalid (error says what to fix). Use it for a catalog, a spreadsheet or any list of more than a few cars, instead of one lookup or one paid render per car; summary counts each status and the distinct vehicles a backfill would render. With views: true each match also carries views.prepared (0-9) and views.missing, which of its nine camera views are prepared now, and summary.views_complete counts the vehicles with all nine. A longer list is work for code: car-image check <file>, or client.checkVehicles, ${MAX_CHECK_VEHICLES.toLocaleString("en-US")} vehicles per request.`,
|
|
1586
|
+
description: `Free. Check a list of up to ${MAX_MCP_CHECK_VEHICLES} vehicles in one call before rendering any: which ones the catalog carries and under which vehicle id. Send each as the list spells it ({make, model, year}) or as a stored id ({vehicle}), with an optional ref that is echoed back. Each entry is read exactly as get_car_image would read it and answered as match (vehicle.id is the id to store and render by; vehicle.match is exact, or the looser rule that read the name), suggestion (not in the catalog as named; suggestions are real vehicles close to it, such as the same model in its nearest year, which is another car: ask the human before using one), miss (nothing close: skip it in every view and color) or invalid (error says what to fix). Use it for a catalog, a spreadsheet or any list of more than a few cars, instead of one lookup or one paid render per car; summary counts each status and the distinct vehicles a backfill would render. With views: true each match also carries views.prepared (0-9) and views.missing, which of its nine camera views are prepared now, and views.verified, the prepared views that are verified (a view not listed has not been verified yet, nothing more); summary.views_complete counts the vehicles with all nine prepared and summary.views_verified those whose every prepared view is verified. A longer list is work for code: car-image check <file>, or client.checkVehicles, ${MAX_CHECK_VEHICLES.toLocaleString("en-US")} vehicles per request.`,
|
|
1552
1587
|
inputSchema: MCP_TOOL_SCHEMAS.check_vehicles,
|
|
1553
1588
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.check_vehicles,
|
|
1554
1589
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
@@ -1575,7 +1610,7 @@ export const MCP_TOOLS = {
|
|
|
1575
1610
|
description: "Free. Publish one of the account's 3D requests so a web page can show it without an API key: data.public gains an id, key-free URLs for the web GLB, the USDZ and the poster (served from Car Image's CDN) and embed.html, a script tag plus a <car-3d> element to paste into any HTML. Works before the model is ready (the URLs are stable, the files follow). Pass unpublish: true to take it down again; the links stop working within the hour. Idempotent either way.",
|
|
1576
1611
|
inputSchema: MCP_TOOL_SCHEMAS.publish_3d_model,
|
|
1577
1612
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.publish_3d_model,
|
|
1578
|
-
annotations: { readOnlyHint: false, destructiveHint:
|
|
1613
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
1579
1614
|
},
|
|
1580
1615
|
list_requests: {
|
|
1581
1616
|
name: "list_requests",
|
|
@@ -1647,7 +1682,7 @@ export const MCP_TOOLS = {
|
|
|
1647
1682
|
description: "Free. Remove the human's vote from an item (idempotent); they stop following it unless they commented.",
|
|
1648
1683
|
inputSchema: MCP_TOOL_SCHEMAS.remove_feedback_vote,
|
|
1649
1684
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.remove_feedback_vote,
|
|
1650
|
-
annotations: { readOnlyHint: false, destructiveHint:
|
|
1685
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
1651
1686
|
},
|
|
1652
1687
|
comment_on_feedback: {
|
|
1653
1688
|
name: "comment_on_feedback",
|
|
@@ -1703,7 +1738,7 @@ export const MCP_TOOLS = {
|
|
|
1703
1738
|
description: "Free. Record what the human is building with the API. Private to the Car Image team (never shown publicly); re-sharing overwrites the previous answer. Only call it with the human's own words and consent.",
|
|
1704
1739
|
inputSchema: MCP_TOOL_SCHEMAS.share_building,
|
|
1705
1740
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.share_building,
|
|
1706
|
-
annotations: { readOnlyHint: false, destructiveHint:
|
|
1741
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
1707
1742
|
},
|
|
1708
1743
|
share_referral: {
|
|
1709
1744
|
name: "share_referral",
|
|
@@ -1711,7 +1746,7 @@ export const MCP_TOOLS = {
|
|
|
1711
1746
|
description: "Free. Record where the human first heard about Car Image API (one of a fixed list of sources, plus optional detail). Private to the Car Image team; re-sharing overwrites. Only call it with the human's consent.",
|
|
1712
1747
|
inputSchema: MCP_TOOL_SCHEMAS.share_referral,
|
|
1713
1748
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.share_referral,
|
|
1714
|
-
annotations: { readOnlyHint: false, destructiveHint:
|
|
1749
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
1715
1750
|
},
|
|
1716
1751
|
};
|
|
1717
1752
|
export const MCP_TOOL_LIST = Object.values(MCP_TOOLS);
|
|
@@ -1751,12 +1786,13 @@ export const API_REFERENCE = [
|
|
|
1751
1786
|
`trim (1 crops to the car's alpha bounds before sizing), padding (0-${MAX_PADDING_PERCENT} percent of the longer side: around the car with trim, around the stored frame without it)`,
|
|
1752
1787
|
"shadow (1 adds a soft ground shadow under the car, from its cut-out; same image, nothing extra)",
|
|
1753
1788
|
`format (${FORMATS.join("|")}|auto; default png; auto negotiates webp/png from Accept)`,
|
|
1789
|
+
"market (optional; the market of sale as an ISO 3166-1 alpha-2 code such as AU, any case; the account's default market when omitted; never part of what the image is: the same vehicle, color and view is one image and one counted vehicle image under any market)",
|
|
1754
1790
|
],
|
|
1755
|
-
returns: "image bytes; headers X-Credits-Charged (0 on a plan), X-Vehicle-Images-Used, X-Vehicle-Images-Included (a number or unlimited; X-Credits-Remaining instead on the legacy credit meter), X-Image-Source (cache|generated), X-Image-Width, X-Image-Height, ETag, X-Request-Id (Vary: Accept with format=auto). With Accept: application/json: {data:{url,expires_at,vehicle:{vehicle_id,make,model,year,view,color,…},width,height,format}, billing:{credits_charged:0, vehicle_images:{used,included}} (credit meter: {credits_charged,credits_remaining}), request_id}",
|
|
1791
|
+
returns: "image bytes; headers X-Credits-Charged (0 on a plan), X-Vehicle-Images-Used, X-Vehicle-Images-Included (a number or unlimited; X-Credits-Remaining instead on the legacy credit meter), X-Image-Source (cache|generated), X-Image-Width, X-Image-Height, X-Vehicle-Appearance (default, or default; market=AU: which appearance was served, the default one for every market today), ETag, X-Request-Id (Vary: Accept with format=auto). With Accept: application/json: {data:{url,expires_at,vehicle:{vehicle_id,make,model,year,view,color,…},width,height,format,appearance:{market,scope}}, billing:{credits_charged:0, vehicle_images:{used,included}} (credit meter: {credits_charged,credits_remaining}), request_id}",
|
|
1756
1792
|
errors: ["400 invalid params (also vehicle together with make/model/year)", "401 missing/invalid key", "402 plan_image_limit (used, included, requested, resets_at, pack_url, checkout_url; nothing charged; legacy credit meter: insufficient credits)", "404 vehicle not in catalog or unknown vehicle id", "429 rate limited (Retry-After)", "502 render failed (refunded)", "503 generation_at_capacity: new renders resume at reset_at (Retry-After; nothing charged)"],
|
|
1757
1793
|
notes: "On 402 stop: images already received this month keep serving; hand the human checkout_url (a higher plan) with the price, or pack_url (Image Packs); buy only when they ask or a spending mandate they set covers it. Respect Retry-After on 429.",
|
|
1758
|
-
sdk: "client.getImage({ make, model, year, view, color, size, width, height, aspectRatio, resolution, fit, background, framing, trim, padding, shadow, format }) / client.getImage({ vehicle: 'veh_…', color: '#1a2b3c' }) / client.getImageUrl(...)",
|
|
1759
|
-
cli: "car-image get --make Porsche --model 911 --year 2024 --view side --color red --out car.png · car-image get --vehicle veh_395yw8tn73ff8 --color 1a2b3c",
|
|
1794
|
+
sdk: "client.getImage({ make, model, year, view, color, size, width, height, aspectRatio, resolution, fit, background, framing, trim, padding, shadow, format, market }) / client.getImage({ vehicle: 'veh_…', color: '#1a2b3c' }) / client.getImageUrl(...)",
|
|
1795
|
+
cli: "car-image get --make Porsche --model 911 --year 2024 --view side --color red --out car.png · car-image get --vehicle veh_395yw8tn73ff8 --color 1a2b3c [--market AU]",
|
|
1760
1796
|
},
|
|
1761
1797
|
{
|
|
1762
1798
|
method: "POST",
|
|
@@ -1764,22 +1800,22 @@ export const API_REFERENCE = [
|
|
|
1764
1800
|
summary: "Create 1-50 signed delivery URLs for browsers (no key needed to load them).",
|
|
1765
1801
|
auth: "bearer",
|
|
1766
1802
|
credits: "0 on a plan: each URL counts its vehicle image for the month at creation; loads and renewals add nothing. Legacy credit meter: 1 per URL at creation, 1 per renewed window",
|
|
1767
|
-
params: ["images: [{make, model, year | vehicle, view?, color? (preset or hex), size?, width?, height?, fit?, background?, framing?, trim?, padding?, shadow?, format?}] (or a single image object)", "ttl_seconds (60-604800; default 3600)", "max_uses (0-1000; 0 = unlimited; default 0)", "renew (auto-renew past the TTL; requires max_uses 0)", "renew_days (1-365; default 365)", "header Idempotency-Key (optional; a retry with the same key and body replays the first response instead of billing again)"],
|
|
1768
|
-
returns: "201 {data:[{id,url,expires_at,max_uses,renews_until,vehicle:{vehicle_id,…}}], billing:{charged_on:'creation',credits_charged:0,vehicle_images:{used,included},renewal?} (credit meter: credits_charged,credits_remaining,credits_per_url), request_id}; a replay carries Idempotent-Replayed: true",
|
|
1803
|
+
params: ["images: [{make, model, year | vehicle, view?, color? (preset or hex), size?, width?, height?, fit?, background?, framing?, trim?, padding?, shadow?, format?, market?}] (or a single image object)", "market (optional; the market of sale for every image that names none: an ISO 3166-1 alpha-2 code; the account's default when omitted; not part of the URL or of what is counted)", "ttl_seconds (60-604800; default 3600)", "max_uses (0-1000; 0 = unlimited; default 0)", "renew (auto-renew past the TTL; requires max_uses 0)", "renew_days (1-365; default 365)", "header Idempotency-Key (optional; a retry with the same key and body replays the first response instead of billing again)"],
|
|
1804
|
+
returns: "201 {data:[{id,url,expires_at,max_uses,renews_until,vehicle:{vehicle_id,…},appearance:{market,scope}}], billing:{charged_on:'creation',credits_charged:0,vehicle_images:{used,included},renewal?} (credit meter: credits_charged,credits_remaining,credits_per_url), request_id}; a replay carries Idempotent-Replayed: true",
|
|
1769
1805
|
errors: ["400 invalid body or batch > 50", "401", "402 plan_image_limit (nothing counted)", "404 vehicle not in catalog", "409 same Idempotency-Key still in flight", "422 same Idempotency-Key with a different body", "429"],
|
|
1770
|
-
sdk: "client.createImageUrls([{ make, model, year, ...sizing }, { vehicle: 'veh_…' }], { ttlSeconds, maxUses, renew, renewDays, idempotencyKey })",
|
|
1771
|
-
cli: "car-image url --make BMW --model M3 --year 2022 --ttl 86400 [--renew] [--idempotency-key <key>]",
|
|
1806
|
+
sdk: "client.createImageUrls([{ make, model, year, ...sizing }, { vehicle: 'veh_…' }], { ttlSeconds, maxUses, renew, renewDays, idempotencyKey, market })",
|
|
1807
|
+
cli: "car-image url --make BMW --model M3 --year 2022 --ttl 86400 [--renew] [--idempotency-key <key>] [--market DE]",
|
|
1772
1808
|
},
|
|
1773
1809
|
{
|
|
1774
1810
|
method: "POST",
|
|
1775
1811
|
path: "/api/v1/images/availability",
|
|
1776
|
-
summary: "Check up to 200 images before asking for them: whether each vehicle view is prepared (every color of it serves now), whether it would count a vehicle image this month (a view not prepared yet counts as one like any other), and whether the list fits the plan. Read-only: renders, queues and counts nothing. GET with one vehicle's query lists its views, their quality and how long the rest take.",
|
|
1812
|
+
summary: "Check up to 200 images before asking for them: whether each vehicle view is prepared (every color of it serves now), whether it would count a vehicle image this month (a view not prepared yet counts as one like any other), and whether the list fits the plan. Each answer also says whether the prepared image is verified (compared with the manufacturer's own material for that model year, and matched; false says only that it has not been verified yet). Read-only: renders, queues and counts nothing. GET with one vehicle's query lists its views, whether each is prepared and verified, their quality and how long the rest take.",
|
|
1777
1813
|
auth: "bearer",
|
|
1778
1814
|
credits: "free",
|
|
1779
|
-
params: ["images: [{vehicle | make, model, year, view?, color?, …}] (1-200 image objects, as POST /api/v1/image-urls takes)"],
|
|
1780
|
-
returns: "200 {data:{object:'image_availability_check', images:[{index,prepared,counts_image,vehicle:{id,make,model,year},view,color}], summary:{items,prepared,not_prepared}, allowance:{period:{month_start}, vehicle_images:{used,included,would_add,fits}}|null}, request_id}",
|
|
1815
|
+
params: ["images: [{vehicle | make, model, year, view?, color?, market?, …}] (1-200 image objects, as POST /api/v1/image-urls takes)", "market (optional; the market of sale the list is for; GET takes it as a query parameter)"],
|
|
1816
|
+
returns: "200 {data:{object:'image_availability_check', images:[{index,prepared,verified,counts_image,vehicle:{id,make,model,year},view,color,appearance:{market,scope}}], summary:{items,prepared,not_prepared,verified}, allowance:{period:{month_start}, vehicle_images:{used,included,would_add,fits}}|null}, request_id}",
|
|
1781
1817
|
errors: ["400 invalid_body or invalid_params (index)", "401", "404 vehicle_not_found (index)"],
|
|
1782
|
-
sdk: "client.checkAvailability([{ vehicle: 'veh_…', view: 'front', color: 'red' }])",
|
|
1818
|
+
sdk: "client.checkAvailability([{ vehicle: 'veh_…', view: 'front', color: 'red' }], { market })",
|
|
1783
1819
|
},
|
|
1784
1820
|
{
|
|
1785
1821
|
method: "GET",
|
|
@@ -1806,10 +1842,10 @@ export const API_REFERENCE = [
|
|
|
1806
1842
|
summary: "Resolve free text to exact image parameters.",
|
|
1807
1843
|
auth: "bearer",
|
|
1808
1844
|
credits: "free",
|
|
1809
|
-
params: ['query: "red 2024 porsche 911 side view"'],
|
|
1810
|
-
returns: "{data:{params:{vehicle_id,make,model,year,view,color}, display:{make_name,model_name}, candidates:[...], confidence:high|medium|low, image_path}}",
|
|
1811
|
-
sdk: "client.resolve(query)",
|
|
1812
|
-
cli: "car-image resolve red 2024 porsche 911 side view",
|
|
1845
|
+
params: ['query: "red 2024 porsche 911 side view"', "market (optional; the market of sale as an ISO 3166-1 alpha-2 code; the account's default when omitted)"],
|
|
1846
|
+
returns: "{data:{params:{vehicle_id,make,model,year,view,color}, display:{make_name,model_name}, candidates:[...], confidence:high|medium|low, image_path, appearance:{market,scope}}}",
|
|
1847
|
+
sdk: "client.resolve(query, { market })",
|
|
1848
|
+
cli: "car-image resolve red 2024 porsche 911 side view [--market AU]",
|
|
1813
1849
|
},
|
|
1814
1850
|
{
|
|
1815
1851
|
method: "GET",
|
|
@@ -1842,13 +1878,14 @@ export const API_REFERENCE = [
|
|
|
1842
1878
|
credits: "free (10 checks a minute per account)",
|
|
1843
1879
|
params: [
|
|
1844
1880
|
`vehicles: 1-${MAX_CHECK_VEHICLES.toLocaleString("en-US")} entries, each {make, model, year} as your data spells them or {vehicle} (a stored id), plus an optional ref (string or number) echoed back; other fields are ignored`,
|
|
1845
|
-
`views: optional boolean; true adds each match's views (prepared 0-9, missing view names) and summary.views_complete, at most ${MAX_CHECK_VIEWS_VEHICLES} entries`,
|
|
1881
|
+
`views: optional boolean; true adds each match's views (prepared 0-9, missing view names, verified view names) and summary.views_complete and views_verified, at most ${MAX_CHECK_VIEWS_VEHICLES} entries`,
|
|
1882
|
+
"market: optional; the market of sale the list is for (an ISO 3166-1 alpha-2 code; the account's default when omitted); an entry may carry its own market",
|
|
1846
1883
|
],
|
|
1847
|
-
returns: "{data:{summary:{total,match,suggestion,miss,invalid,distinct_vehicles,views_complete?}, results:[{index, ref?, status:match|suggestion|miss|invalid, vehicle:{id,make,make_name,model,model_name,year,match,image_path}|null, reason?:make|model|year|vehicle, suggestions?:[{make,make_name,model,model_name,year,id,image_path}], search?, error?, views?:{prepared,missing}}]}, request_id}",
|
|
1884
|
+
returns: "{data:{appearance:{market,scope}, summary:{total,match,suggestion,miss,invalid,distinct_vehicles,views_complete?,views_verified?}, results:[{index, ref?, status:match|suggestion|miss|invalid, vehicle:{id,make,make_name,model,model_name,year,match,image_path}|null, reason?:make|model|year|vehicle, suggestions?:[{make,make_name,model,model_name,year,id,image_path}], search?, error?, views?:{prepared,missing,verified}}]}, request_id}",
|
|
1848
1885
|
errors: [`400 not a list of vehicles, or more than ${MAX_CHECK_VEHICLES.toLocaleString("en-US")} entries (${MAX_CHECK_VIEWS_VEHICLES} with views)`, "401", "413 body over 1 MiB", "429 more than 10 checks a minute (Retry-After)"],
|
|
1849
1886
|
notes: "Store each match's vehicle.id and render by vehicle=<id> in every view and color. A suggestion is another vehicle (the same model in its nearest year, a related model): never substitute it silently. Skip a miss in every view and color, and check misses again after catalog releases. A bad entry is answered as invalid on its own; it never fails the list.",
|
|
1850
|
-
sdk: "client.checkVehicles([{ make, model, year, ref }, { vehicle }], { views, batchSize, onProgress }) (splits any length)",
|
|
1851
|
-
cli: "car-image check vehicles.csv [--views] --out checked.csv",
|
|
1887
|
+
sdk: "client.checkVehicles([{ make, model, year, ref }, { vehicle }], { views, market, batchSize, onProgress }) (splits any length)",
|
|
1888
|
+
cli: "car-image check vehicles.csv [--views] [--market AU] --out checked.csv",
|
|
1852
1889
|
},
|
|
1853
1890
|
{
|
|
1854
1891
|
method: "GET",
|
|
@@ -1938,7 +1975,7 @@ export const API_REFERENCE = [
|
|
|
1938
1975
|
summary: "Plan and renewal (plan.meter: vehicle_images, or credits for accounts that paid before 2026-10-25), this month's vehicle images against the plan, credits (for 3D models, logos and upgrades), the next plan with its checkout link, payment method, 30-day usage, key scopes.",
|
|
1939
1976
|
auth: "bearer",
|
|
1940
1977
|
credits: "free",
|
|
1941
|
-
returns: "{data:{credits, auto_reload, has_payment_method, plan:{…, meter, limits:{images_per_month,…}}, pricing, usage_30d:{requests,images,cache_hit_rate}, limits_usage:{period, meter, vehicle_images_this_month:{used,limit,remaining}|null, distinct_vehicles_this_month:{used,limit,remaining}|null (credit meter), api_keys:{used,limit,remaining}, requests_per_minute_per_key, requests_per_minute_per_account}, renews_at, next_plan:{id,name,price,adds,checkout_url}, key:{prefix,scopes}}, links, request_id}",
|
|
1978
|
+
returns: "{data:{credits, auto_reload, has_payment_method, plan:{…, meter, limits:{images_per_month,…}}, default_market (the account's default market of sale, or null; set on the dashboard's organization page), pricing, usage_30d:{requests,images,cache_hit_rate}, limits_usage:{period, meter, vehicle_images_this_month:{used,limit,remaining}|null, distinct_vehicles_this_month:{used,limit,remaining}|null (credit meter), api_keys:{used,limit,remaining}, requests_per_minute_per_key, requests_per_minute_per_account}, renews_at, next_plan:{id,name,price,adds,checkout_url}, key:{prefix,scopes}}, links, request_id}",
|
|
1942
1979
|
sdk: "client.account()",
|
|
1943
1980
|
cli: "car-image whoami (alias: account)",
|
|
1944
1981
|
},
|
|
@@ -2012,7 +2049,7 @@ export function formatApiReference(filter) {
|
|
|
2012
2049
|
const header = [
|
|
2013
2050
|
`Car Image API — base URL ${DEFAULT_BASE_URL}`,
|
|
2014
2051
|
`Auth: Authorization: Bearer cimg_… (never in URLs). Errors: application/problem+json {type,title,status,detail,request_id}.`,
|
|
2015
|
-
`Pricing: plans meter vehicle images (one vehicle in one color from one angle, counted once a UTC month, delivered as often as needed at any size, stored or prepared first); images cost no credits. Free: ${PLAN_ALLOWANCES.free.vehicleImages} vehicle images
|
|
2052
|
+
`Pricing: plans meter vehicle images (one vehicle in one color from one angle, counted once a UTC month, delivered as often as needed at any size, stored or prepared first); images cost no credits. Free: ${PLAN_ALLOWANCES.free.vehicleImages} vehicle images per account, not per month (${PLAN_ALLOWANCES.free.courtesyImages} more once they run out), ${FREE_CREDITS} credits once, evaluation and personal projects. Pro $${PLAN_ALLOWANCES.pro.monthlyUsd}/month: ${PLAN_ALLOWANCES.pro.vehicleImages.toLocaleString("en-US")} images, ${PLAN_ALLOWANCES.pro.creditsPerMonth.toLocaleString("en-US")} credits a month, commercial license while subscribed. Business $${PLAN_ALLOWANCES.business.monthlyUsd}/month: ${PLAN_ALLOWANCES.business.vehicleImages.toLocaleString("en-US")} images, ${PLAN_ALLOWANCES.business.creditsPerMonth.toLocaleString("en-US")} credits. No overage: past an allowance new images answer 402 until the 1st (UTC); Free's do not renew. Credits are not sold and pay for 3D models (${MODEL_3D_PRICE}), make logos (1) and upgrades (20). Image Packs are one-time and self-hosted for good. GET /api/v1/pricing has live prices.`,
|
|
2016
2053
|
`Vehicles: make + model + year, or vehicle=<stable id such as veh_395yw8tn73ff8> (from /api/v1/vehicles, /api/v1/vin or resolve), never both. Colors: ${COLORS.length} presets or any hex paint (URLs: color=1a2b3c bare; JSON: "#1a2b3c" or "1a2b3c"; responses echo #1a2b3c).`,
|
|
2017
2054
|
"",
|
|
2018
2055
|
];
|
|
@@ -2062,7 +2099,7 @@ export function nextStepFor(status) {
|
|
|
2062
2099
|
case 401:
|
|
2063
2100
|
return "The API key is missing or invalid. Set CAR_IMAGE_API_KEY (or run `car-image login`); never paste keys into prompts.";
|
|
2064
2101
|
case 402:
|
|
2065
|
-
return `Payment required; nothing was charged. Stop. With code plan_image_limit the
|
|
2102
|
+
return `Payment required; nothing was charged. Stop. With code plan_image_limit the allowance is used (images already received keep serving; it resets at resets_at, or never on Free when resets_at is null): give the human checkout_url (a higher plan) with its price, or pack_url (Image Packs). With code subscription_required_for_credits the account lacks credits for a 3D model, logo or upgrade; credits are not sold, so give checkout_url (a plan, which includes credits every month). Buy only when the human asks or a spending mandate they set covers it.`;
|
|
2066
2103
|
case 403:
|
|
2067
2104
|
return "This key lacks the required scope. Ask the human to create a key with the right scopes in the dashboard.";
|
|
2068
2105
|
case 404:
|