@meterapp/car-image-sdk 1.4.0 → 1.5.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/dist/mcp/index.js CHANGED
@@ -10,8 +10,11 @@
10
10
  * entry point of the SDK has no runtime dependencies.
11
11
  */
12
12
  import * as z from "zod";
13
- import { CATALOG, COLORS, CREDITS_PER_DOLLAR, CREDITS_PER_IMAGE, DEFAULT_BASE_URL, FITS, FORMATS, FREE_CREDITS, IDEMPOTENCY_KEY_PATTERN, MAX_DIMENSION, MAX_PADDING_PERCENT, MIN_YEAR, REFERRAL_SOURCES, REQUEST_FORMATS, REQUEST_KINDS, REQUEST_SORTS, REQUEST_STATUSES, SIZES, VIEWS, } from "../types.js";
13
+ import { isColor } from "../params.js";
14
+ import { CATALOG, COLORS, CREDITS_PER_3D_MODEL, CREDITS_PER_DOLLAR, CREDITS_PER_IMAGE, DEFAULT_BASE_URL, FITS, FORMATS, FREE_CREDITS, IDEMPOTENCY_KEY_PATTERN, MAX_DIMENSION, 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";
14
15
  import { SDK_VERSION } from "../version.js";
16
+ /** The 3D price as agents read it: "1,000 credits ($1.00)". */
17
+ const MODEL_3D_PRICE = `${CREDITS_PER_3D_MODEL.toLocaleString("en-US")} credits ($${(CREDITS_PER_3D_MODEL / CREDITS_PER_DOLLAR).toFixed(2)})`;
15
18
  /**
16
19
  * Catalog size as agents read it in the instructions and tool descriptions.
17
20
  * Derived from CATALOG so the figures cannot drift from the database; agents
@@ -39,9 +42,12 @@ export const MCP_TOOLSETS = {
39
42
  "create_car_image_urls",
40
43
  "search_vehicles",
41
44
  "resolve_vehicle",
45
+ "decode_vin",
42
46
  "list_image_options",
43
47
  "get_account",
44
48
  "rate_image",
49
+ "create_3d_model",
50
+ "get_3d_model",
45
51
  "describe_api",
46
52
  ],
47
53
  all: [
@@ -49,9 +55,12 @@ export const MCP_TOOLSETS = {
49
55
  "create_car_image_urls",
50
56
  "search_vehicles",
51
57
  "resolve_vehicle",
58
+ "decode_vin",
52
59
  "list_image_options",
53
60
  "get_account",
54
61
  "rate_image",
62
+ "create_3d_model",
63
+ "get_3d_model",
55
64
  "describe_api",
56
65
  "list_requests",
57
66
  "request_vehicle",
@@ -68,11 +77,11 @@ export const MCP_TOOLSET_NAMES = Object.keys(MCP_TOOLSETS);
68
77
  export function isMcpToolset(value) {
69
78
  return typeof value === "string" && MCP_TOOLSET_NAMES.includes(value);
70
79
  }
71
- const INSTRUCTIONS_COMMON = `Car Image API by Meter: studio-quality, transparent-background renders of any vehicle in the open @meterapp/vehicle-db catalog (${CATALOG_MAKES} makes, ${CATALOG_MODELS} models, model years ${CATALOG_YEARS}). Six camera views, fifteen preset colors, PNG/WebP/JPG up to 1024 px, any width and height (fit contain|cover|inside), transparent or a solid background color.
80
+ const INSTRUCTIONS_COMMON = `Car Image API by Meter: studio-quality, transparent-background renders of any vehicle in the open @meterapp/vehicle-db catalog (${CATALOG_MAKES} makes, ${CATALOG_MODELS} models, model years ${CATALOG_YEARS}). Six camera views, 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 and decode_vin return and every image or 3D tool accepts as \`vehicle\` in place of make, model and year.
72
81
 
73
- Costs: every delivered image costs exactly ${CREDITS_PER_IMAGE} credit ($1 = ${CREDITS_PER_DOLLAR.toLocaleString("en-US")} credits; ${FREE_CREDITS} free credits per account), cold or CDN hit. create_car_image_urls charges 1 credit per URL when the URL is created; redemptions are free. search_vehicles, resolve_vehicle, list_image_options, get_account, rate_image and describe_api are free.
82
+ Costs: every delivered image costs exactly ${CREDITS_PER_IMAGE} credit ($1 = ${CREDITS_PER_DOLLAR.toLocaleString("en-US")} credits; ${FREE_CREDITS} free credits per account), cold or CDN hit. create_car_image_urls charges 1 credit per URL when the URL is created; redemptions are free. create_3d_model costs ${MODEL_3D_PRICE} per model, charged when the request is made: confirm with the human before calling it. search_vehicles, resolve_vehicle, decode_vin, list_image_options, get_account, rate_image, get_3d_model and describe_api are free.
74
83
 
75
- Workflow: (1) resolve_vehicle turns free text such as "red 2024 porsche 911 side view" into exact parameters; search_vehicles browses the catalog. (2) Call get_car_image when the image itself is needed in the conversation. (3) For web pages, emails, documents or anything a browser will load, call create_car_image_urls and embed the signed URLs; they need no key.
84
+ Workflow: (1) resolve_vehicle turns free text such as "red 2024 porsche 911 side view" into exact parameters; search_vehicles browses the catalog; decode_vin turns a VIN into the catalog vehicle and its id. (2) Call get_car_image when the image itself is needed in the conversation. (3) For web pages, emails, documents or anything a browser will load, call create_car_image_urls and embed the signed URLs; they need no key. (4) 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; a model takes one to five minutes.
76
85
 
77
86
  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.
78
87
 
@@ -92,16 +101,38 @@ const yearSchema = z.coerce
92
101
  .int()
93
102
  .min(MIN_YEAR)
94
103
  .max(2100)
95
- .describe(`Model year, e.g. 2024. The catalog covers ${MIN_YEAR} through next year.`);
96
- export const imageInputSchema = z.object({
97
- make: z.string().min(1).max(80).describe('Manufacturer, e.g. "Porsche", "BMW", "Toyota". Case and punctuation do not matter.'),
98
- model: z.string().min(1).max(80).describe('Model as listed in the catalog, e.g. "911", "M3", "Corolla".'),
99
- year: yearSchema,
104
+ .describe(`Model year, e.g. 2024. The catalog covers ${MIN_YEAR} through next year. Omit when vehicle is given.`);
105
+ /** A paint color: a preset name, or a hex such as `#1a2b3c` (`1a2b3c` and `#rgb` are accepted too). */
106
+ export const colorSchema = z
107
+ .string()
108
+ .min(1)
109
+ .max(20)
110
+ .refine(isColor, { message: `color must be one of ${COLORS.join(", ")}, or a hex like #1a2b3c` })
111
+ .describe(`Paint color: one of the presets (${COLORS.join(", ")}) or a hex like #1a2b3c. Responses echo a hex as #rrggbb.`);
112
+ /** A stable catalog vehicle id, as every catalog tool returns it. */
113
+ export const vehicleIdSchema = z
114
+ .string()
115
+ .regex(VEHICLE_ID_PATTERN, "vehicle must be a vehicle id: veh_ followed by 13 characters")
116
+ .describe("Stable vehicle id such as veh_395yw8tn73ff8 (from search_vehicles, resolve_vehicle or decode_vin). Names the make, model and year, so omit those when it is given.");
117
+ const vehicleFields = {
118
+ vehicle: vehicleIdSchema.optional(),
119
+ make: z.string().min(1).max(80).optional().describe('Manufacturer, e.g. "Porsche", "BMW", "Toyota". Case and punctuation do not matter. Omit when vehicle is given.'),
120
+ model: z.string().min(1).max(80).optional().describe('Model as listed in the catalog, e.g. "911", "M3", "Corolla". Omit when vehicle is given.'),
121
+ year: yearSchema.optional(),
122
+ };
123
+ /** Either the vehicle id or all three of make, model and year; the server rejects both together. */
124
+ function namesOneVehicle(input) {
125
+ return input.vehicle !== undefined || (input.make !== undefined && input.model !== undefined && input.year !== undefined);
126
+ }
127
+ const ONE_VEHICLE = { message: "Give either vehicle (a veh_… id) or all of make, model and year" };
128
+ export const imageInputSchema = z
129
+ .object({
130
+ ...vehicleFields,
100
131
  view: z
101
132
  .enum(VIEWS)
102
133
  .default("front-3-4")
103
134
  .describe("Camera angle: front (0°), front-3-4 (35°, the classic hero angle), side (profile, nose left), side-right (profile, nose right), rear (180°), rear-3-4 (145°)."),
104
- color: z.enum(COLORS).default("silver").describe("Paint color; one of the fifteen presets."),
135
+ color: colorSchema.default("silver"),
105
136
  size: z
106
137
  .enum(["thumb", "small", "medium", "large"])
107
138
  .optional()
@@ -129,7 +160,8 @@ export const imageInputSchema = z.object({
129
160
  .enum(REQUEST_FORMATS)
130
161
  .default("png")
131
162
  .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."),
132
- });
163
+ })
164
+ .refine(namesOneVehicle, ONE_VEHICLE);
133
165
  /**
134
166
  * The encoding an inline image (`get_car_image`) is delivered in. `auto` is
135
167
  * negotiated from an HTTP `Accept` header, which a tool call does not carry,
@@ -204,11 +236,12 @@ export const MCP_TOOL_SCHEMAS = {
204
236
  .max(128)
205
237
  .optional()
206
238
  .describe("The request_id returned by get_car_image or create_car_image_urls (preferred way to identify the image)."),
207
- make: z.string().min(1).max(80).optional().describe("Alternative to request_id: identify the image by vehicle."),
239
+ vehicle: vehicleIdSchema.optional(),
240
+ make: z.string().min(1).max(80).optional().describe("Alternative to request_id: identify the image by vehicle (make, model, year, or a vehicle id)."),
208
241
  model: z.string().min(1).max(80).optional(),
209
242
  year: z.coerce.number().int().min(MIN_YEAR).max(2100).optional(),
210
243
  view: z.enum(VIEWS).optional(),
211
- color: z.enum(COLORS).optional(),
244
+ color: colorSchema.optional(),
212
245
  rating: z.number().int().min(1).max(5).optional().describe("1 (unusable) to 5 (perfect)."),
213
246
  verdict: z.enum(["good", "bad"]).optional().describe("Quick thumbs up/down; provide this or rating."),
214
247
  reason: z.string().max(500).optional().describe("What was wrong or right, e.g. 'wrong body style', 'perfect angle'."),
@@ -218,7 +251,36 @@ export const MCP_TOOL_SCHEMAS = {
218
251
  .string()
219
252
  .max(120)
220
253
  .optional()
221
- .describe('Filter by path fragment or keyword, e.g. "images/car", "image-urls", "feedback". Omit for the full compact reference.'),
254
+ .describe('Filter by path fragment or keyword, e.g. "images/car", "image-urls", "vin", "3d". Omit for the full compact reference.'),
255
+ }),
256
+ decode_vin: z.object({
257
+ vin: z
258
+ .string()
259
+ .min(5)
260
+ .max(40)
261
+ .describe("A full 17-character VIN, or a partial VIN of at least 5 characters with * for each unknown position. Case, spaces and dashes do not matter."),
262
+ year: z.coerce.number().int().min(1900).max(2100).optional().describe("Model-year hint for the decoder; it flags a mismatch with the VIN's own year position."),
263
+ }),
264
+ create_3d_model: z
265
+ .object({
266
+ ...vehicleFields,
267
+ color: colorSchema.default("silver"),
268
+ webhook_url: z
269
+ .string()
270
+ .url()
271
+ .max(2048)
272
+ .optional()
273
+ .describe("Public https URL that receives one POST {event: '3d_model.ready' | '3d_model.failed', data, sent_at} when the model settles; retried with backoff up to five times."),
274
+ webhook_secret: z.string().min(1).max(256).optional().describe("With webhook_url: the POST body is signed as X-CarImage-Signature: sha256=<hex HMAC of the raw body>."),
275
+ idempotency_key: z
276
+ .string()
277
+ .regex(/^[A-Za-z0-9._:-]{1,255}$/, "idempotency_key must be 1-255 characters of letters, digits, '.', '_', ':' or '-'")
278
+ .optional()
279
+ .describe("A retry with the same key replays the first answer instead of charging again (24 h); use it when a call may be repeated."),
280
+ })
281
+ .refine(namesOneVehicle, ONE_VEHICLE),
282
+ get_3d_model: z.object({
283
+ id: z.string().uuid().describe("The 3D request id returned by create_3d_model."),
222
284
  }),
223
285
  list_requests: z.object({
224
286
  kind: z.enum(REQUEST_KINDS).optional().describe("Only vehicle requests or only feature requests. Omit for both."),
@@ -281,11 +343,14 @@ export const MCP_TOOL_SCHEMAS = {
281
343
  */
282
344
  /** The vehicle echoed back with an image: exactly what would render it again. */
283
345
  const vehicleDescriptorSchema = z.looseObject({
346
+ /** Stable id of the catalog vehicle; null when the catalog cannot name one. */
347
+ vehicle_id: z.string().nullable(),
284
348
  make: z.string(),
285
349
  model: z.string(),
286
350
  year: z.number().int(),
287
351
  view: z.enum(VIEWS),
288
- color: z.enum(COLORS),
352
+ /** A preset name, or a hex paint as #rrggbb. */
353
+ color: z.string(),
289
354
  width: z.number().int().optional(),
290
355
  height: z.number().int().optional(),
291
356
  fit: z.enum(FITS).optional(),
@@ -355,6 +420,82 @@ const createdRequestResult = z.looseObject({
355
420
  deduplicated: z.boolean(),
356
421
  request_id: z.string(),
357
422
  });
423
+ /** The response of GET /api/v1/vin/{vin}: every key present, unknown values null. */
424
+ const vinResultSchema = z.looseObject({
425
+ vin: z.string(),
426
+ valid: z.boolean(),
427
+ errors: z.array(z.looseObject({ code: z.number().int(), text: z.string() })),
428
+ suggested_vin: z.string().nullable(),
429
+ year: z.number().int().nullable(),
430
+ make: z.string().nullable(),
431
+ model: z.string().nullable(),
432
+ trim: z.string().nullable(),
433
+ series: z.string().nullable(),
434
+ body_class: z.string().nullable(),
435
+ vehicle_type: z.string().nullable(),
436
+ doors: z.number().int().nullable(),
437
+ drive_type: z.string().nullable(),
438
+ fuel_type: z.string().nullable(),
439
+ engine: z.looseObject({
440
+ cylinders: z.number().int().nullable(),
441
+ displacement_l: z.number().nullable(),
442
+ hp: z.number().nullable(),
443
+ model: z.string().nullable(),
444
+ }),
445
+ transmission: z.looseObject({ style: z.string().nullable(), speeds: z.number().int().nullable() }),
446
+ manufacturer: z.string().nullable(),
447
+ plant: z.looseObject({ city: z.string().nullable(), state: z.string().nullable(), country: z.string().nullable() }),
448
+ gvwr: z.string().nullable(),
449
+ /** Every decoded vPIC variable verbatim. */
450
+ attributes: z.record(z.string(), z.string()),
451
+ /** The catalog vehicle the VIN maps to, with the id and path that render it; null when the catalog lacks it. */
452
+ vehicle: z.looseObject({ id: z.string(), make: z.string(), model: z.string(), year: z.number().int(), image_path: z.string() }).nullable(),
453
+ source: z.enum(["vpic-db", "vpic-api"]),
454
+ });
455
+ const model3dFileSchema = z.looseObject({
456
+ /** API URL that redirects to a short-lived signed download; needs the key. */
457
+ url: z.string(),
458
+ bytes: z.number().int(),
459
+ content_type: z.string(),
460
+ });
461
+ /** A 3D request as POST /api/v1/3d and GET /api/v1/3d/{id} return it. */
462
+ const model3dSchema = z.looseObject({
463
+ id: z.string(),
464
+ object: z.literal("3d_model"),
465
+ status: z.enum(["queued", "processing", "ready", "failed"]),
466
+ /** 0-100. */
467
+ progress: z.number(),
468
+ stage: z.string().nullable(),
469
+ vehicle: z.looseObject({ id: z.string().nullable(), make: z.string(), model: z.string(), year: z.number().int() }),
470
+ /** A preset name, or a hex paint as #rrggbb. */
471
+ color: z.string(),
472
+ generator: z.string(),
473
+ /** Present once status is ready. */
474
+ files: z
475
+ .looseObject({
476
+ glb: model3dFileSchema.optional(),
477
+ usdz: model3dFileSchema.optional(),
478
+ fbx: model3dFileSchema.optional(),
479
+ thumbnail: model3dFileSchema.optional(),
480
+ })
481
+ .nullable(),
482
+ polycount: z.number().int().nullable(),
483
+ /** Set when status is failed; the request was refunded. */
484
+ error: z.looseObject({ code: z.string(), message: z.string() }).nullable(),
485
+ estimated_seconds_remaining: z.number().nullable(),
486
+ webhook: z
487
+ .looseObject({
488
+ url: z.string(),
489
+ status: z.string().nullable(),
490
+ attempts: z.number().int(),
491
+ last_status: z.number().int().nullable(),
492
+ delivered_at: z.string().nullable(),
493
+ })
494
+ .nullable(),
495
+ created_at: z.string(),
496
+ updated_at: z.string(),
497
+ ready_at: z.string().nullable(),
498
+ });
358
499
  export const MCP_TOOL_OUTPUT_SCHEMAS = {
359
500
  get_car_image: z.looseObject({
360
501
  credits_charged: z.number().nullable(),
@@ -396,11 +537,13 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
396
537
  data: z.looseObject({
397
538
  /** Ready to pass straight to get_car_image. */
398
539
  params: z.looseObject({
540
+ /** Stable id of the resolved vehicle; pass it as `vehicle` to render it again. */
541
+ vehicle_id: z.string().nullable(),
399
542
  make: z.string(),
400
543
  model: z.string(),
401
544
  year: z.number().int(),
402
545
  view: z.enum(VIEWS),
403
- color: z.enum(COLORS),
546
+ color: z.string(),
404
547
  }),
405
548
  display: z.looseObject({ make_name: z.string(), model_name: z.string() }).optional(),
406
549
  /** Other catalog vehicles that fit the phrase; ask when confidence is low. */
@@ -465,6 +608,17 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
465
608
  }),
466
609
  request_id: z.string(),
467
610
  }),
611
+ decode_vin: z.looseObject({ data: vinResultSchema, request_id: z.string() }),
612
+ create_3d_model: z.looseObject({
613
+ data: model3dSchema,
614
+ billing: z.looseObject({
615
+ charged_on: z.literal("creation"),
616
+ credits_charged: z.number(),
617
+ credits_remaining: z.number(),
618
+ }),
619
+ request_id: z.string(),
620
+ }),
621
+ get_3d_model: z.looseObject({ data: model3dSchema, request_id: z.string() }),
468
622
  list_requests: requestListResult,
469
623
  request_vehicle: createdRequestResult,
470
624
  request_feature: createdRequestResult,
@@ -526,11 +680,37 @@ export function toImageOptions(data) {
526
680
  },
527
681
  };
528
682
  }
683
+ /** The one-line summary both servers put above a decoded VIN. */
684
+ export function vinSummary(result) {
685
+ const car = [result.year ?? "?", result.make ?? "unknown make", result.model ?? "", result.trim ?? ""].filter(Boolean).join(" ");
686
+ const notes = result.errors.length ? ` Decoder notes: ${result.errors.map((error) => error.text).join("; ")}.` : "";
687
+ if (result.vehicle) {
688
+ return `${result.vin}: ${car}. Catalog vehicle ${result.vehicle.id} (${result.vehicle.year} ${result.vehicle.make} ${result.vehicle.model}): pass it as vehicle to get_car_image, create_car_image_urls or create_3d_model.${notes}`;
689
+ }
690
+ return `${result.vin}: ${car}. Not in the image catalog; search_vehicles may find the model under another spelling.${notes}`;
691
+ }
692
+ /** The one-line summary both servers put above a 3D model, with the charge when it was just created. */
693
+ export function model3dSummary(model, billing) {
694
+ const car = `${model.vehicle.year} ${model.vehicle.make} ${model.vehicle.model} in ${model.color}`;
695
+ const charge = billing ? `Charged ${billing.credits_charged.toLocaleString("en-US")} credits, ${billing.credits_remaining.toLocaleString("en-US")} remaining. ` : "";
696
+ if (model.status === "ready") {
697
+ const files = Object.entries(model.files ?? {})
698
+ .filter((entry) => Boolean(entry[1]))
699
+ .map(([kind, file]) => `${kind} (${(file.bytes / 1_048_576).toFixed(1)} MB)`)
700
+ .join(", ");
701
+ return `${charge}3D model ${model.id} is ready: ${car}; files ${files || "none"}. Each files.<kind>.url redirects to a signed download valid for an hour (the API key is needed on the first hop only).`;
702
+ }
703
+ if (model.status === "failed") {
704
+ return `${charge}3D model ${model.id} failed: ${model.error?.message ?? "the model could not be generated"}. The credits were refunded; try again later or with another color.`;
705
+ }
706
+ const eta = model.estimated_seconds_remaining === null ? "" : `, about ${model.estimated_seconds_remaining} s left`;
707
+ return `${charge}3D model ${model.id} is ${model.status} (${model.progress}%${model.stage ? `, ${model.stage}` : ""}${eta}): ${car}. Poll get_3d_model(id) again in a few seconds; do not create it twice.`;
708
+ }
529
709
  export const MCP_TOOLS = {
530
710
  get_car_image: {
531
711
  name: "get_car_image",
532
712
  title: "Get car image",
533
- description: `Render or fetch a studio-quality, transparent-background image of a specific vehicle (make, model, year) from one of six camera angles in one of fifteen preset colors, at any width and height up to ${MAX_DIMENSION} px (fit contain|cover|inside), transparent or on a solid background, optionally trimmed to the car. Returns the image inline (PNG/WebP/JPG; format auto delivers PNG here) plus usage metadata (credits_charged, credits_remaining, source cache|generated, request_id). COSTS ${CREDITS_PER_IMAGE} CREDIT per call, cached or generated. Use resolve_vehicle first when the request is free text; use create_car_image_urls instead when the image must be embedded in a web page or document.`,
713
+ description: `Render or fetch a studio-quality, transparent-background image of a specific vehicle (make, model and year, or its vehicle id) from one of six camera angles in any paint color (fifteen named presets or any hex such as #1a2b3c), at any width and height up to ${MAX_DIMENSION} px (fit contain|cover|inside), transparent or on a solid background, optionally trimmed to the car. Returns the image inline (PNG/WebP/JPG; format auto delivers PNG here) plus usage metadata (credits_charged, credits_remaining, source cache|generated, request_id, the vehicle with its vehicle_id). COSTS ${CREDITS_PER_IMAGE} CREDIT per call, cached or generated. Use resolve_vehicle first when the request is free text; use create_car_image_urls instead when the image must be embedded in a web page or document.`,
534
714
  inputSchema: MCP_TOOL_SCHEMAS.get_car_image,
535
715
  outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_car_image,
536
716
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
@@ -538,7 +718,7 @@ export const MCP_TOOLS = {
538
718
  create_car_image_urls: {
539
719
  name: "create_car_image_urls",
540
720
  title: "Create signed car image URLs",
541
- description: "Create 1-50 signed, key-free delivery URLs that browsers, emails or documents can load directly (<img src>). Each URL costs 1 credit at creation; redemptions within the TTL are free and publicly cacheable. Each image takes the same sizing options as get_car_image (width, height, fit, background, trim, padding); format auto makes the URL serve webp or png per viewer. For email, CMS pages or documents that outlive a TTL, set renew: true with ttl_seconds 604800: the URL keeps serving past expiry at one more credit per opened week, for up to renew_days. Pass idempotency_key when the call might be repeated: a retry with the same key and arguments replays the first result instead of billing again. Returns id, url, expires_at, max_uses, renews_until and the normalized vehicle for each image. Prefer this over get_car_image whenever the output is HTML, Markdown, a document or a website.",
721
+ description: "Create 1-50 signed, key-free delivery URLs that browsers, emails or documents can load directly (<img src>). Each URL costs 1 credit at creation; redemptions within the TTL are free and publicly cacheable. Each image names its vehicle like get_car_image (make, model, year, or a vehicle id), takes any paint color (a preset or a hex) and the same sizing options (width, height, fit, background, trim, padding); format auto makes the URL serve webp or png per viewer. For email, CMS pages or documents that outlive a TTL, set renew: true with ttl_seconds 604800: the URL keeps serving past expiry at one more credit per opened week, for up to renew_days. Pass idempotency_key when the call might be repeated: a retry with the same key and arguments replays the first result instead of billing again. Returns id, url, expires_at, max_uses, renews_until and the normalized vehicle for each image. Prefer this over get_car_image whenever the output is HTML, Markdown, a document or a website.",
542
722
  inputSchema: MCP_TOOL_SCHEMAS.create_car_image_urls,
543
723
  outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.create_car_image_urls,
544
724
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
@@ -546,7 +726,7 @@ export const MCP_TOOLS = {
546
726
  search_vehicles: {
547
727
  name: "search_vehicles",
548
728
  title: "Search the vehicle catalog",
549
- description: `Free. Fuzzy-search the open vehicle catalog (${CATALOG_MAKES} makes, ${CATALOG_MODELS} models, ${CATALOG_YEARS}) by make and/or model with typo tolerance. Returns canonical make/model names, available years and match kind, ready to pass to get_car_image. Use it to confirm a vehicle exists or to list a make's models before rendering.`,
729
+ description: `Free. Fuzzy-search the open vehicle catalog (${CATALOG_MAKES} makes, ${CATALOG_MODELS} models, ${CATALOG_YEARS}) by make and/or model with typo tolerance. Returns canonical make/model names, available years and match kind, ready to pass to get_car_image (a model hit also carries stable vehicle ids per year, usable as \`vehicle\`). Use it to confirm a vehicle exists or to list a make's models before rendering.`,
550
730
  inputSchema: MCP_TOOL_SCHEMAS.search_vehicles,
551
731
  outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.search_vehicles,
552
732
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
@@ -554,7 +734,7 @@ export const MCP_TOOLS = {
554
734
  resolve_vehicle: {
555
735
  name: "resolve_vehicle",
556
736
  title: "Resolve free text to image parameters",
557
- description: 'Free. Turn a natural-language request such as "red 2024 porsche 911 side view" into exact get_car_image parameters (make, model, year, view, color) plus alternative candidates and a confidence of high, medium or low. Call this before rendering when the user did not spell out the parameters; ask the user to choose when confidence is low or several candidates fit.',
737
+ description: 'Free. Turn a natural-language request such as "red 2024 porsche 911 side view" into exact get_car_image parameters (vehicle_id, make, model, year, view, color) plus alternative candidates and a confidence of high, medium or low. Call this before rendering when the user did not spell out the parameters; ask the user to choose when confidence is low or several candidates fit.',
558
738
  inputSchema: MCP_TOOL_SCHEMAS.resolve_vehicle,
559
739
  outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.resolve_vehicle,
560
740
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
@@ -562,7 +742,7 @@ export const MCP_TOOLS = {
562
742
  list_image_options: {
563
743
  name: "list_image_options",
564
744
  title: "List image options",
565
- description: "Free. List the supported camera views (with yaw angles and aliases), the fifteen preset colors with hex swatches, size presets, output formats, current pricing and catalog coverage. Use it when you need to validate or explain what can be requested.",
745
+ description: "Free. List the supported camera views (with yaw angles and aliases), the fifteen preset colors with hex swatches (any other paint is a hex color), size presets, output formats, current pricing and catalog coverage. Use it when you need to validate or explain what can be requested.",
566
746
  inputSchema: MCP_TOOL_SCHEMAS.list_image_options,
567
747
  outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.list_image_options,
568
748
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
@@ -578,7 +758,7 @@ export const MCP_TOOLS = {
578
758
  rate_image: {
579
759
  name: "rate_image",
580
760
  title: "Rate a delivered image",
581
- description: "Free. Record quality feedback on a delivered image, either by the request_id returned with it or by vehicle (make, model, year, view, color). Provide verdict good|bad or rating 1-5 and an optional reason. Feedback drives re-renders and prompt improvements.",
761
+ description: "Free. Record quality feedback on a delivered image, either by the request_id returned with it or by vehicle (make, model, year, or a vehicle id, plus view and color). Provide verdict good|bad or rating 1-5 and an optional reason. Feedback drives re-renders and prompt improvements.",
582
762
  inputSchema: MCP_TOOL_SCHEMAS.rate_image,
583
763
  outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.rate_image,
584
764
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
@@ -590,6 +770,30 @@ export const MCP_TOOLS = {
590
770
  inputSchema: MCP_TOOL_SCHEMAS.describe_api,
591
771
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
592
772
  },
773
+ decode_vin: {
774
+ name: "decode_vin",
775
+ title: "Decode a VIN",
776
+ description: "Free. Decode a full 17-character VIN, or a partial VIN of at least 5 characters with * for unknown positions, with NHTSA vPIC data: year, make, model, trim, series, body class, engine, transmission, manufacturer, plant and every decoded attribute. `vehicle` is the catalog vehicle it maps to, with the stable id to pass as `vehicle` to get_car_image, create_car_image_urls or create_3d_model, or null when the catalog does not carry that car. Use it whenever the human gives a VIN instead of a make and model.",
777
+ inputSchema: MCP_TOOL_SCHEMAS.decode_vin,
778
+ outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.decode_vin,
779
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
780
+ },
781
+ create_3d_model: {
782
+ name: "create_3d_model",
783
+ title: "Create a 3D model",
784
+ description: `COSTS ${MODEL_3D_PRICE} PER CALL, charged when the request is made whether the model is cached, in progress or new: confirm with the human before creating one. Build a textured 3D model (GLB, USDZ, FBX and a PNG thumbnail) of one catalog vehicle (make, model and year, or a vehicle id) in one paint color (a preset or any hex), from the same renders the images use, so it matches the pictures. A failed model is refunded. Returns the request at once with status queued, processing or ready (cached), progress 0-100 and estimated_seconds_remaining; poll get_3d_model every few seconds until status is ready, then hand over files.<kind>.url (API URLs that redirect to short-lived signed downloads), or pass webhook_url to be POSTed the same JSON when it settles. A model takes one to five minutes.`,
785
+ inputSchema: MCP_TOOL_SCHEMAS.create_3d_model,
786
+ outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.create_3d_model,
787
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
788
+ },
789
+ get_3d_model: {
790
+ name: "get_3d_model",
791
+ title: "Get a 3D model",
792
+ description: "Free. The state of one 3D request by id: status (queued, processing, ready, failed), progress 0-100, stage, estimated_seconds_remaining, the vehicle and color, and once ready the files (glb, usdz, fbx, thumbnail) with their download URLs, byte sizes and content types. Poll it every few seconds after create_3d_model; a processing model is re-checked with the provider on each call. A failed model carries error and was refunded.",
793
+ inputSchema: MCP_TOOL_SCHEMAS.get_3d_model,
794
+ outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_3d_model,
795
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
796
+ },
593
797
  list_requests: {
594
798
  name: "list_requests",
595
799
  title: "List vehicle and feature requests",
@@ -665,11 +869,12 @@ export const API_REFERENCE = [
665
869
  auth: "bearer",
666
870
  credits: "1 per call (cached or generated)",
667
871
  params: [
668
- "make (required)",
669
- "model (required)",
670
- `year (required, ${CATALOG_YEARS})`,
872
+ "make (required unless vehicle is given)",
873
+ "model (required unless vehicle is given)",
874
+ `year (required unless vehicle is given, ${CATALOG_YEARS})`,
875
+ "vehicle (a stable vehicle id such as veh_395yw8tn73ff8, from /api/v1/vehicles, /api/v1/vin or resolve; replaces make, model and year, never alongside them)",
671
876
  `view (${VIEWS.join("|")}; default front-3-4)`,
672
- `color (${COLORS.join("|")}; default silver)`,
877
+ `color (${COLORS.join("|")}, or any hex paint written bare in URLs such as 1a2b3c; default silver; JSON echoes a hex as #1a2b3c)`,
673
878
  "size (thumb=256|small=512|medium=768|large=1024)",
674
879
  `w, h (1-${MAX_DIMENSION} px; both -> the output is exactly w x h)`,
675
880
  `fit (${FITS.join("|")}; default contain; only matters with both w and h)`,
@@ -677,11 +882,11 @@ export const API_REFERENCE = [
677
882
  `trim (1 crops to the car's alpha bounds before sizing), padding (0-${MAX_PADDING_PERCENT} percent, only with trim)`,
678
883
  `format (${FORMATS.join("|")}|auto; default png; auto negotiates webp/png from Accept)`,
679
884
  ],
680
- returns: "image bytes; headers X-Credits-Charged, X-Credits-Remaining, 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,width,height,format}, billing:{credits_charged,credits_remaining}, request_id}",
681
- errors: ["400 invalid params", "401 missing/invalid key", "402 insufficient credits (balance, required_credits)", "404 vehicle not in catalog", "429 rate limited (Retry-After)", "502 render failed (refunded)"],
885
+ returns: "image bytes; headers X-Credits-Charged, X-Credits-Remaining, 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,credits_remaining}, request_id}",
886
+ errors: ["400 invalid params (also vehicle together with make/model/year)", "401 missing/invalid key", "402 insufficient credits (balance, required_credits)", "404 vehicle not in catalog or unknown vehicle id", "429 rate limited (Retry-After)", "502 render failed (refunded)"],
682
887
  notes: "Do not purchase credits automatically on 402; ask the human. Respect Retry-After on 429.",
683
- sdk: "client.getImage({ make, model, year, view, color, size, width, height, fit, background, trim, padding, format }) / client.getImageUrl(...)",
684
- cli: "car-image get --make Porsche --model 911 --year 2024 --view side --color red --out car.png",
888
+ sdk: "client.getImage({ make, model, year, view, color, size, width, height, fit, background, trim, padding, format }) / client.getImage({ vehicle: 'veh_…', color: '#1a2b3c' }) / client.getImageUrl(...)",
889
+ 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",
685
890
  },
686
891
  {
687
892
  method: "POST",
@@ -689,10 +894,10 @@ export const API_REFERENCE = [
689
894
  summary: "Create 1-50 signed delivery URLs for browsers (no key needed to load them).",
690
895
  auth: "bearer",
691
896
  credits: "1 per URL, charged at creation; redemptions are free",
692
- params: ["images: [{make, model, year, view?, color?, size?, width?, height?, fit?, background?, trim?, padding?, format?}] (or a single image object)", "ttl_seconds (60-604800; default 3600)", "max_uses (0 = unlimited; default 0)", "renew (auto-renew past the TTL at 1 credit per opened window; 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)"],
693
- returns: "201 {data:[{id,url,expires_at,max_uses,renews_until,vehicle}], billing:{charged_on:'creation',credits_charged,credits_remaining,credits_per_url,renewal?}, request_id}; a replay carries Idempotent-Replayed: true",
897
+ params: ["images: [{make, model, year | vehicle, view?, color? (preset or hex), size?, width?, height?, fit?, background?, trim?, padding?, format?}] (or a single image object)", "ttl_seconds (60-604800; default 3600)", "max_uses (0 = unlimited; default 0)", "renew (auto-renew past the TTL at 1 credit per opened window; 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)"],
898
+ returns: "201 {data:[{id,url,expires_at,max_uses,renews_until,vehicle:{vehicle_id,…}}], billing:{charged_on:'creation',credits_charged,credits_remaining,credits_per_url,renewal?}, request_id}; a replay carries Idempotent-Replayed: true",
694
899
  errors: ["400 invalid body or batch > 50", "401", "402", "404 vehicle not in catalog", "409 same Idempotency-Key still in flight", "422 same Idempotency-Key with a different body", "429"],
695
- sdk: "client.createImageUrls([{ make, model, year, ...sizing }], { ttlSeconds, maxUses, renew, renewDays, idempotencyKey })",
900
+ sdk: "client.createImageUrls([{ make, model, year, ...sizing }, { vehicle: 'veh_…' }], { ttlSeconds, maxUses, renew, renewDays, idempotencyKey })",
696
901
  cli: "car-image url --make BMW --model M3 --year 2022 --ttl 86400 [--renew] [--idempotency-key <key>]",
697
902
  },
698
903
  {
@@ -710,7 +915,7 @@ export const API_REFERENCE = [
710
915
  summary: "Views, colors, sizes, formats, pricing and catalog coverage.",
711
916
  auth: "public",
712
917
  credits: "free",
713
- returns: "{data:{views:[{id,label,yaw_degrees,description,aliases}], colors:[{name,hex}], sizes:{presets,max,source}, fits, default_fit, backgrounds, trim, formats, pricing:{credits_per_image,credits_per_dollar,free_credits}, catalog:{makes,models,years,sources}}}",
918
+ returns: "{data:{views:[{id,label,yaw_degrees,description,aliases}], colors:[{name,hex}], paint:{parameter,custom,example}, sizes:{presets,max,source}, fits, default_fit, backgrounds, trim, formats, pricing:{credits_per_image,credits_per_dollar,free_credits}, catalog:{makes,models,years,sources}, vehicle_ids:{description,example,lookup,parameter}}}",
714
919
  sdk: "client.options()",
715
920
  cli: "car-image options",
716
921
  },
@@ -721,28 +926,100 @@ export const API_REFERENCE = [
721
926
  auth: "bearer",
722
927
  credits: "free",
723
928
  params: ['query: "red 2024 porsche 911 side view"'],
724
- returns: "{data:{params:{make,model,year,view,color}, display:{make_name,model_name}, candidates:[...], confidence:high|medium|low, image_path}}",
929
+ returns: "{data:{params:{vehicle_id,make,model,year,view,color}, display:{make_name,model_name}, candidates:[...], confidence:high|medium|low, image_path}}",
725
930
  sdk: "client.resolve(query)",
726
931
  cli: "car-image resolve red 2024 porsche 911 side view",
727
932
  },
728
933
  {
729
934
  method: "GET",
730
935
  path: "/api/v1/vehicles",
731
- summary: "Browse or search the catalog.",
936
+ summary: "Browse or search the catalog; every model in a known year carries its stable vehicle id.",
732
937
  auth: "public",
733
938
  credits: "free",
734
- params: ["(none) -> years", "year -> makes [{id,name}]", "year + makeId -> models", "q (+ limit) -> fuzzy search results"],
735
- returns: "{data:{years}} | {data:{year,makes}} | {data:{year,make_id,models}} | {data:{results}}",
736
- sdk: "client.vehicles({ year, makeId }) / client.searchVehicles(q, { limit })",
939
+ params: ["(none) -> years", "year -> makes [{id,name,slug}]", "year + makeId -> models [{name,slug,vehicle_type,id}]", "make (slug) [+ year] -> that make's models", "make + model (slugs) -> the model's years, each with its id", "q (+ limit, year) -> fuzzy search results; a model hit carries ids {year: id} and id for the year the query named"],
940
+ returns: "{data:{years}} | {data:{year,makes}} | {data:{year,make_id,models}} | {data:{make,models}} | {data:{make,model,years,year_ranges,vehicles:[{year,id}]}} | {data:{query,results:[{kind,make_name,make_slug,model_name,model_slug,vehicle_type,years,year_ranges,match_kind,id?,ids?}]}}",
941
+ sdk: "client.vehicles({ year, makeId }) / client.vehicles({ make, model }) / client.searchVehicles(q, { limit, year })",
737
942
  cli: "car-image search porsche 911",
738
943
  },
944
+ {
945
+ method: "GET",
946
+ path: "/api/v1/vehicles/{id}",
947
+ summary: "The catalog vehicle a stable id names, with its years and the image URLs that render it.",
948
+ auth: "public",
949
+ credits: "free",
950
+ returns: "{data:{id, make:{id,name,slug}, model:{name,slug,vehicle_type}, year, years, year_ranges, image_path, images:{front,front-3-4,side,side-right,rear,rear-3-4}}, request_id}",
951
+ errors: ["400 not a vehicle id", "404 unknown id"],
952
+ notes: "Ids are a pure function of the catalog spelling and never change; store them instead of make/model/year strings.",
953
+ sdk: "client.vehicle('veh_395yw8tn73ff8')",
954
+ cli: "car-image get --vehicle veh_395yw8tn73ff8",
955
+ },
956
+ {
957
+ method: "GET",
958
+ path: "/api/v1/vin/{vin}",
959
+ summary: "Decode a full or partial VIN (NHTSA vPIC) and name the catalog vehicle it maps to.",
960
+ auth: "bearer",
961
+ credits: "free",
962
+ params: ["vin in the path: 17 characters, or a partial VIN of 5+ characters with * for each unknown position (case, spaces and dashes ignored)", "year (optional model-year hint)"],
963
+ returns: "{data:{vin, valid, errors:[{code,text}], suggested_vin, year, make, model, trim, series, body_class, vehicle_type, doors, drive_type, fuel_type, engine:{cylinders,displacement_l,hp,model}, transmission:{style,speeds}, manufacturer, plant:{city,state,country}, gvwr, attributes:{…every decoded variable}, vehicle:{id,make,model,year,image_path}|null, source:vpic-db|vpic-api}, request_id}",
964
+ errors: ["400 invalid VIN or year", "401", "404 VIN not recognized", "502 both decoders unavailable"],
965
+ notes: "vehicle.id is a stable vehicle id: pass it as vehicle= to /api/v1/images/car, /api/v1/image-urls or /api/v1/3d. vehicle is null when the catalog does not carry the car.",
966
+ sdk: "client.decodeVin('1HGCM82633A004352', { year: 2003 })",
967
+ cli: "car-image vin 1HGCM82633A004352",
968
+ },
969
+ {
970
+ method: "POST",
971
+ path: "/api/v1/3d",
972
+ summary: "Create a textured 3D model (GLB, USDZ, FBX and a thumbnail) of one vehicle in one paint color.",
973
+ auth: "bearer",
974
+ credits: `${MODEL_3D_PRICE} per model at launch (credits_per_model, reported by GET /api/v1/3d), charged at creation whether the model is cached, in progress or new; a failed model is refunded; polls and downloads are free`,
975
+ params: ["make, model, year — or vehicle (a veh_… id), never both", "color (preset or hex such as #1a2b3c; default silver)", "webhook_url (https, public host; receives one POST {event:'3d_model.ready'|'3d_model.failed', data, sent_at} with X-CarImage-Event and X-CarImage-Delivery, retried up to five times)", "webhook_secret (with webhook_url: X-CarImage-Signature: sha256=<hex HMAC of the raw body>)", "header Idempotency-Key (optional; same rules as /api/v1/image-urls)"],
976
+ returns: "202 while queued or processing, 200 when already ready: {data:{id, object:'3d_model', status:queued|processing|ready|failed, progress:0-100, stage, vehicle:{id,make,model,year}, color, generator, files:{glb|usdz|fbx|thumbnail:{url,bytes,content_type}}|null, polycount, error, estimated_seconds_remaining, webhook, created_at, updated_at, ready_at}, billing:{charged_on:'creation',credits_charged,credits_remaining}, request_id}; Location: /api/v1/3d/{id}",
977
+ errors: ["400 invalid body or webhook URL", "401", "402 insufficient credits", "404 vehicle not in catalog", "409/422 Idempotency-Key conflicts", "503 3D models disabled or at daily capacity (Retry-After; nothing charged)"],
978
+ notes: "Ask the human before spending. A model takes one to five minutes: poll GET /api/v1/3d/{id} every few seconds or use the webhook; never re-POST to check progress.",
979
+ sdk: "client.create3dModel({ make, model, year } | { vehicle }, { color, webhookUrl, webhookSecret, idempotencyKey }) then client.wait3dModel(id)",
980
+ cli: "car-image 3d create --make Toyota --model Camry --year 2025 --color 1a2b3c --wait --out ./models",
981
+ },
982
+ {
983
+ method: "GET",
984
+ path: "/api/v1/3d",
985
+ summary: "The caller's recent 3D requests, newest first, with the current price per model.",
986
+ auth: "bearer",
987
+ credits: "free",
988
+ params: ["limit (1-50; default 20)"],
989
+ returns: "{data:[3d_model…], pricing:{credits_per_model}, request_id}",
990
+ sdk: "client.list3dModels({ limit: 20 })",
991
+ cli: "car-image 3d list",
992
+ },
993
+ {
994
+ method: "GET",
995
+ path: "/api/v1/3d/{id}",
996
+ summary: "Status, progress and files of one 3D request; a processing model is re-checked with the provider.",
997
+ auth: "bearer",
998
+ credits: "free",
999
+ returns: "{data: 3d_model, request_id}",
1000
+ errors: ["404 unknown id (ids are scoped to the account)"],
1001
+ sdk: "client.get3dModel(id) / client.wait3dModel(id, { intervalMs, timeoutMs, onProgress })",
1002
+ cli: "car-image 3d get <id> --wait",
1003
+ },
1004
+ {
1005
+ method: "GET",
1006
+ path: "/api/v1/3d/{id}/files/{kind}",
1007
+ summary: `One file of a ready model (kind: ${MODEL_3D_FILE_KINDS.join("|")}): a 302 to a signed URL valid for an hour.`,
1008
+ auth: "bearer",
1009
+ credits: "free",
1010
+ returns: "302 Location: <signed storage URL>; X-Content-Length, X-File-Content-Type",
1011
+ errors: ["404 unknown id or kind", "409 model not ready yet (Retry-After: 15)"],
1012
+ notes: "Follow the redirect without the Authorization header; the signed URL needs no key. files.<kind>.url on the model JSON is this endpoint.",
1013
+ sdk: "client.download3dModel(id, 'glb') // { bytes, contentType }",
1014
+ cli: "car-image 3d download <id> --format glb --out model.glb",
1015
+ },
739
1016
  {
740
1017
  method: "POST",
741
1018
  path: "/api/v1/feedback",
742
1019
  summary: "Rate a delivered image.",
743
1020
  auth: "bearer",
744
1021
  credits: "free",
745
- params: ["request_id OR make, model, year (+ view, color)", "rating 1-5 and/or verdict good|bad", "reason (optional)"],
1022
+ params: ["request_id OR make, model, year (+ view, color as a preset or hex)", "rating 1-5 and/or verdict good|bad", "reason (optional)"],
746
1023
  returns: "201 {data:{...}, request_id}",
747
1024
  sdk: "client.feedback({ requestId, verdict: 'good' })",
748
1025
  cli: "car-image feedback --request-id <id> --good",
@@ -907,7 +1184,8 @@ export function formatApiReference(filter) {
907
1184
  const header = [
908
1185
  `Car Image API — base URL ${DEFAULT_BASE_URL}`,
909
1186
  `Auth: Authorization: Bearer cimg_… (never in URLs). Errors: application/problem+json {type,title,status,detail,request_id}.`,
910
- `Pricing: ${CREDITS_PER_IMAGE} credit per delivered image, $1 = ${CREDITS_PER_DOLLAR} credits, ${FREE_CREDITS} free credits, no subscription.`,
1187
+ `Pricing: ${CREDITS_PER_IMAGE} credit per delivered image, $1 = ${CREDITS_PER_DOLLAR} credits, ${FREE_CREDITS} free credits, no subscription; a 3D model is ${MODEL_3D_PRICE}.`,
1188
+ `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).`,
911
1189
  "",
912
1190
  ];
913
1191
  if (endpoints.length === 0) {
@@ -954,9 +1232,13 @@ export function nextStepFor(status) {
954
1232
  case 403:
955
1233
  return "This key lacks the required scope. Ask the human to create a key with the right scopes in the dashboard.";
956
1234
  case 404:
957
- return "The vehicle is not in the catalog. Use search_vehicles or resolve_vehicle to find the canonical make/model/year.";
1235
+ return "The vehicle is not in the catalog (or the id is unknown). Use search_vehicles, resolve_vehicle or decode_vin to find the canonical make/model/year or its vehicle id.";
1236
+ case 409:
1237
+ return "Not ready or still in progress (a 3D model still being made, or an Idempotency-Key request still running). Wait the retry_after seconds, then poll again; do not create a second one.";
958
1238
  case 429:
959
1239
  return "Rate limited. Wait the retry_after seconds before retrying; do not hammer the API.";
1240
+ case 503:
1241
+ return "Temporarily unavailable (a feature is switched off or at its daily capacity); nothing was charged. Wait the retry_after seconds before trying again, and tell the human if it persists.";
960
1242
  default:
961
1243
  return "Retry once if this looks transient; otherwise report the detail and request_id to the human.";
962
1244
  }