@meterapp/car-image-sdk 1.32.0 → 1.34.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 +32 -18
- package/dist/client.d.ts +67 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +155 -22
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +29 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +54 -26
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +98 -64
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/support.d.ts +21 -12
- package/dist/mcp/support.d.ts.map +1 -1
- package/dist/mcp/support.js +15 -5
- package/dist/mcp/support.js.map +1 -1
- package/dist/packs.d.ts +264 -0
- package/dist/packs.d.ts.map +1 -0
- package/dist/packs.js +13 -0
- package/dist/packs.js.map +1 -0
- package/dist/support.d.ts +40 -15
- package/dist/support.d.ts.map +1 -1
- package/dist/types.d.ts +168 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +32 -3
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +4 -0
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkoutLinkToolSchema, checkoutStatusResultSchema, checkoutStatusSchema, helpQuerySchema, billingLinkResultSchema, helpResultSchema, payInvoiceSchema, pricingResultSchema, purchasePlanSchema, purchaseResultSchema } from "./support.js";
|
|
2
2
|
/**
|
|
3
3
|
* Shared MCP tool definitions for the Car Image API.
|
|
4
4
|
*
|
|
@@ -12,7 +12,7 @@ import { checkoutLinkSchema, checkoutStatusResultSchema, checkoutStatusSchema, h
|
|
|
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, IDEMPOTENCY_KEY_PATTERN, MAX_CHECK_VEHICLES, 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";
|
|
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_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";
|
|
16
16
|
import { SDK_VERSION } from "../version.js";
|
|
17
17
|
/** The 3D price as agents read it: "100 credits ($1.00)". */
|
|
18
18
|
const MODEL_3D_PRICE = `${CREDITS_PER_3D_MODEL.toLocaleString("en-US")} credits ($${(CREDITS_PER_3D_MODEL / CREDITS_PER_DOLLAR).toFixed(2)})`;
|
|
@@ -164,39 +164,39 @@ export const MCP_INSTRUCTIONS_HEAD_LIMIT = 2048;
|
|
|
164
164
|
const HEAD_MISSING = "tell the human the catalog does not carry it and stop";
|
|
165
165
|
/** When to use the feedback tools, which every toolset has. */
|
|
166
166
|
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.";
|
|
167
|
-
/** The 3D
|
|
168
|
-
const HEAD_3D =
|
|
167
|
+
/** The 3D rule, shown only where create_3d_model is a tool the host has. */
|
|
168
|
+
const HEAD_3D = "Confirm with the human before calling create_3d_model. ";
|
|
169
169
|
function toolsetHas(toolset, tool) {
|
|
170
170
|
return MCP_TOOLSETS[toolset].includes(tool);
|
|
171
171
|
}
|
|
172
|
-
/**
|
|
172
|
+
/**
|
|
173
|
+
* The part of the instructions every host shows: what this is, the two steps,
|
|
174
|
+
* what is free and when to stop. App directory reviews (OpenAI's 2026-10-23
|
|
175
|
+
* scan flagged these instructions and get_account) hold back a server whose
|
|
176
|
+
* instructions talk about credits, prices or purchases, so this text names
|
|
177
|
+
* only what is free; the paid tools' own descriptions and the 402 body carry
|
|
178
|
+
* the rest.
|
|
179
|
+
*/
|
|
173
180
|
export function mcpInstructionsHead(toolset = DEFAULT_MCP_TOOLSET) {
|
|
174
181
|
return `Car Image API by Meter: studio vehicle renders from the open @meterapp/vehicle-db catalog, eight views, any paint color.
|
|
175
182
|
|
|
176
183
|
First look the vehicle up: resolve_vehicle reads a year/make/model phrase and returns params.vehicle_id, view and color; search_vehicles browses; decode_vin reads a VIN; check_vehicles checks a list of up to ${MAX_MCP_CHECK_VEHICLES} at once. All are free. Do this even for a car you picked yourself: catalog names differ from familiar names. Include a year; if the human named none, choose one and say which. Reuse an id already in this conversation.
|
|
177
184
|
|
|
178
|
-
For an image in chat, call create_car_image_urls once with vehicle: "veh_…", view and color in images, ttl_seconds: 604800 and max_uses: 0. Paste each returned markdown image directly in the final reply, outside code fences, and state expiry. Reuse unexpired URLs. Leave renewal off unless requested. If inline images are unsupported, link the existing URL; do not make another
|
|
185
|
+
For an image in chat, call create_car_image_urls once with vehicle: "veh_…", view and color in images, ttl_seconds: 604800 and max_uses: 0. Paste each returned markdown image directly in the final reply, outside code fences, and state expiry. Reuse unexpired URLs. Leave renewal off unless requested. If inline images are unsupported, link the existing URL; do not make another image call. Use get_car_image for explicit files or bytes, not before minting a URL for the same image. Pages, emails and documents also use signed URLs; never put keys in client code.
|
|
179
186
|
|
|
180
|
-
If lookup confidence is low or the year differs from the request, ask before
|
|
187
|
+
If lookup confidence is low or the year differs from the request, ask before making an image. If no match, ${HEAD_MISSING}; never silently substitute a car.
|
|
181
188
|
|
|
182
|
-
|
|
189
|
+
Free: every new account includes ${FREE_VEHICLE_IMAGES} free vehicle images a month (a vehicle in one color from one angle, shown as often as needed at any size), and lookups are always free. Confirm the count before a batch the human did not size. ${toolsetHas(toolset, "create_3d_model") ? HEAD_3D : ""}If a call is refused with HTTP 402, stop and hand the human the link it returns; do not retry it.
|
|
183
190
|
|
|
184
191
|
${HEAD_FEEDBACK}`;
|
|
185
192
|
}
|
|
186
|
-
/** The tools that never cost a credit, named in the Plans paragraph for the toolset that has them. */
|
|
187
|
-
const FREE_TOOLS = ["search_vehicles", "resolve_vehicle", "decode_vin", "check_vehicles", "list_image_options", "get_account", "list_members", "list_webhooks", "get_3d_model", "publish_3d_model", "describe_api"];
|
|
188
|
-
/** "a, b and c" */
|
|
189
|
-
function listed(names) {
|
|
190
|
-
return names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}` : (names[0] ?? "");
|
|
191
|
-
}
|
|
192
193
|
const REFERENCE_BLOCKS = [
|
|
193
194
|
{ needs: [], text: `Reference.\n\nImages: eight camera views (front, rear, both side profiles and all four three-quarter corners), 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.` },
|
|
194
|
-
{ needs: [], text: (toolset) => `Plans: a plan carries the license and a monthly allowance of credits (Free: ${FREE_CREDITS} credits once at signup, evaluation and personal projects, up to 100 distinct vehicles a month; Pro: $29/month, 25,000 credits a month, commercial license that delivered renders keep after the plan ends, 2,500 distinct vehicles a month; Business: $99/month, 150,000 credits a month, 15,000 distinct vehicles a month); every account, including Free, can buy credits at $1 per ${CREDITS_PER_DOLLAR.toLocaleString("en-US")} credits, and purchased credits never expire (get_account reports the plan in force as data.plan). create_car_image_urls charges 1 credit per URL when the URL is created; redemptions are free. ${listed(FREE_TOOLS.filter((tool) => toolsetHas(toolset, tool)))} are free.` },
|
|
195
195
|
{ 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.` },
|
|
196
196
|
{ 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.` },
|
|
197
197
|
{ 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.` },
|
|
198
198
|
{ 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.` },
|
|
199
|
-
{ needs: [], text: `
|
|
199
|
+
{ 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.` },
|
|
200
200
|
{ 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.` },
|
|
201
201
|
{ 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.` },
|
|
202
202
|
];
|
|
@@ -298,7 +298,7 @@ export const imageInputSchema = z
|
|
|
298
298
|
shadow: z
|
|
299
299
|
.boolean()
|
|
300
300
|
.optional()
|
|
301
|
-
.describe("Add a soft ground shadow under the car, drawn from its cut-out (semi-transparent, or grey on a background). Same
|
|
301
|
+
.describe("Add a soft ground shadow under the car, drawn from its cut-out (semi-transparent, or grey on a background). Same image, nothing extra."),
|
|
302
302
|
format: z
|
|
303
303
|
.enum(REQUEST_FORMATS)
|
|
304
304
|
.default("png")
|
|
@@ -336,7 +336,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
336
336
|
.array(imageInputSchema)
|
|
337
337
|
.min(1)
|
|
338
338
|
.max(50)
|
|
339
|
-
.describe("One to fifty image requests. Each URL
|
|
339
|
+
.describe("One to fifty image requests. Each URL counts its vehicle image (vehicle, color, angle) for the month when created; the same image again this month adds nothing."),
|
|
340
340
|
ttl_seconds: z.coerce
|
|
341
341
|
.number()
|
|
342
342
|
.int()
|
|
@@ -354,7 +354,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
354
354
|
renew: z
|
|
355
355
|
.boolean()
|
|
356
356
|
.optional()
|
|
357
|
-
.describe("Auto-renew past the TTL: the first load in each further window of ttl_seconds
|
|
357
|
+
.describe("Auto-renew past the TTL: the first load in each further window of ttl_seconds renews the URL, until renew_days (no extra count on a plan; one more credit per window on the legacy credit meter, so pair with ttl_seconds 604800). Use for email, CMS pages and documents that outlive a TTL. Requires max_uses 0."),
|
|
358
358
|
renew_days: z.coerce
|
|
359
359
|
.number()
|
|
360
360
|
.int()
|
|
@@ -414,7 +414,7 @@ export const MCP_TOOL_SCHEMAS = {
|
|
|
414
414
|
}),
|
|
415
415
|
get_pricing: z.object({}),
|
|
416
416
|
search_help: helpQuerySchema,
|
|
417
|
-
create_checkout_link:
|
|
417
|
+
create_checkout_link: checkoutLinkToolSchema,
|
|
418
418
|
get_billing_link: z.object({}),
|
|
419
419
|
purchase_plan: purchasePlanSchema,
|
|
420
420
|
pay_invoice: payInvoiceSchema,
|
|
@@ -726,7 +726,6 @@ const vehicleDescriptorSchema = z.looseObject({
|
|
|
726
726
|
shadow: z.boolean().optional(),
|
|
727
727
|
format: z.enum([...FORMATS, "auto"]),
|
|
728
728
|
});
|
|
729
|
-
/** `free_credits` is absent from the account endpoint's copy; the packs are not. */
|
|
730
729
|
/** The organization a connection acts for, with the caller's role (null once they left; the key still works). */
|
|
731
730
|
const organizationSchema = z.looseObject({
|
|
732
731
|
id: z.string(),
|
|
@@ -735,14 +734,17 @@ const organizationSchema = z.looseObject({
|
|
|
735
734
|
personal: z.boolean(),
|
|
736
735
|
role: z.string().nullable(),
|
|
737
736
|
});
|
|
737
|
+
/** Images cost no credits on the plans (credits_per_image 0); credits are not sold, so credits_per_dollar and packs are legacy. */
|
|
738
738
|
const pricingSchema = z.looseObject({
|
|
739
739
|
credits_per_image: z.number(),
|
|
740
|
-
credits_per_dollar: z.number(),
|
|
740
|
+
credits_per_dollar: z.number().optional(),
|
|
741
741
|
free_credits: z.number().optional(),
|
|
742
742
|
packs: z
|
|
743
743
|
.array(z.looseObject({ credits: z.number().int(), cents: z.number().int(), label: z.string().optional() }))
|
|
744
744
|
.optional(),
|
|
745
745
|
});
|
|
746
|
+
/** A vehicle-image meter count: `included` null means no cap. */
|
|
747
|
+
const meterCountSchema = z.looseObject({ used: z.number(), included: z.number().nullable() });
|
|
746
748
|
/** One catalog hit, in the single spelling both servers emit (see {@link toVehicleMatch}). */
|
|
747
749
|
const vehicleMatchSchema = z.looseObject({
|
|
748
750
|
kind: z.enum(["make", "model"]),
|
|
@@ -918,7 +920,11 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
918
920
|
}),
|
|
919
921
|
get_car_image: z.looseObject({
|
|
920
922
|
credits_charged: z.number().nullable(),
|
|
921
|
-
|
|
923
|
+
/** Legacy credit meter only. */
|
|
924
|
+
credits_remaining: z.number().nullable().optional(),
|
|
925
|
+
/** Vehicle-image meter: the month's vehicle images and new vehicle views after this call. */
|
|
926
|
+
vehicle_images: meterCountSchema.optional(),
|
|
927
|
+
new_views: meterCountSchema.optional(),
|
|
922
928
|
source: z.enum(["cache", "generated"]).nullable(),
|
|
923
929
|
width: z.number().int().nullable(),
|
|
924
930
|
height: z.number().int().nullable(),
|
|
@@ -937,15 +943,19 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
937
943
|
expires_at: z.string(),
|
|
938
944
|
/** 0 means unlimited redemptions until it expires. */
|
|
939
945
|
max_uses: z.number().int(),
|
|
940
|
-
/** Auto-renewing URLs keep serving,
|
|
946
|
+
/** Auto-renewing URLs keep serving, renewing in each opened window, until this instant. */
|
|
941
947
|
renews_until: z.string().nullable().optional(),
|
|
942
948
|
vehicle: vehicleDescriptorSchema,
|
|
943
949
|
})),
|
|
944
950
|
billing: z.looseObject({
|
|
945
951
|
charged_on: z.literal("creation"),
|
|
946
952
|
credits_charged: z.number(),
|
|
947
|
-
|
|
948
|
-
|
|
953
|
+
/** Legacy credit meter only. */
|
|
954
|
+
credits_remaining: z.number().optional(),
|
|
955
|
+
/** Vehicle-image meter: the month's vehicle images and new vehicle views after this call. */
|
|
956
|
+
vehicle_images: meterCountSchema.optional(),
|
|
957
|
+
new_views: meterCountSchema.optional(),
|
|
958
|
+
renewal: z.looseObject({ window_seconds: z.number(), credits_per_window: z.number().optional(), until: z.string() }).nullable().optional(),
|
|
949
959
|
}),
|
|
950
960
|
request_id: z.string(),
|
|
951
961
|
/** True when a retry was answered from the result stored for its idempotency_key; nothing was billed again. */
|
|
@@ -1238,10 +1248,18 @@ export function webhooksSummary(result) {
|
|
|
1238
1248
|
export const LOW_BALANCE_CREDITS = 10;
|
|
1239
1249
|
/** The one-line summary both servers put above an account: the balance in dollars, the plan, and a stop when it runs low. */
|
|
1240
1250
|
export function accountSummary(data) {
|
|
1251
|
+
const images = data.limits_usage?.vehicle_images_this_month;
|
|
1252
|
+
if (data.limits_usage?.meter === "vehicle_images" && images) {
|
|
1253
|
+
const views = data.limits_usage.new_views_this_month;
|
|
1254
|
+
const of = (usage) => `${usage.used.toLocaleString("en-US")} of ${usage.limit === null ? "unlimited" : usage.limit.toLocaleString("en-US")}`;
|
|
1255
|
+
const full = (usage) => Boolean(usage && usage.limit !== null && usage.used >= usage.limit);
|
|
1256
|
+
const stop = full(images) || full(views) ? " An allowance is used up: images already received this month still serve; ask the human before asking for new ones." : "";
|
|
1257
|
+
return `${data.plan ? `${data.plan.name} plan: ` : ""}${of(images)} vehicle images used this month${views ? `, ${of(views)} new vehicle views` : ""}; every image serves as often as needed in any size.${stop}`;
|
|
1258
|
+
}
|
|
1241
1259
|
const perDollar = data.pricing?.credits_per_dollar ?? CREDITS_PER_DOLLAR;
|
|
1242
1260
|
const perImage = data.pricing?.credits_per_image ?? CREDITS_PER_IMAGE;
|
|
1243
1261
|
const vehicles = data.plan?.limits.vehicles_per_month ?? null;
|
|
1244
|
-
const used = data.limits_usage?.distinct_vehicles_this_month
|
|
1262
|
+
const used = data.limits_usage?.distinct_vehicles_this_month?.used;
|
|
1245
1263
|
const plan = data.plan
|
|
1246
1264
|
? ` on the ${data.plan.name} plan${vehicles === null ? "" : used === undefined ? `, up to ${vehicles.toLocaleString("en-US")} distinct vehicles a month` : `, ${used.toLocaleString("en-US")} of ${vehicles.toLocaleString("en-US")} distinct vehicles used this month`}`
|
|
1247
1265
|
: "";
|
|
@@ -1261,7 +1279,7 @@ export function resolveSummary(data) {
|
|
|
1261
1279
|
const otherYear = typeof asked === "number" && Number(data.params.year) !== asked
|
|
1262
1280
|
? ` The human asked for ${asked}: no ${asked} ${model} is in the catalog, so this is the ${data.params.year}. Do not render it yet. That year may file the car under another name: try search_vehicles with the make, the model family and year ${asked}, then tell the human what you found and ask.`
|
|
1263
1281
|
: "";
|
|
1264
|
-
const caution = data.confidence === "low" ? " Confidence is low: confirm with the human before
|
|
1282
|
+
const caution = data.confidence === "low" ? " Confidence is low: confirm with the human before making an image." : "";
|
|
1265
1283
|
const id = data.params.vehicle_id;
|
|
1266
1284
|
const render = `how it with create_car_image_urls (or get_car_image for explicit files or bytes), passing vehicle: "${id}", view: "${data.params.view}" and color: "${data.params.color}".`;
|
|
1267
1285
|
const next = id ? (otherYear || caution ? ` Once they agree, s${render}` : ` S${render}`) : "";
|
|
@@ -1308,18 +1326,23 @@ export function withImageMarkdown(result) {
|
|
|
1308
1326
|
export function imageUrlsSummary(result) {
|
|
1309
1327
|
const count = result.data.length;
|
|
1310
1328
|
const urls = `${count} signed URL${count === 1 ? "" : "s"}`;
|
|
1311
|
-
const
|
|
1329
|
+
const images = result.billing.vehicle_images;
|
|
1330
|
+
const charged = images
|
|
1331
|
+
? `${images.used.toLocaleString("en-US")} of ${images.included === null ? "unlimited" : images.included.toLocaleString("en-US")} vehicle images used this month`
|
|
1332
|
+
: `${result.billing.credits_charged} credit${result.billing.credits_charged === 1 ? "" : "s"}`;
|
|
1312
1333
|
const renewsUntil = result.data.find((item) => item.renews_until)?.renews_until ?? null;
|
|
1313
|
-
const lifetime = `they expire at ${result.data[0]?.expires_at ?? "the stated time"}${renewsUntil ? ` and renew on load, one credit per window, until ${renewsUntil}` : ""}`;
|
|
1334
|
+
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}` : ""}`;
|
|
1314
1335
|
const display = `For chat, paste each markdown image directly in the final reply, outside code fences (or use  for an older result). No key needed; ${lifetime}. Reuse these URLs; do not call another paid image tool to display them.`;
|
|
1315
1336
|
return result.idempotent_replayed
|
|
1316
|
-
? `Replayed the result stored for this idempotency_key: ${urls}, charged ${charged} the first time and nothing now. ${display}`
|
|
1317
|
-
:
|
|
1337
|
+
? `Replayed the result stored for this idempotency_key: ${urls}, ${images ? charged : `charged ${charged} the first time and nothing now`}. ${display}`
|
|
1338
|
+
: images
|
|
1339
|
+
? `Created ${urls}; ${charged}. Each image serves as often as needed this month. ${display}`
|
|
1340
|
+
: `Created ${urls}; charged ${charged}, ${result.billing.credits_remaining} remaining. ${display}`;
|
|
1318
1341
|
}
|
|
1319
1342
|
export const MCP_TOOLS = {
|
|
1320
1343
|
get_pricing: {
|
|
1321
1344
|
name: "get_pricing", title: "Get current pricing",
|
|
1322
|
-
description: "Free, no account needed. The pricing document: every plan's monthly and yearly price, included credits, limits per tier and features, the
|
|
1345
|
+
description: "Free, no account needed. The pricing document: every plan's monthly and yearly price, its vehicle images and new vehicle views a month (a vehicle image is one vehicle in one color from one angle, delivered as often as needed), included credits (for 3D models, make logos and upgrades; credits are not sold), limits per tier and features, the one-time Image Packs (add_ons), the free tier and live 3D model cost. There is no overage. Every plan and pack has a checkout_url that works before signup (sign-in, then Stripe Checkout; nothing is charged until the human pays): hand it to the human with the price. Use before explaining costs or choosing a plan.",
|
|
1323
1346
|
inputSchema: MCP_TOOL_SCHEMAS.get_pricing, outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_pricing,
|
|
1324
1347
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
1325
1348
|
},
|
|
@@ -1331,7 +1354,7 @@ export const MCP_TOOLS = {
|
|
|
1331
1354
|
},
|
|
1332
1355
|
create_checkout_link: {
|
|
1333
1356
|
name: "create_checkout_link", title: "Create a checkout link",
|
|
1334
|
-
description: "Free. On the human's request, prepare a
|
|
1357
|
+
description: "Free. On the human's request, prepare a Pro or Business subscription purchase link for their own account (credits are not sold; for a one-time set of images, hand them an Image Pack's checkout_url from get_pricing). Never charges a card or switches a plan. A human completes payment in the browser. Connected apps and keys without billing:write receive a checkout link that signs the human in first; existing subscriptions and agreements use the dashboard. Without an account at all, use get_pricing's checkout_url. Return the URL and message; never claim payment succeeded.",
|
|
1335
1358
|
inputSchema: MCP_TOOL_SCHEMAS.create_checkout_link, outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.create_checkout_link,
|
|
1336
1359
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1337
1360
|
},
|
|
@@ -1370,7 +1393,7 @@ export const MCP_TOOLS = {
|
|
|
1370
1393
|
get_car_image: {
|
|
1371
1394
|
name: "get_car_image",
|
|
1372
1395
|
title: "Get car image bytes",
|
|
1373
|
-
description: `Return image bytes as an MCP attachment for explicit file or byte requests. To show a vehicle in chat, use create_car_image_urls and embed its markdown instead; attachments may not appear in the final reply. COSTS ${CREDITS_PER_IMAGE} CREDIT per call, cached or generated. Call resolve_vehicle first (or search_vehicles, or decode_vin for a VIN) and pass the id it returns as \`vehicle\`: the lookup is free, and the catalog files cars under its own names (a Mazda "MX-5 Miata" is mx-5), so a make and model typed from memory can answer 404 for a car the catalog carries. Make, model and year are for callers that already hold catalog spellings. Eight camera angles, any paint color (fifteen named presets or any hex such as #1a2b3c), any width and height up to ${MAX_DIMENSION} px (fit contain|cover|inside), transparent or on a solid background, optionally trimmed to the car and with a soft ground shadow (shadow: true). Returns the image (PNG/WebP/JPG; format auto delivers PNG here) plus usage metadata (credits_charged,
|
|
1396
|
+
description: `Return image bytes as an MCP attachment for explicit file or byte requests. To show a vehicle in chat, use create_car_image_urls and embed its markdown instead; attachments may not appear in the final reply. Counts one vehicle image (vehicle, color, angle) for the month on the account's plan, and a new vehicle view when the catalog has not prepared that angle yet; the same image again this month adds nothing. Legacy credit-meter accounts: COSTS ${CREDITS_PER_IMAGE} CREDIT per call, cached or generated. Call resolve_vehicle first (or search_vehicles, or decode_vin for a VIN) and pass the id it returns as \`vehicle\`: the lookup is free, and the catalog files cars under its own names (a Mazda "MX-5 Miata" is mx-5), so a make and model typed from memory can answer 404 for a car the catalog carries. Make, model and year are for callers that already hold catalog spellings. Eight camera angles, any paint color (fifteen named presets or any hex such as #1a2b3c), any width and height up to ${MAX_DIMENSION} px (fit contain|cover|inside), transparent or on a solid background, optionally trimmed to the car and with a soft ground shadow (shadow: true). Returns the image (PNG/WebP/JPG; format auto delivers PNG here) plus usage metadata (credits_charged, vehicle_images and new_views used this month, or credits_remaining on the credit meter; source cache|generated, request_id, the vehicle with its vehicle_id). Use create_car_image_urls for chat, web pages, emails and documents. Do not call both paid tools for one image.`,
|
|
1374
1397
|
inputSchema: MCP_TOOL_SCHEMAS.get_car_image,
|
|
1375
1398
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_car_image,
|
|
1376
1399
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
@@ -1378,7 +1401,7 @@ export const MCP_TOOLS = {
|
|
|
1378
1401
|
create_car_image_urls: {
|
|
1379
1402
|
name: "create_car_image_urls",
|
|
1380
1403
|
title: "Create signed car image URLs",
|
|
1381
|
-
description: "Show vehicle images in chat: create 1-50 signed URLs with ready-to-display Markdown. Paste each returned markdown directly into the final reply, outside code fences. For chat use ttl_seconds 604800, max_uses 0 and renewal off unless requested. Reuse unexpired URLs; do not call get_car_image first or mint twice for one image. If inline display is unsupported, link the same URL instead. Browsers, emails and documents can also load these key-free URLs directly (<img src>). Each URL
|
|
1404
|
+
description: "Show vehicle images in chat: create 1-50 signed URLs with ready-to-display Markdown. Paste each returned markdown directly into the final reply, outside code fences. For chat use ttl_seconds 604800, max_uses 0 and renewal off unless requested. Reuse unexpired URLs; do not call get_car_image first or mint twice for one image. If inline display is unsupported, link the same URL instead. Browsers, emails and documents can also load these key-free URLs directly (<img src>). Each URL counts its vehicle image for the month at creation (1 credit on the legacy credit meter); loads within the TTL add nothing and are publicly cacheable. Each image names its vehicle like get_car_image: look each distinct vehicle up once (resolve_vehicle, search_vehicles or decode_vin, all free) and pass its id as vehicle, or send make, model and year in catalog spelling. Each takes any paint color (a preset or a hex) and the same sizing options (width, height, fit, background, framing, trim, padding, shadow); 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, renewing in each opened week (one more credit per week on the legacy credit meter), 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, markdown, expires_at, max_uses, renews_until and the normalized vehicle for each image. Prefer this over get_car_image for chat replies, HTML, Markdown, documents and websites. State expiry briefly.",
|
|
1382
1405
|
inputSchema: MCP_TOOL_SCHEMAS.create_car_image_urls,
|
|
1383
1406
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.create_car_image_urls,
|
|
1384
1407
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
@@ -1409,8 +1432,8 @@ export const MCP_TOOLS = {
|
|
|
1409
1432
|
},
|
|
1410
1433
|
get_account: {
|
|
1411
1434
|
name: "get_account",
|
|
1412
|
-
title: "Get account
|
|
1413
|
-
description:
|
|
1435
|
+
title: "Get account",
|
|
1436
|
+
description: `Free. Show the organization this connection acts for (data.organization, with the caller's role), usage this month (limits_usage: vehicle images and new vehicle views used and included, keys, request rates) and the key's scopes. Every new account includes ${FREE_VEHICLE_IMAGES} free vehicle images a month. Check this before large batches.`,
|
|
1414
1437
|
inputSchema: MCP_TOOL_SCHEMAS.get_account,
|
|
1415
1438
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_account,
|
|
1416
1439
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
@@ -1634,15 +1657,15 @@ export const API_REFERENCE = [
|
|
|
1634
1657
|
cli: "car-image logo --make Toyota --width 256 --out toyota-logo.png",
|
|
1635
1658
|
returns: "Image bytes with X-Credits-Charged, X-Credits-Remaining, X-Image-Source, X-Image-Width, X-Image-Height, ETag and X-Request-Id. Failed delivery refunds the credit. No signed URL or 304 mode.",
|
|
1636
1659
|
},
|
|
1637
|
-
{ method: "GET", path: "/api/v1/pricing", summary: "The pricing document: plans (price, included credits, limits, features, checkout_url),
|
|
1660
|
+
{ method: "GET", path: "/api/v1/pricing", summary: "The pricing document: plans (price, vehicle images and new vehicle views a month, included credits, limits, features, checkout_url), the one-time Image Packs (add_ons), free tier, live 3D cost and how to buy. No overage; credits are not sold.", auth: "public", credits: "free", notes: "Every checkout_url works before signup: sign-in, then Stripe Checkout; nothing is charged until the human pays.", sdk: "client.pricing()", cli: "car-image pricing [--json]" },
|
|
1638
1661
|
{ method: "POST", path: "/api/v1/help", summary: "Source-linked product help and private query recording.", auth: "bearer", credits: "free (account:read)", params: ["query (2-1000 characters, no secrets or personal information)", "report_gap (optional boolean: flag missing context)"], notes: "Related articles are not an answer to every clause. Cite relevant sources; escalate unknowns to support. Queries are recorded privately.", sdk: "client.searchHelp(question, {reportGap: true})", cli: "car-image support question --report-gap" },
|
|
1639
|
-
{ method: "POST", path: "/api/v1/billing/link", summary: "Link-only checkout or billing settings; never charges or switches a plan.", auth: "bearer", credits: "free (account:read; owner billing:write for Stripe links)", params: ["
|
|
1662
|
+
{ method: "POST", path: "/api/v1/billing/link", summary: "Link-only checkout or billing settings; never charges or switches a plan.", auth: "bearer", credits: "free (account:read; owner billing:write for Stripe links)", params: ["plan (pro|business) + optional interval (month|year); {} for settings. Credits are not sold"], notes: "Connected apps and keys without billing:write get a checkout link that signs the human in first; existing subscriptions use the signed-in dashboard. A human completes payment in the browser.", sdk: "client.createCheckoutLink({plan: 'pro'}) / client.getBillingLink()", cli: "car-image upgrade --plan pro --no-browser (works before sign-in)" },
|
|
1640
1663
|
{
|
|
1641
1664
|
method: "GET",
|
|
1642
1665
|
path: "/api/v1/images/car",
|
|
1643
|
-
summary: "Get a
|
|
1666
|
+
summary: "Get a vehicle image (bytes, or a signed URL with Accept: application/json).",
|
|
1644
1667
|
auth: "bearer",
|
|
1645
|
-
credits: "1 per call (cached or generated)",
|
|
1668
|
+
credits: "0 on a plan: counts one vehicle image (vehicle, color, angle) for the UTC month, and a new vehicle view when the angle is not prepared yet; the same image again this month adds nothing. Legacy credit meter: 1 per call (cached or generated)",
|
|
1646
1669
|
params: [
|
|
1647
1670
|
"make (required unless vehicle is given)",
|
|
1648
1671
|
"model (required unless vehicle is given)",
|
|
@@ -1656,12 +1679,12 @@ export const API_REFERENCE = [
|
|
|
1656
1679
|
"background (transparent default; white|black|hex such as f4f4f4; jpg defaults to white)",
|
|
1657
1680
|
`framing (${FRAMINGS.join("|")}; a preset, never with trim or padding: tight = trim=1, balanced = trim=1&padding=6, consistent = neither, the default)`,
|
|
1658
1681
|
`trim (1 crops to the car's alpha bounds before sizing), padding (0-${MAX_PADDING_PERCENT} percent, only with trim)`,
|
|
1659
|
-
"shadow (1 adds a soft ground shadow under the car, from its cut-out; same
|
|
1682
|
+
"shadow (1 adds a soft ground shadow under the car, from its cut-out; same image, nothing extra)",
|
|
1660
1683
|
`format (${FORMATS.join("|")}|auto; default png; auto negotiates webp/png from Accept)`,
|
|
1661
1684
|
],
|
|
1662
|
-
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}",
|
|
1663
|
-
errors: ["400 invalid params (also vehicle together with make/model/year)", "401 missing/invalid key", "402
|
|
1664
|
-
notes: "On 402 hand the human checkout_url with the price; buy only when they ask or a spending mandate they set covers it. Respect Retry-After on 429.",
|
|
1685
|
+
returns: "image bytes; headers X-Credits-Charged (0 on a plan), X-Vehicle-Images-Used, X-Vehicle-Images-Included, X-New-Views-Used, X-New-Views-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}, new_views:{used,included}} (credit meter: {credits_charged,credits_remaining}), request_id}",
|
|
1686
|
+
errors: ["400 invalid params (also vehicle together with make/model/year)", "401 missing/invalid key", "402 plan_image_limit or plan_new_view_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)"],
|
|
1687
|
+
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.",
|
|
1665
1688
|
sdk: "client.getImage({ make, model, year, view, color, size, width, height, fit, background, framing, trim, padding, shadow, format }) / client.getImage({ vehicle: 'veh_…', color: '#1a2b3c' }) / client.getImageUrl(...)",
|
|
1666
1689
|
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",
|
|
1667
1690
|
},
|
|
@@ -1670,21 +1693,32 @@ export const API_REFERENCE = [
|
|
|
1670
1693
|
path: "/api/v1/image-urls",
|
|
1671
1694
|
summary: "Create 1-50 signed delivery URLs for browsers (no key needed to load them).",
|
|
1672
1695
|
auth: "bearer",
|
|
1673
|
-
credits: "
|
|
1674
|
-
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
|
|
1675
|
-
returns: "201 {data:[{id,url,expires_at,max_uses,renews_until,vehicle:{vehicle_id,…}}], billing:{charged_on:'creation',credits_charged,
|
|
1676
|
-
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"],
|
|
1696
|
+
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",
|
|
1697
|
+
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)"],
|
|
1698
|
+
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},new_views:{used,included},renewal?} (credit meter: credits_charged,credits_remaining,credits_per_url), request_id}; a replay carries Idempotent-Replayed: true",
|
|
1699
|
+
errors: ["400 invalid body or batch > 50", "401", "402 plan_image_limit or plan_new_view_limit (nothing counted)", "404 vehicle not in catalog", "409 same Idempotency-Key still in flight", "422 same Idempotency-Key with a different body", "429"],
|
|
1677
1700
|
sdk: "client.createImageUrls([{ make, model, year, ...sizing }, { vehicle: 'veh_…' }], { ttlSeconds, maxUses, renew, renewDays, idempotencyKey })",
|
|
1678
1701
|
cli: "car-image url --make BMW --model M3 --year 2022 --ttl 86400 [--renew] [--idempotency-key <key>]",
|
|
1679
1702
|
},
|
|
1703
|
+
{
|
|
1704
|
+
method: "POST",
|
|
1705
|
+
path: "/api/v1/images/availability",
|
|
1706
|
+
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 or a new vehicle view this month, 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.",
|
|
1707
|
+
auth: "bearer",
|
|
1708
|
+
credits: "free",
|
|
1709
|
+
params: ["images: [{vehicle | make, model, year, view?, color?, …}] (1-200 image objects, as POST /api/v1/image-urls takes)"],
|
|
1710
|
+
returns: "200 {data:{object:'image_availability_check', images:[{index,prepared,counts_new_view,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}, new_views:{used,included,would_add,fits}}|null}, request_id}",
|
|
1711
|
+
errors: ["400 invalid_body or invalid_params (index)", "401", "404 vehicle_not_found (index)"],
|
|
1712
|
+
sdk: "client.checkAvailability([{ vehicle: 'veh_…', view: 'front', color: 'red' }])",
|
|
1713
|
+
},
|
|
1680
1714
|
{
|
|
1681
1715
|
method: "GET",
|
|
1682
1716
|
path: "/api/v1/delivery/{token}",
|
|
1683
|
-
summary: "Redeem a signed URL; public within its TTL and max_uses. An auto-renewing URL loaded after its TTL
|
|
1717
|
+
summary: "Redeem a signed URL; public within its TTL and max_uses. An auto-renewing URL loaded after its TTL renews for a new window on first load (1 credit on the legacy credit meter).",
|
|
1684
1718
|
auth: "public",
|
|
1685
|
-
credits: "free
|
|
1719
|
+
credits: "free; legacy credit meter: 1 per new window of a renewable URL",
|
|
1686
1720
|
returns: "image bytes with public Cache-Control for the remaining window",
|
|
1687
|
-
errors: ["403 expired, revoked or invalid token", "402 renewal unpaid (resumes once
|
|
1721
|
+
errors: ["403 expired, revoked or invalid token", "402 renewal unpaid (legacy credit meter; resumes once the account subscribes)", "410 exhausted"],
|
|
1688
1722
|
},
|
|
1689
1723
|
{
|
|
1690
1724
|
method: "GET",
|
|
@@ -1692,7 +1726,7 @@ export const API_REFERENCE = [
|
|
|
1692
1726
|
summary: "Views, colors, sizes, formats, pricing and catalog coverage.",
|
|
1693
1727
|
auth: "public",
|
|
1694
1728
|
credits: "free",
|
|
1695
|
-
returns: "{data:{views:[{id,label,yaw_degrees,description,aliases}], colors:[{name,hex}], paint:{parameter,custom,example}, sizes:{presets,max,source}, fits, default_fit, framings, default_framing, backgrounds, trim, formats, pricing:{credits_per_image,
|
|
1729
|
+
returns: "{data:{views:[{id,label,yaw_degrees,description,aliases}], colors:[{name,hex}], paint:{parameter,custom,example}, sizes:{presets,max,source}, fits, default_fit, framings, default_framing, backgrounds, trim, formats, pricing:{credits_per_image (0 on a plan),free_credits,plans}, catalog:{makes,models,years,sources}, vehicle_ids:{description,example,lookup,parameter}}}",
|
|
1696
1730
|
sdk: "client.options()",
|
|
1697
1731
|
cli: "car-image options",
|
|
1698
1732
|
},
|
|
@@ -1828,29 +1862,29 @@ export const API_REFERENCE = [
|
|
|
1828
1862
|
{
|
|
1829
1863
|
method: "GET",
|
|
1830
1864
|
path: "/api/v1/account",
|
|
1831
|
-
summary: "
|
|
1865
|
+
summary: "Plan and renewal (plan.meter: vehicle_images, or credits for accounts that paid before 2026-10-25), this month's vehicle images and new vehicle views against the plan, credits (for 3D models, logos and upgrades), the next plan with its checkout link, payment method, 30-day usage, key scopes.",
|
|
1832
1866
|
auth: "bearer",
|
|
1833
1867
|
credits: "free",
|
|
1834
|
-
returns: "{data:{credits, auto_reload, has_payment_method, plan, pricing, usage_30d:{requests,images,cache_hit_rate}, limits_usage:{period, distinct_vehicles_this_month:{used,limit,remaining}, 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}",
|
|
1868
|
+
returns: "{data:{credits, auto_reload, has_payment_method, plan:{…, meter, limits:{images_per_month,new_views_per_month,…}}, pricing, usage_30d:{requests,images,cache_hit_rate}, limits_usage:{period, meter, vehicle_images_this_month:{used,limit,remaining}|null, new_views_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}",
|
|
1835
1869
|
sdk: "client.account()",
|
|
1836
1870
|
cli: "car-image whoami (alias: account)",
|
|
1837
1871
|
},
|
|
1838
1872
|
{
|
|
1839
1873
|
method: "POST",
|
|
1840
1874
|
path: "/api/v1/billing/checkout",
|
|
1841
|
-
summary: "Hosted Stripe Checkout URL for a
|
|
1875
|
+
summary: "Hosted Stripe Checkout URL for Pro or Business, or an in-place switch for an account already on a Stripe plan. Credits are not sold: {credits} answers 409 subscription_required_for_credits.",
|
|
1842
1876
|
auth: "bearer",
|
|
1843
1877
|
credits: "free (scope billing:write; CLI keys have it)",
|
|
1844
|
-
params: ["
|
|
1845
|
-
returns: "201 {data:{url,
|
|
1878
|
+
params: ["plan (pro|business)", "interval (month|year; default month)"],
|
|
1879
|
+
returns: "201 {data:{url,session_id,plan,interval,amount_cents}} | 200 {data:{url:null,changed:true,…}}",
|
|
1846
1880
|
notes: "A human must complete the purchase in the browser. Agents must not initiate purchases without explicit approval.",
|
|
1847
|
-
sdk: "client.
|
|
1848
|
-
cli: "car-image
|
|
1881
|
+
sdk: "client.createPlanCheckout('pro', 'month')",
|
|
1882
|
+
cli: "car-image upgrade --plan pro",
|
|
1849
1883
|
},
|
|
1850
1884
|
{
|
|
1851
1885
|
method: "POST",
|
|
1852
1886
|
path: "/api/v1/billing/portal",
|
|
1853
|
-
summary: "Stripe Customer Portal URL (invoices, cards,
|
|
1887
|
+
summary: "Stripe Customer Portal URL (invoices, cards, plan).",
|
|
1854
1888
|
auth: "bearer",
|
|
1855
1889
|
credits: "free (scope billing:write)",
|
|
1856
1890
|
returns: "201 {data:{url}}",
|
|
@@ -1905,7 +1939,7 @@ export function formatApiReference(filter) {
|
|
|
1905
1939
|
const header = [
|
|
1906
1940
|
`Car Image API — base URL ${DEFAULT_BASE_URL}`,
|
|
1907
1941
|
`Auth: Authorization: Bearer cimg_… (never in URLs). Errors: application/problem+json {type,title,status,detail,request_id}.`,
|
|
1908
|
-
`Pricing:
|
|
1942
|
+
`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) and new vehicle views (angles the catalog prepares first); images cost no credits. Free: ${PLAN_ALLOWANCES.free.vehicleImages} vehicle images and ${PLAN_ALLOWANCES.free.newViews} new views a month, ${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.newViews.toLocaleString("en-US")} new views, ${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.newViews.toLocaleString("en-US")} new views, ${PLAN_ALLOWANCES.business.creditsPerMonth.toLocaleString("en-US")} credits. No overage: past an allowance new images answer 402 until the 1st (UTC). Credits are not sold and pay for 3D models (${MODEL_3D_PRICE.split(" (")[0]}), make logos (1) and upgrades (20). Image Packs are one-time and self-hosted for good. GET /api/v1/pricing has live prices.`,
|
|
1909
1943
|
`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).`,
|
|
1910
1944
|
"",
|
|
1911
1945
|
];
|
|
@@ -1955,7 +1989,7 @@ export function nextStepFor(status) {
|
|
|
1955
1989
|
case 401:
|
|
1956
1990
|
return "The API key is missing or invalid. Set CAR_IMAGE_API_KEY (or run `car-image login`); never paste keys into prompts.";
|
|
1957
1991
|
case 402:
|
|
1958
|
-
return `
|
|
1992
|
+
return `Payment required; nothing was charged. Stop. With code plan_image_limit or plan_new_view_limit the month's allowance is used (images already received keep serving; it resets at resets_at): 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.`;
|
|
1959
1993
|
case 403:
|
|
1960
1994
|
return "This key lacks the required scope. Ask the human to create a key with the right scopes in the dashboard.";
|
|
1961
1995
|
case 404:
|