deepline 0.2.15 → 0.2.17

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.
@@ -77,6 +77,7 @@ import type {
77
77
  ToolMetadata,
78
78
  CustomerDbQueryResult,
79
79
  DeeplineAgentModelDescription,
80
+ InferenceQuote,
80
81
  } from './types.js';
81
82
  import type { MonitorDefinition } from './monitors.js';
82
83
  import type { PlayStagedFileRef } from './plays/local-file-discovery.js';
@@ -1919,6 +1920,22 @@ export class DeeplineClient {
1919
1920
  );
1920
1921
  }
1921
1922
 
1923
+ /**
1924
+ * Quote dynamic AI inference pricing for a concrete payload.
1925
+ *
1926
+ * The result separates a planning estimate from a proven authorization
1927
+ * maximum and contains Deepline credits only.
1928
+ */
1929
+ async quoteInferenceTool(
1930
+ toolId: 'ai_inference' | 'deeplineagent',
1931
+ payload: Record<string, unknown>,
1932
+ ): Promise<InferenceQuote> {
1933
+ return this.http.post<InferenceQuote>(
1934
+ `/api/v2/integrations/${encodeURIComponent(toolId)}/quote`,
1935
+ payload,
1936
+ );
1937
+ }
1938
+
1922
1939
  /**
1923
1940
  * Execute a tool and return the standard execution envelope.
1924
1941
  *
@@ -160,7 +160,7 @@ export const SDK_RELEASE = {
160
160
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
161
161
  // exposed storage-dependent synchronous access. This deliberate minor
162
162
  // release keeps lazy paging semantics independent of row residency.
163
- version: '0.2.15',
163
+ version: '0.2.17',
164
164
  contracts: {
165
165
  api: {
166
166
  name: 'sdk-http-api',
@@ -336,8 +336,51 @@ export interface DeeplineAgentModelDescription {
336
336
  };
337
337
  caveats: string[];
338
338
  sources: string[];
339
+ inferencePricing: InferenceDynamicPricingCapability;
339
340
  }
340
341
 
342
+ export interface InferenceDynamicPricingCapability {
343
+ settlement: 'actual_usage';
344
+ staticUnitPrice: null;
345
+ quoteEndpointTemplate: string;
346
+ supportedQualities: Array<'bounded_max' | 'estimate_only' | 'unavailable'>;
347
+ payloadFields: string[];
348
+ }
349
+
350
+ export type InferenceQuoteAssumptions = {
351
+ modelCallCount: number;
352
+ planningModelCallCount: number;
353
+ estimatedInputTokens: number;
354
+ estimatedOutputTokens: number;
355
+ maxOutputTokens: number | null;
356
+ candidateRouteCount: number;
357
+ pricedRouteCount: number;
358
+ inputBound: 'proven_request_tokens' | 'catalog_context' | 'not_proven';
359
+ inputBoundProofId?: string;
360
+ };
361
+
362
+ export type InferenceQuote = {
363
+ quality: 'bounded_max' | 'estimate_only' | 'unavailable';
364
+ estimate:
365
+ | {
366
+ quality: 'estimate_only';
367
+ credits: number;
368
+ assumptions: InferenceQuoteAssumptions;
369
+ }
370
+ | { quality: 'unavailable'; assumptions: InferenceQuoteAssumptions };
371
+ authorization:
372
+ | {
373
+ quality: 'bounded_max';
374
+ maximumCredits: number;
375
+ assumptions: InferenceQuoteAssumptions;
376
+ }
377
+ | {
378
+ quality: 'estimate_only' | 'unavailable';
379
+ assumptions: InferenceQuoteAssumptions;
380
+ };
381
+ settlement: 'actual_usage';
382
+ };
383
+
341
384
  /**
342
385
  * Query options for ranked tool/provider discovery.
343
386
  */
@@ -1,3 +1,5 @@
1
+ import { ToolExecutionError } from '../tool-execution-error';
2
+
1
3
  const CLOUDFLARE_DURABLE_OBJECT_RESET_RE =
