@meterapp/car-image-sdk 1.33.0 → 1.35.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 +33 -19
- package/dist/client.d.ts +34 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +61 -25
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +28 -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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +41 -26
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +96 -65
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/support.d.ts +20 -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 +6 -6
- package/dist/packs.d.ts.map +1 -1
- package/dist/support.d.ts +36 -15
- package/dist/support.d.ts.map +1 -1
- package/dist/types.d.ts +152 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +31 -3
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +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
|
|
185
|
+
For an image in chat, call get_car_image with vehicle: "veh_…", view and color (width: 960, height: 600, trim: true, padding: 8, background: "#f4f4f4" suits a chat). The host shows the returned picture inline: name the vehicle, view and color in a line, and do not mint a URL for the same image. In a terminal, or where tool images reach only you, call create_car_image_urls once instead (ttl_seconds: 604800, max_uses: 0) and put its markdown, or its URL as a link, in the reply. Pages, apps, emails and documents use signed URLs (create_car_image_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,10 @@ 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 after this call. */
|
|
926
|
+
vehicle_images: meterCountSchema.optional(),
|
|
922
927
|
source: z.enum(["cache", "generated"]).nullable(),
|
|
923
928
|
width: z.number().int().nullable(),
|
|
924
929
|
height: z.number().int().nullable(),
|
|
@@ -937,15 +942,18 @@ export const MCP_TOOL_OUTPUT_SCHEMAS = {
|
|
|
937
942
|
expires_at: z.string(),
|
|
938
943
|
/** 0 means unlimited redemptions until it expires. */
|
|
939
944
|
max_uses: z.number().int(),
|
|
940
|
-
/** Auto-renewing URLs keep serving,
|
|
945
|
+
/** Auto-renewing URLs keep serving, renewing in each opened window, until this instant. */
|
|
941
946
|
renews_until: z.string().nullable().optional(),
|
|
942
947
|
vehicle: vehicleDescriptorSchema,
|
|
943
948
|
})),
|
|
944
949
|
billing: z.looseObject({
|
|
945
950
|
charged_on: z.literal("creation"),
|
|
946
951
|
credits_charged: z.number(),
|
|
947
|
-
|
|
948
|
-
|
|
952
|
+
/** Legacy credit meter only. */
|
|
953
|
+
credits_remaining: z.number().optional(),
|
|
954
|
+
/** Vehicle-image meter: the month's vehicle images after this call. */
|
|
955
|
+
vehicle_images: meterCountSchema.optional(),
|
|
956
|
+
renewal: z.looseObject({ window_seconds: z.number(), credits_per_window: z.number().optional(), until: z.string() }).nullable().optional(),
|
|
949
957
|
}),
|
|
950
958
|
request_id: z.string(),
|
|
951
959
|
/** True when a retry was answered from the result stored for its idempotency_key; nothing was billed again. */
|
|
@@ -1238,10 +1246,17 @@ export function webhooksSummary(result) {
|
|
|
1238
1246
|
export const LOW_BALANCE_CREDITS = 10;
|
|
1239
1247
|
/** The one-line summary both servers put above an account: the balance in dollars, the plan, and a stop when it runs low. */
|
|
1240
1248
|
export function accountSummary(data) {
|
|
1249
|
+
const images = data.limits_usage?.vehicle_images_this_month;
|
|
1250
|
+
if (data.limits_usage?.meter === "vehicle_images" && images) {
|
|
1251
|
+
const of = (usage) => `${usage.used.toLocaleString("en-US")} of ${usage.limit === null ? "unlimited" : usage.limit.toLocaleString("en-US")}`;
|
|
1252
|
+
const full = (usage) => Boolean(usage && usage.limit !== null && usage.used >= usage.limit);
|
|
1253
|
+
const stop = full(images) ? " The allowance is used up: images already received this month still serve; ask the human before asking for new ones." : "";
|
|
1254
|
+
return `${data.plan ? `${data.plan.name} plan: ` : ""}${of(images)} vehicle images used this month; every image serves as often as needed in any size.${stop}`;
|
|
1255
|
+
}
|
|
1241
1256
|
const perDollar = data.pricing?.credits_per_dollar ?? CREDITS_PER_DOLLAR;
|
|
1242
1257
|
const perImage = data.pricing?.credits_per_image ?? CREDITS_PER_IMAGE;
|
|
1243
1258
|
const vehicles = data.plan?.limits.vehicles_per_month ?? null;
|
|
1244
|
-
const used = data.limits_usage?.distinct_vehicles_this_month
|
|
1259
|
+
const used = data.limits_usage?.distinct_vehicles_this_month?.used;
|
|
1245
1260
|
const plan = data.plan
|
|
1246
1261
|
? ` 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
1262
|
: "";
|
|
@@ -1261,9 +1276,9 @@ export function resolveSummary(data) {
|
|
|
1261
1276
|
const otherYear = typeof asked === "number" && Number(data.params.year) !== asked
|
|
1262
1277
|
? ` 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
1278
|
: "";
|
|
1264
|
-
const caution = data.confidence === "low" ? " Confidence is low: confirm with the human before
|
|
1279
|
+
const caution = data.confidence === "low" ? " Confidence is low: confirm with the human before making an image." : "";
|
|
1265
1280
|
const id = data.params.vehicle_id;
|
|
1266
|
-
const render = `how it with
|
|
1281
|
+
const render = `how it with get_car_image (in chat; create_car_image_urls for a page, app, email or document, or in a terminal), passing vehicle: "${id}", view: "${data.params.view}" and color: "${data.params.color}".`;
|
|
1267
1282
|
const next = id ? (otherYear || caution ? ` Once they agree, s${render}` : ` S${render}`) : "";
|
|
1268
1283
|
return `Resolved to ${make} ${model} ${data.params.year}, view ${data.params.view}, color ${data.params.color} (confidence ${data.confidence}).${otherYear}${caution}${next}`;
|
|
1269
1284
|
}
|
|
@@ -1308,18 +1323,23 @@ export function withImageMarkdown(result) {
|
|
|
1308
1323
|
export function imageUrlsSummary(result) {
|
|
1309
1324
|
const count = result.data.length;
|
|
1310
1325
|
const urls = `${count} signed URL${count === 1 ? "" : "s"}`;
|
|
1311
|
-
const
|
|
1326
|
+
const images = result.billing.vehicle_images;
|
|
1327
|
+
const charged = images
|
|
1328
|
+
? `${images.used.toLocaleString("en-US")} of ${images.included === null ? "unlimited" : images.included.toLocaleString("en-US")} vehicle images used this month`
|
|
1329
|
+
: `${result.billing.credits_charged} credit${result.billing.credits_charged === 1 ? "" : "s"}`;
|
|
1312
1330
|
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}` : ""}`;
|
|
1331
|
+
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
1332
|
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
1333
|
return result.idempotent_replayed
|
|
1316
|
-
? `Replayed the result stored for this idempotency_key: ${urls}, charged ${charged} the first time and nothing now. ${display}`
|
|
1317
|
-
:
|
|
1334
|
+
? `Replayed the result stored for this idempotency_key: ${urls}, ${images ? charged : `charged ${charged} the first time and nothing now`}. ${display}`
|
|
1335
|
+
: images
|
|
1336
|
+
? `Created ${urls}; ${charged}. Each image serves as often as needed this month. ${display}`
|
|
1337
|
+
: `Created ${urls}; charged ${charged}, ${result.billing.credits_remaining} remaining. ${display}`;
|
|
1318
1338
|
}
|
|
1319
1339
|
export const MCP_TOOLS = {
|
|
1320
1340
|
get_pricing: {
|
|
1321
1341
|
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
|
|
1342
|
+
description: "Free, no account needed. The pricing document: every plan's monthly and yearly price, its vehicle images 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
1343
|
inputSchema: MCP_TOOL_SCHEMAS.get_pricing, outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_pricing,
|
|
1324
1344
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
1325
1345
|
},
|
|
@@ -1331,7 +1351,7 @@ export const MCP_TOOLS = {
|
|
|
1331
1351
|
},
|
|
1332
1352
|
create_checkout_link: {
|
|
1333
1353
|
name: "create_checkout_link", title: "Create a checkout link",
|
|
1334
|
-
description: "Free. On the human's request, prepare a
|
|
1354
|
+
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
1355
|
inputSchema: MCP_TOOL_SCHEMAS.create_checkout_link, outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.create_checkout_link,
|
|
1336
1356
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1337
1357
|
},
|
|
@@ -1370,7 +1390,7 @@ export const MCP_TOOLS = {
|
|
|
1370
1390
|
get_car_image: {
|
|
1371
1391
|
name: "get_car_image",
|
|
1372
1392
|
title: "Get car image bytes",
|
|
1373
|
-
description: `
|
|
1393
|
+
description: `Show a vehicle in chat: returns the image as an MCP image the host displays inline with the result, and the bytes for a file. Name the vehicle, view and color in the reply; do not also mint a signed URL for the same image. Where the person cannot see tool images (a terminal), use create_car_image_urls instead. Counts one vehicle image (vehicle, color, angle) for the month on the account's plan, prepared yet or not; 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 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 web pages, apps, emails and documents, and in a terminal. Do not call both paid tools for one image.`,
|
|
1374
1394
|
inputSchema: MCP_TOOL_SCHEMAS.get_car_image,
|
|
1375
1395
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_car_image,
|
|
1376
1396
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
@@ -1378,7 +1398,7 @@ export const MCP_TOOLS = {
|
|
|
1378
1398
|
create_car_image_urls: {
|
|
1379
1399
|
name: "create_car_image_urls",
|
|
1380
1400
|
title: "Create signed car image URLs",
|
|
1381
|
-
description: "
|
|
1401
|
+
description: "Put vehicle images into web pages, apps, emails and documents: create 1-50 key-free signed URLs a browser loads directly (<img src>), each with ready-to-display Markdown. To show a vehicle in chat, use get_car_image instead: the host displays it inline. Use these URLs in chat only where tool images do not reach the person (a terminal) or the human asks for a link: then paste each returned markdown in the final reply, outside code fences (or link the URL where images do not render), with ttl_seconds 604800, max_uses 0 and renewal off unless requested. Reuse unexpired URLs; never mint twice for one image. 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 HTML, Markdown files, documents, emails and websites. State expiry briefly.",
|
|
1382
1402
|
inputSchema: MCP_TOOL_SCHEMAS.create_car_image_urls,
|
|
1383
1403
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.create_car_image_urls,
|
|
1384
1404
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
@@ -1409,8 +1429,8 @@ export const MCP_TOOLS = {
|
|
|
1409
1429
|
},
|
|
1410
1430
|
get_account: {
|
|
1411
1431
|
name: "get_account",
|
|
1412
|
-
title: "Get account
|
|
1413
|
-
description:
|
|
1432
|
+
title: "Get account",
|
|
1433
|
+
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
1434
|
inputSchema: MCP_TOOL_SCHEMAS.get_account,
|
|
1415
1435
|
outputSchema: MCP_TOOL_OUTPUT_SCHEMAS.get_account,
|
|
1416
1436
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
@@ -1634,15 +1654,15 @@ export const API_REFERENCE = [
|
|
|
1634
1654
|
cli: "car-image logo --make Toyota --width 256 --out toyota-logo.png",
|
|
1635
1655
|
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
1656
|
},
|
|
1637
|
-
{ method: "GET", path: "/api/v1/pricing", summary: "The pricing document: plans (price, included credits, limits, features, checkout_url),
|
|
1657
|
+
{ method: "GET", path: "/api/v1/pricing", summary: "The pricing document: plans (price, vehicle images 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
1658
|
{ 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: ["
|
|
1659
|
+
{ 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
1660
|
{
|
|
1641
1661
|
method: "GET",
|
|
1642
1662
|
path: "/api/v1/images/car",
|
|
1643
|
-
summary: "Get a
|
|
1663
|
+
summary: "Get a vehicle image (bytes, or a signed URL with Accept: application/json).",
|
|
1644
1664
|
auth: "bearer",
|
|
1645
|
-
credits: "1 per call (cached or generated)",
|
|
1665
|
+
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
1666
|
params: [
|
|
1647
1667
|
"make (required unless vehicle is given)",
|
|
1648
1668
|
"model (required unless vehicle is given)",
|
|
@@ -1656,12 +1676,12 @@ export const API_REFERENCE = [
|
|
|
1656
1676
|
"background (transparent default; white|black|hex such as f4f4f4; jpg defaults to white)",
|
|
1657
1677
|
`framing (${FRAMINGS.join("|")}; a preset, never with trim or padding: tight = trim=1, balanced = trim=1&padding=6, consistent = neither, the default)`,
|
|
1658
1678
|
`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
|
|
1679
|
+
"shadow (1 adds a soft ground shadow under the car, from its cut-out; same image, nothing extra)",
|
|
1660
1680
|
`format (${FORMATS.join("|")}|auto; default png; auto negotiates webp/png from Accept)`,
|
|
1661
1681
|
],
|
|
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.",
|
|
1682
|
+
returns: "image bytes; headers X-Credits-Charged (0 on a plan), X-Vehicle-Images-Used, X-Vehicle-Images-Included (a number or unlimited; X-Credits-Remaining instead on the legacy credit meter), X-Image-Source (cache|generated), X-Image-Width, X-Image-Height, ETag, X-Request-Id (Vary: Accept with format=auto). With Accept: application/json: {data:{url,expires_at,vehicle:{vehicle_id,make,model,year,view,color,…},width,height,format}, billing:{credits_charged:0, vehicle_images:{used,included}} (credit meter: {credits_charged,credits_remaining}), request_id}",
|
|
1683
|
+
errors: ["400 invalid params (also vehicle together with make/model/year)", "401 missing/invalid key", "402 plan_image_limit (used, included, requested, resets_at, pack_url, checkout_url; nothing charged; legacy credit meter: insufficient credits)", "404 vehicle not in catalog or unknown vehicle id", "429 rate limited (Retry-After)", "502 render failed (refunded)", "503 generation_at_capacity: new renders resume at reset_at (Retry-After; nothing charged)"],
|
|
1684
|
+
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
1685
|
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
1686
|
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
1687
|
},
|
|
@@ -1670,21 +1690,32 @@ export const API_REFERENCE = [
|
|
|
1670
1690
|
path: "/api/v1/image-urls",
|
|
1671
1691
|
summary: "Create 1-50 signed delivery URLs for browsers (no key needed to load them).",
|
|
1672
1692
|
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"],
|
|
1693
|
+
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",
|
|
1694
|
+
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)"],
|
|
1695
|
+
returns: "201 {data:[{id,url,expires_at,max_uses,renews_until,vehicle:{vehicle_id,…}}], billing:{charged_on:'creation',credits_charged:0,vehicle_images:{used,included},renewal?} (credit meter: credits_charged,credits_remaining,credits_per_url), request_id}; a replay carries Idempotent-Replayed: true",
|
|
1696
|
+
errors: ["400 invalid body or batch > 50", "401", "402 plan_image_limit (nothing counted)", "404 vehicle not in catalog", "409 same Idempotency-Key still in flight", "422 same Idempotency-Key with a different body", "429"],
|
|
1677
1697
|
sdk: "client.createImageUrls([{ make, model, year, ...sizing }, { vehicle: 'veh_…' }], { ttlSeconds, maxUses, renew, renewDays, idempotencyKey })",
|
|
1678
1698
|
cli: "car-image url --make BMW --model M3 --year 2022 --ttl 86400 [--renew] [--idempotency-key <key>]",
|
|
1679
1699
|
},
|
|
1700
|
+
{
|
|
1701
|
+
method: "POST",
|
|
1702
|
+
path: "/api/v1/images/availability",
|
|
1703
|
+
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.",
|
|
1704
|
+
auth: "bearer",
|
|
1705
|
+
credits: "free",
|
|
1706
|
+
params: ["images: [{vehicle | make, model, year, view?, color?, …}] (1-200 image objects, as POST /api/v1/image-urls takes)"],
|
|
1707
|
+
returns: "200 {data:{object:'image_availability_check', images:[{index,prepared,counts_image,vehicle:{id,make,model,year},view,color}], summary:{items,prepared,not_prepared}, allowance:{period:{month_start}, vehicle_images:{used,included,would_add,fits}}|null}, request_id}",
|
|
1708
|
+
errors: ["400 invalid_body or invalid_params (index)", "401", "404 vehicle_not_found (index)"],
|
|
1709
|
+
sdk: "client.checkAvailability([{ vehicle: 'veh_…', view: 'front', color: 'red' }])",
|
|
1710
|
+
},
|
|
1680
1711
|
{
|
|
1681
1712
|
method: "GET",
|
|
1682
1713
|
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
|
|
1714
|
+
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
1715
|
auth: "public",
|
|
1685
|
-
credits: "free
|
|
1716
|
+
credits: "free; legacy credit meter: 1 per new window of a renewable URL",
|
|
1686
1717
|
returns: "image bytes with public Cache-Control for the remaining window",
|
|
1687
|
-
errors: ["403 expired, revoked or invalid token", "402 renewal unpaid (resumes once
|
|
1718
|
+
errors: ["403 expired, revoked or invalid token", "402 renewal unpaid (legacy credit meter; resumes once the account subscribes)", "410 exhausted"],
|
|
1688
1719
|
},
|
|
1689
1720
|
{
|
|
1690
1721
|
method: "GET",
|
|
@@ -1692,7 +1723,7 @@ export const API_REFERENCE = [
|
|
|
1692
1723
|
summary: "Views, colors, sizes, formats, pricing and catalog coverage.",
|
|
1693
1724
|
auth: "public",
|
|
1694
1725
|
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,
|
|
1726
|
+
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
1727
|
sdk: "client.options()",
|
|
1697
1728
|
cli: "car-image options",
|
|
1698
1729
|
},
|
|
@@ -1828,29 +1859,29 @@ export const API_REFERENCE = [
|
|
|
1828
1859
|
{
|
|
1829
1860
|
method: "GET",
|
|
1830
1861
|
path: "/api/v1/account",
|
|
1831
|
-
summary: "
|
|
1862
|
+
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
1863
|
auth: "bearer",
|
|
1833
1864
|
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}",
|
|
1865
|
+
returns: "{data:{credits, auto_reload, has_payment_method, plan:{…, meter, limits:{images_per_month,…}}, pricing, usage_30d:{requests,images,cache_hit_rate}, limits_usage:{period, meter, vehicle_images_this_month:{used,limit,remaining}|null, distinct_vehicles_this_month:{used,limit,remaining}|null (credit meter), api_keys:{used,limit,remaining}, requests_per_minute_per_key, requests_per_minute_per_account}, renews_at, next_plan:{id,name,price,adds,checkout_url}, key:{prefix,scopes}}, links, request_id}",
|
|
1835
1866
|
sdk: "client.account()",
|
|
1836
1867
|
cli: "car-image whoami (alias: account)",
|
|
1837
1868
|
},
|
|
1838
1869
|
{
|
|
1839
1870
|
method: "POST",
|
|
1840
1871
|
path: "/api/v1/billing/checkout",
|
|
1841
|
-
summary: "Hosted Stripe Checkout URL for a
|
|
1872
|
+
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
1873
|
auth: "bearer",
|
|
1843
1874
|
credits: "free (scope billing:write; CLI keys have it)",
|
|
1844
|
-
params: ["
|
|
1845
|
-
returns: "201 {data:{url,
|
|
1875
|
+
params: ["plan (pro|business)", "interval (month|year; default month)"],
|
|
1876
|
+
returns: "201 {data:{url,session_id,plan,interval,amount_cents}} | 200 {data:{url:null,changed:true,…}}",
|
|
1846
1877
|
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
|
|
1878
|
+
sdk: "client.createPlanCheckout('pro', 'month')",
|
|
1879
|
+
cli: "car-image upgrade --plan pro",
|
|
1849
1880
|
},
|
|
1850
1881
|
{
|
|
1851
1882
|
method: "POST",
|
|
1852
1883
|
path: "/api/v1/billing/portal",
|
|
1853
|
-
summary: "Stripe Customer Portal URL (invoices, cards,
|
|
1884
|
+
summary: "Stripe Customer Portal URL (invoices, cards, plan).",
|
|
1854
1885
|
auth: "bearer",
|
|
1855
1886
|
credits: "free (scope billing:write)",
|
|
1856
1887
|
returns: "201 {data:{url}}",
|
|
@@ -1905,7 +1936,7 @@ export function formatApiReference(filter) {
|
|
|
1905
1936
|
const header = [
|
|
1906
1937
|
`Car Image API — base URL ${DEFAULT_BASE_URL}`,
|
|
1907
1938
|
`Auth: Authorization: Bearer cimg_… (never in URLs). Errors: application/problem+json {type,title,status,detail,request_id}.`,
|
|
1908
|
-
`Pricing:
|
|
1939
|
+
`Pricing: plans meter vehicle images (one vehicle in one color from one angle, counted once a UTC month, delivered as often as needed at any size, stored or prepared first); images cost no credits. Free: ${PLAN_ALLOWANCES.free.vehicleImages} vehicle images 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.creditsPerMonth.toLocaleString("en-US")} credits a month, commercial license while subscribed. Business $${PLAN_ALLOWANCES.business.monthlyUsd}/month: ${PLAN_ALLOWANCES.business.vehicleImages.toLocaleString("en-US")} images, ${PLAN_ALLOWANCES.business.creditsPerMonth.toLocaleString("en-US")} credits. No overage: past an allowance new images answer 402 until the 1st (UTC). 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
1940
|
`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
1941
|
"",
|
|
1911
1942
|
];
|
|
@@ -1955,7 +1986,7 @@ export function nextStepFor(status) {
|
|
|
1955
1986
|
case 401:
|
|
1956
1987
|
return "The API key is missing or invalid. Set CAR_IMAGE_API_KEY (or run `car-image login`); never paste keys into prompts.";
|
|
1957
1988
|
case 402:
|
|
1958
|
-
return `
|
|
1989
|
+
return `Payment required; nothing was charged. Stop. With code plan_image_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
1990
|
case 403:
|
|
1960
1991
|
return "This key lacks the required scope. Ask the human to create a key with the right scopes in the dashboard.";
|
|
1961
1992
|
case 404:
|