2
4
  /Durable Object.*(?:code (?:was|has been) updated|storage caused object)/;
3
5
  const CLOUDFLARE_WORKER_SUBREQUEST_LIMIT_RE =
@@ -280,6 +282,20 @@ function toErrorText(error: unknown): string {
280
282
  export function normalizePlayRunFailure(error: unknown): PlayRunFailureDetails {
281
283
  const rawCause = toErrorText(error);
282
284
  const cause = boundedFailureText(rawCause);
285
+ if (
286
+ error instanceof ToolExecutionError &&
287
+ error.origin === 'deepline' &&
288
+ error.category === 'billing' &&
289
+ error.code !== 'BILLING_UNAVAILABLE'
290
+ ) {
291
+ return {
292
+ code: error.code?.trim() || 'BILLING_DENIED',
293
+ phase: 'billing',
294
+ message: cause,
295
+ retryable: false,
296
+ cause,
297
+ };
298
+ }
283
299
  if (
284
300
  (error &&
285
301
  typeof error === 'object' &&
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,7 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.15",
1047
+ version: "0.2.17",
1048
1048
  contracts: {
1049
1049
  api: {
1050
1050
  name: "sdk-http-api",
@@ -4040,6 +4040,18 @@ var DeeplineClient = class {
4040
4040
  }
4041
4041
  );
4042
4042
  }
4043
+ /**
4044
+ * Quote dynamic AI inference pricing for a concrete payload.
4045
+ *
4046
+ * The result separates a planning estimate from a proven authorization
4047
+ * maximum and contains Deepline credits only.
4048
+ */
4049
+ async quoteInferenceTool(toolId, payload) {
4050
+ return this.http.post(
4051
+ `/api/v2/integrations/${encodeURIComponent(toolId)}/quote`,
4052
+ payload
4053
+ );
4054
+ }
4043
4055
  /**
4044
4056
  * Execute a tool and return the standard execution envelope.
4045
4057
  *
@@ -7787,6 +7799,7 @@ async function handleUsage(options) {
7787
7799
  const params = new URLSearchParams();
7788
7800
  if (options.limit) params.set("recent_limit", options.limit);
7789
7801
  if (options.offset) params.set("recent_offset", options.offset);
7802
+ if (options.cursor) params.set("recent_cursor", options.cursor);
7790
7803
  if (options.runId) params.set("run_id", options.runId);
7791
7804
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
7792
7805
  const payload = await http.get(
@@ -7804,7 +7817,10 @@ async function handleUsage(options) {
7804
7817
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
7805
7818
  ...recentUsageLines(
7806
7819
  Array.isArray(recent.entries) ? recent.entries : []
7807
- )
7820
+ ),
7821
+ ...typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? [
7822
+ `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}`
7823
+ ] : []
7808
7824
  ];
7809
7825
  printCommandEnvelope(
7810
7826
  {
@@ -8527,14 +8543,17 @@ Examples:
8527
8543
  `
8528
8544
  Notes:
8529
8545
  Read-only. Shows last-30-day Deepline credit usage plus a bounded recent-call
8530
- page. Use --limit/--offset to paginate the recent-call section.
8546
+ page. Use --limit/--cursor to paginate the recent-call section.
8531
8547
 
8532
8548
  Examples:
8533
8549
  deepline billing usage
8534
- deepline billing usage --limit 50 --offset 50 --json
8550
+ deepline billing usage --limit 50 --cursor <next_cursor> --json
8535
8551
  deepline billing usage --run-id play/example/run/20260630t120000-000-abcdef --json
8536
8552
  `
8537
- ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8553
+ ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option(
8554
+ "--cursor <cursor>",
8555
+ "Recent-call cursor from the previous response"
8556
+ ).option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8538
8557
  billing.command("limit").description("Show configured monthly limit state.").addHelpText(
8539
8558
  "after",
8540
8559
  `
@@ -32998,11 +33017,15 @@ Examples:
32998
33017
  deepline tools describe hunter_email_verifier --examples-only
32999
33018
  deepline tools describe hunter_email_verifier --json
33000
33019
  deepline tools describe deeplineagent --model openai/gpt-5.5 --json
33020
+ deepline tools describe ai_inference --estimate-payload @payload.json --json
33001
33021
  deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
33002
33022
  `
33003
33023
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").option(
33004
33024
  "--model <model>",
33005
33025
  "For deeplineagent, include AI Gateway model/provider option metadata"
33026
+ ).option(
33027
+ "--estimate-payload <payload>",
33028
+ "Quote an ai_inference or deeplineagent JSON payload (inline or @file)"
33006
33029
  ).option("--pricing-only", "Only print pricing and billing semantics").option("--schema-only", "Only print input schema fields").option(
33007
33030
  "--examples-only",
33008
33031
  "Only print runnable examples and sample payloads"
@@ -33025,7 +33048,8 @@ Examples:
33025
33048
  schemaOnly: Boolean(options.schemaOnly),
33026
33049
  examplesOnly: Boolean(options.examplesOnly),
33027
33050
  gettersOnly: Boolean(options.gettersOnly),
33028
- model: typeof options.model === "string" ? options.model : void 0
33051
+ model: typeof options.model === "string" ? options.model : void 0,
33052
+ estimatePayload: typeof options.estimatePayload === "string" ? options.estimatePayload : void 0
33029
33053
  });
33030
33054
  });
33031
33055
  addToolMetadataCommand(tools.command("describe <toolId>").alias("get"));
@@ -33099,6 +33123,23 @@ async function getTool(toolId, options = {}) {
33099
33123
  }
33100
33124
  throw error;
33101
33125
  }
33126
+ let inferenceQuote = null;
33127
+ if (options.estimatePayload) {
33128
+ if (toolId !== "deeplineagent" && toolId !== "ai_inference") {
33129
+ console.error(
33130
+ "--estimate-payload is only supported for deeplineagent and ai_inference."
33131
+ );
33132
+ return 2;
33133
+ }
33134
+ const estimatePayload = parseJsonObjectArgument(
33135
+ options.estimatePayload,
33136
+ "--estimate-payload"
33137
+ );
33138
+ if (options.model && estimatePayload.model === void 0) {
33139
+ estimatePayload.model = options.model;
33140
+ }
33141
+ inferenceQuote = await client2.quoteInferenceTool(toolId, estimatePayload);
33142
+ }
33102
33143
  const modelDescription = options.model && (toolId === "deeplineagent" || toolId === "ai_inference") ? await client2.describeModel(options.model) : null;
33103
33144
  if (options.model && !modelDescription) {
33104
33145
  console.error(
@@ -33110,7 +33151,8 @@ async function getTool(toolId, options = {}) {
33110
33151
  process.stdout.write(
33111
33152
  `${JSON.stringify({
33112
33153
  ...toolContractJsonForDescribe(tool, toolId),
33113
- ...modelDescription ? { modelOptions: modelDescription } : {}
33154
+ ...modelDescription ? { modelOptions: modelDescription } : {},
33155
+ ...inferenceQuote ? { inferenceQuote } : {}
33114
33156
  })}
33115
33157
  `
33116
33158
  );
@@ -33121,7 +33163,8 @@ async function getTool(toolId, options = {}) {
33121
33163
  process.stdout.write(
33122
33164
  `${JSON.stringify({
33123
33165
  ...toolMetadataJsonForDescribe(tool, toolId),
33124
- ...modelDescription ? { modelOptions: modelDescription } : {}
33166
+ ...modelDescription ? { modelOptions: modelDescription } : {},
33167
+ ...inferenceQuote ? { inferenceQuote } : {}
33125
33168
  })}
33126
33169
  `
33127
33170
  );
@@ -33141,18 +33184,22 @@ async function getTool(toolId, options = {}) {
33141
33184
  }
33142
33185
  if (options.pricingOnly) {
33143
33186
  printToolPricingOnly(tool, toolId);
33187
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33144
33188
  return 0;
33145
33189
  }
33146
33190
  if (options.schemaOnly) {
33147
33191
  printToolSchemaOnly(tool, toolId);
33192
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33148
33193
  return 0;
33149
33194
  }
33150
33195
  if (options.examplesOnly) {
33151
33196
  printToolExamplesOnly(tool, toolId);
33197
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33152
33198
  return 0;
33153
33199
  }
33154
33200
  if (options.gettersOnly) {
33155
33201
  printToolGettersOnly(tool, toolId);
33202
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33156
33203
  return 0;
33157
33204
  }
33158
33205
  if (options.compact) {
@@ -33161,13 +33208,15 @@ async function getTool(toolId, options = {}) {
33161
33208
  process.stdout.write(`
33162
33209
  ${formatModelDescription(modelDescription)}`);
33163
33210
  }
33211
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33164
33212
  return 0;
33165
33213
  }
33166
33214
  if (shouldEmitJson()) {
33167
33215
  process.stdout.write(
33168
33216
  `${JSON.stringify({
33169
33217
  ...toolContractJsonForDescribe(tool, toolId),
33170
- ...modelDescription ? { modelOptions: modelDescription } : {}
33218
+ ...modelDescription ? { modelOptions: modelDescription } : {},
33219
+ ...inferenceQuote ? { inferenceQuote } : {}
33171
33220
  })}
33172
33221
  `
33173
33222
  );
@@ -33178,8 +33227,26 @@ ${formatModelDescription(modelDescription)}`);
33178
33227
  process.stdout.write(`
33179
33228
  ${formatModelDescription(modelDescription)}`);
33180
33229
  }
33230
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33181
33231
  return 0;
33182
33232
  }
33233
+ function printInferenceQuoteSummary(quote) {
33234
+ console.log("");
33235
+ console.log("Inference quote:");
33236
+ if (quote.estimate.quality === "estimate_only") {
33237
+ console.log(`- Planning estimate: ${quote.estimate.credits} credits`);
33238
+ } else {
33239
+ console.log("- Planning estimate: unavailable");
33240
+ }
33241
+ if (quote.authorization.quality === "bounded_max") {
33242
+ console.log(
33243
+ `- Maximum authorization: ${quote.authorization.maximumCredits} credits`
33244
+ );
33245
+ } else {
33246
+ console.log(`- Maximum authorization: ${quote.authorization.quality}`);
33247
+ }
33248
+ console.log("- Settlement: actual usage");
33249
+ }
33183
33250
  function toolContractJsonForDescribe(tool, requestedToolId) {
33184
33251
  const toolId = String(tool.toolId || requestedToolId);
33185
33252
  const inputFields = toolInputFieldsForDisplay(
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
1030
1030
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1031
1031
  // exposed storage-dependent synchronous access. This deliberate minor
1032
1032
  // release keeps lazy paging semantics independent of row residency.
1033
- version: "0.2.15",
1033
+ version: "0.2.17",
1034
1034
  contracts: {
1035
1035
  api: {
1036
1036
  name: "sdk-http-api",
@@ -4026,6 +4026,18 @@ var DeeplineClient = class {
4026
4026
  }
4027
4027
  );
4028
4028
  }
4029
+ /**
4030
+ * Quote dynamic AI inference pricing for a concrete payload.
4031
+ *
4032
+ * The result separates a planning estimate from a proven authorization
4033
+ * maximum and contains Deepline credits only.
4034
+ */
4035
+ async quoteInferenceTool(toolId, payload) {
4036
+ return this.http.post(
4037
+ `/api/v2/integrations/${encodeURIComponent(toolId)}/quote`,
4038
+ payload
4039
+ );
4040
+ }
4029
4041
  /**
4030
4042
  * Execute a tool and return the standard execution envelope.
4031
4043
  *
@@ -7785,6 +7797,7 @@ async function handleUsage(options) {
7785
7797
  const params = new URLSearchParams();
7786
7798
  if (options.limit) params.set("recent_limit", options.limit);
7787
7799
  if (options.offset) params.set("recent_offset", options.offset);
7800
+ if (options.cursor) params.set("recent_cursor", options.cursor);
7788
7801
  if (options.runId) params.set("run_id", options.runId);
7789
7802
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
7790
7803
  const payload = await http.get(
@@ -7802,7 +7815,10 @@ async function handleUsage(options) {
7802
7815
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
7803
7816
  ...recentUsageLines(
7804
7817
  Array.isArray(recent.entries) ? recent.entries : []
7805
- )
7818
+ ),
7819
+ ...typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? [
7820
+ `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}`
7821
+ ] : []
7806
7822
  ];
7807
7823
  printCommandEnvelope(
7808
7824
  {
@@ -8525,14 +8541,17 @@ Examples:
8525
8541
  `
8526
8542
  Notes:
8527
8543
  Read-only. Shows last-30-day Deepline credit usage plus a bounded recent-call
8528
- page. Use --limit/--offset to paginate the recent-call section.
8544
+ page. Use --limit/--cursor to paginate the recent-call section.
8529
8545
 
8530
8546
  Examples:
8531
8547
  deepline billing usage
8532
- deepline billing usage --limit 50 --offset 50 --json
8548
+ deepline billing usage --limit 50 --cursor <next_cursor> --json
8533
8549
  deepline billing usage --run-id play/example/run/20260630t120000-000-abcdef --json
8534
8550
  `
8535
- ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8551
+ ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option(
8552
+ "--cursor <cursor>",
8553
+ "Recent-call cursor from the previous response"
8554
+ ).option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8536
8555
  billing.command("limit").description("Show configured monthly limit state.").addHelpText(
8537
8556
  "after",
8538
8557
  `
@@ -33061,11 +33080,15 @@ Examples:
33061
33080
  deepline tools describe hunter_email_verifier --examples-only
33062
33081
  deepline tools describe hunter_email_verifier --json
33063
33082
  deepline tools describe deeplineagent --model openai/gpt-5.5 --json
33083
+ deepline tools describe ai_inference --estimate-payload @payload.json --json
33064
33084
  deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
33065
33085
  `
33066
33086
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").option(
33067
33087
  "--model <model>",
33068
33088
  "For deeplineagent, include AI Gateway model/provider option metadata"
33089
+ ).option(
33090
+ "--estimate-payload <payload>",
33091
+ "Quote an ai_inference or deeplineagent JSON payload (inline or @file)"
33069
33092
  ).option("--pricing-only", "Only print pricing and billing semantics").option("--schema-only", "Only print input schema fields").option(
33070
33093
  "--examples-only",
33071
33094
  "Only print runnable examples and sample payloads"
@@ -33088,7 +33111,8 @@ Examples:
33088
33111
  schemaOnly: Boolean(options.schemaOnly),
33089
33112
  examplesOnly: Boolean(options.examplesOnly),
33090
33113
  gettersOnly: Boolean(options.gettersOnly),
33091
- model: typeof options.model === "string" ? options.model : void 0
33114
+ model: typeof options.model === "string" ? options.model : void 0,
33115
+ estimatePayload: typeof options.estimatePayload === "string" ? options.estimatePayload : void 0
33092
33116
  });
33093
33117
  });
33094
33118
  addToolMetadataCommand(tools.command("describe <toolId>").alias("get"));
@@ -33162,6 +33186,23 @@ async function getTool(toolId, options = {}) {
33162
33186
  }
33163
33187
  throw error;
33164
33188
  }
33189
+ let inferenceQuote = null;
33190
+ if (options.estimatePayload) {
33191
+ if (toolId !== "deeplineagent" && toolId !== "ai_inference") {
33192
+ console.error(
33193
+ "--estimate-payload is only supported for deeplineagent and ai_inference."
33194
+ );
33195
+ return 2;
33196
+ }
33197
+ const estimatePayload = parseJsonObjectArgument(
33198
+ options.estimatePayload,
33199
+ "--estimate-payload"
33200
+ );
33201
+ if (options.model && estimatePayload.model === void 0) {
33202
+ estimatePayload.model = options.model;
33203
+ }
33204
+ inferenceQuote = await client2.quoteInferenceTool(toolId, estimatePayload);
33205
+ }
33165
33206
  const modelDescription = options.model && (toolId === "deeplineagent" || toolId === "ai_inference") ? await client2.describeModel(options.model) : null;
33166
33207
  if (options.model && !modelDescription) {
33167
33208
  console.error(
@@ -33173,7 +33214,8 @@ async function getTool(toolId, options = {}) {
33173
33214
  process.stdout.write(
33174
33215
  `${JSON.stringify({
33175
33216
  ...toolContractJsonForDescribe(tool, toolId),
33176
- ...modelDescription ? { modelOptions: modelDescription } : {}
33217
+ ...modelDescription ? { modelOptions: modelDescription } : {},
33218
+ ...inferenceQuote ? { inferenceQuote } : {}
33177
33219
  })}
33178
33220
  `
33179
33221
  );
@@ -33184,7 +33226,8 @@ async function getTool(toolId, options = {}) {
33184
33226
  process.stdout.write(
33185
33227
  `${JSON.stringify({
33186
33228
  ...toolMetadataJsonForDescribe(tool, toolId),
33187
- ...modelDescription ? { modelOptions: modelDescription } : {}
33229
+ ...modelDescription ? { modelOptions: modelDescription } : {},
33230
+ ...inferenceQuote ? { inferenceQuote } : {}
33188
33231
  })}
33189
33232
  `
33190
33233
  );
@@ -33204,18 +33247,22 @@ async function getTool(toolId, options = {}) {
33204
33247
  }
33205
33248
  if (options.pricingOnly) {
33206
33249
  printToolPricingOnly(tool, toolId);
33250
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33207
33251
  return 0;
33208
33252
  }
33209
33253
  if (options.schemaOnly) {
33210
33254
  printToolSchemaOnly(tool, toolId);
33255
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33211
33256
  return 0;
33212
33257
  }
33213
33258
  if (options.examplesOnly) {
33214
33259
  printToolExamplesOnly(tool, toolId);
33260
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33215
33261
  return 0;
33216
33262
  }
33217
33263
  if (options.gettersOnly) {
33218
33264
  printToolGettersOnly(tool, toolId);
33265
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33219
33266
  return 0;
33220
33267
  }
33221
33268
  if (options.compact) {
@@ -33224,13 +33271,15 @@ async function getTool(toolId, options = {}) {
33224
33271
  process.stdout.write(`
33225
33272
  ${formatModelDescription(modelDescription)}`);
33226
33273
  }
33274
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33227
33275
  return 0;
33228
33276
  }
33229
33277
  if (shouldEmitJson()) {
33230
33278
  process.stdout.write(
33231
33279
  `${JSON.stringify({
33232
33280
  ...toolContractJsonForDescribe(tool, toolId),
33233
- ...modelDescription ? { modelOptions: modelDescription } : {}
33281
+ ...modelDescription ? { modelOptions: modelDescription } : {},
33282
+ ...inferenceQuote ? { inferenceQuote } : {}
33234
33283
  })}
33235
33284
  `
33236
33285
  );
@@ -33241,8 +33290,26 @@ ${formatModelDescription(modelDescription)}`);
33241
33290
  process.stdout.write(`
33242
33291
  ${formatModelDescription(modelDescription)}`);
33243
33292
  }
33293
+ if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
33244
33294
  return 0;
33245
33295
  }
33296
+ function printInferenceQuoteSummary(quote) {
33297
+ console.log("");
33298
+ console.log("Inference quote:");
33299
+ if (quote.estimate.quality === "estimate_only") {
33300
+ console.log(`- Planning estimate: ${quote.estimate.credits} credits`);
33301
+ } else {
33302
+ console.log("- Planning estimate: unavailable");
33303
+ }
33304
+ if (quote.authorization.quality === "bounded_max") {
33305
+ console.log(
33306
+ `- Maximum authorization: ${quote.authorization.maximumCredits} credits`
33307
+ );
33308
+ } else {
33309
+ console.log(`- Maximum authorization: ${quote.authorization.quality}`);
33310
+ }
33311
+ console.log("- Settlement: actual usage");
33312
+ }
33246
33313
  function toolContractJsonForDescribe(tool, requestedToolId) {
33247
33314
  const toolId = String(tool.toolId || requestedToolId);
33248
33315
  const inputFields = toolInputFieldsForDisplay(
package/dist/index.d.mts CHANGED
@@ -411,7 +411,46 @@ interface DeeplineAgentModelDescription {
411
411
  };
412
412
  caveats: string[];
413
413
  sources: string[];
414
+ inferencePricing: InferenceDynamicPricingCapability;
414
415
  }
416
+ interface InferenceDynamicPricingCapability {
417
+ settlement: 'actual_usage';
418
+ staticUnitPrice: null;
419
+ quoteEndpointTemplate: string;
420
+ supportedQualities: Array<'bounded_max' | 'estimate_only' | 'unavailable'>;
421
+ payloadFields: string[];
422
+ }
423
+ type InferenceQuoteAssumptions = {
424
+ modelCallCount: number;
425
+ planningModelCallCount: number;
426
+ estimatedInputTokens: number;
427
+ estimatedOutputTokens: number;
428
+ maxOutputTokens: number | null;
429
+ candidateRouteCount: number;
430
+ pricedRouteCount: number;
431
+ inputBound: 'proven_request_tokens' | 'catalog_context' | 'not_proven';
432
+ inputBoundProofId?: string;
433
+ };
434
+ type InferenceQuote = {
435
+ quality: 'bounded_max' | 'estimate_only' | 'unavailable';
436
+ estimate: {
437
+ quality: 'estimate_only';
438
+ credits: number;
439
+ assumptions: InferenceQuoteAssumptions;
440
+ } | {
441
+ quality: 'unavailable';
442
+ assumptions: InferenceQuoteAssumptions;
443
+ };
444
+ authorization: {
445
+ quality: 'bounded_max';
446
+ maximumCredits: number;
447
+ assumptions: InferenceQuoteAssumptions;
448
+ } | {
449
+ quality: 'estimate_only' | 'unavailable';
450
+ assumptions: InferenceQuoteAssumptions;
451
+ };
452
+ settlement: 'actual_usage';
453
+ };
415
454
  /**
416
455
  * Query options for ranked tool/provider discovery.
417
456
  */
@@ -2446,6 +2485,13 @@ declare class DeeplineClient {
2446
2485
  * @returns Model metadata, provider option shapes, and runnable examples
2447
2486
  */
2448
2487
  describeModel(model: string): Promise<DeeplineAgentModelDescription>;
2488
+ /**
2489
+ * Quote dynamic AI inference pricing for a concrete payload.
2490
+ *
2491
+ * The result separates a planning estimate from a proven authorization
2492
+ * maximum and contains Deepline credits only.
2493
+ */
2494
+ quoteInferenceTool(toolId: 'ai_inference' | 'deeplineagent', payload: Record<string, unknown>): Promise<InferenceQuote>;
2449
2495
  /**
2450
2496
  * Execute a tool and return the standard execution envelope.
2451
2497
  *
package/dist/index.d.ts CHANGED
@@ -411,7 +411,46 @@ interface DeeplineAgentModelDescription {
411
411
  };
412
412
  caveats: string[];
413
413
  sources: string[];
414
+ inferencePricing: InferenceDynamicPricingCapability;
414
415
  }
416
+ interface InferenceDynamicPricingCapability {
417
+ settlement: 'actual_usage';
418
+ staticUnitPrice: null;
419
+ quoteEndpointTemplate: string;
420
+ supportedQualities: Array<'bounded_max' | 'estimate_only' | 'unavailable'>;
421
+ payloadFields: string[];
422
+ }
423
+ type InferenceQuoteAssumptions = {
424
+ modelCallCount: number;
425
+ planningModelCallCount: number;
426
+ estimatedInputTokens: number;
427
+ estimatedOutputTokens: number;
428
+ maxOutputTokens: number | null;
429
+ candidateRouteCount: number;
430
+ pricedRouteCount: number;
431
+ inputBound: 'proven_request_tokens' | 'catalog_context' | 'not_proven';
432
+ inputBoundProofId?: string;
433
+ };
434
+ type InferenceQuote = {
435
+ quality: 'bounded_max' | 'estimate_only' | 'unavailable';
436
+ estimate: {
437
+ quality: 'estimate_only';
438
+ credits: number;
439
+ assumptions: InferenceQuoteAssumptions;
440
+ } | {
441
+ quality: 'unavailable';
442
+ assumptions: InferenceQuoteAssumptions;
443
+ };
444
+ authorization: {
445
+ quality: 'bounded_max';
446
+ maximumCredits: number;
447
+ assumptions: InferenceQuoteAssumptions;
448
+ } | {
449
+ quality: 'estimate_only' | 'unavailable';
450
+ assumptions: InferenceQuoteAssumptions;
451
+ };
452
+ settlement: 'actual_usage';
453
+ };
415
454
  /**
416
455
  * Query options for ranked tool/provider discovery.
417
456
  */
@@ -2446,6 +2485,13 @@ declare class DeeplineClient {
2446
2485
  * @returns Model metadata, provider option shapes, and runnable examples
2447
2486
  */
2448
2487
  describeModel(model: string): Promise<DeeplineAgentModelDescription>;
2488
+ /**
2489
+ * Quote dynamic AI inference pricing for a concrete payload.
2490
+ *
2491
+ * The result separates a planning estimate from a proven authorization
2492
+ * maximum and contains Deepline credits only.
2493
+ */
2494
+ quoteInferenceTool(toolId: 'ai_inference' | 'deeplineagent', payload: Record<string, unknown>): Promise<InferenceQuote>;
2449
2495
  /**
2450
2496
  * Execute a tool and return the standard execution envelope.
2451
2497
  *
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.15",
766
+ version: "0.2.17",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -3759,6 +3759,18 @@ var DeeplineClient = class {
3759
3759
  }
3760
3760
  );
3761
3761
  }
3762
+ /**
3763
+ * Quote dynamic AI inference pricing for a concrete payload.
3764
+ *
3765
+ * The result separates a planning estimate from a proven authorization
3766
+ * maximum and contains Deepline credits only.
3767
+ */
3768
+ async quoteInferenceTool(toolId, payload) {
3769
+ return this.http.post(
3770
+ `/api/v2/integrations/${encodeURIComponent(toolId)}/quote`,
3771
+ payload
3772
+ );
3773
+ }
3762
3774
  /**
3763
3775
  * Execute a tool and return the standard execution envelope.
3764
3776
  *
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.15",
692
+ version: "0.2.17",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -3685,6 +3685,18 @@ var DeeplineClient = class {
3685
3685
  }
3686
3686
  );
3687
3687
  }
3688
+ /**
3689
+ * Quote dynamic AI inference pricing for a concrete payload.
3690
+ *
3691
+ * The result separates a planning estimate from a proven authorization
3692
+ * maximum and contains Deepline credits only.
3693
+ */
3694
+ async quoteInferenceTool(toolId, payload) {
3695
+ return this.http.post(
3696
+ `/api/v2/integrations/${encodeURIComponent(toolId)}/quote`,
3697
+ payload
3698
+ );
3699
+ }
3688
3700
  /**
3689
3701
  * Execute a tool and return the standard execution envelope.
3690
3702
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {