import type { HttpClient, RequestOptions } from "../http.js"; import type { NetworkId } from "../chains/index.js"; import type { Receipt, PaymentMode, ResponseObject, ResponsesCreateParams, SessionBudgetSnapshot, SessionInvalidReason, X402PaymentSignature, X402PaymentSigner } from "../types/index.js"; import { type RunEvent, type StreamResult } from "@compose-market/core/sse/stream"; import { type InferenceContext } from "./instrumentation.js"; export type { InferenceContext } from "./instrumentation.js"; export interface CallOptions { signal?: AbortSignal; timeoutMs?: number; idempotencyKey?: string; runId?: string; x402MaxAmountWei?: string; paymentSignature?: X402PaymentSignature; /** * Payment path for this call. * - auto: use Compose Key first when present, otherwise negotiate raw x402. * - key: require the Compose Key path and do not fall back to x402. * - x402: suppress Compose Key auth and negotiate raw x402. */ paymentMode?: PaymentMode; /** Per-call signer used to answer a PAYMENT-REQUIRED challenge. */ x402Signer?: X402PaymentSigner; /** Override the Compose Key for this call. Passing `null` forces the raw x402 path. */ key?: string | null; /** Override the end-user wallet address for this call. */ userAddress?: string; /** Override the chain id for this call. */ network?: NetworkId; } /** * Typed wrapper returned by every billable, non-streaming inference call. * * `data` — the parsed JSON body. * `receipt` — the settlement receipt decoded from `X-Receipt` * (or mirrored from the `receipt` body field). * `requestId` — the server-issued `X-Request-Id` for tracing. * `response` — the raw `Response` (still-readable if the caller asked * for `.asResponse()` directly; consumed here). * `budget` — live `x-session-budget-*` snapshot parsed from * response headers, or `null` if the endpoint did not * emit budget headers. * `sessionInvalidReason` — truthy `x-session-invalid` value when the * session must be torn down as a side effect of this * call (budget depleted, revoked, etc). */ export interface Completion { data: T; receipt: Receipt | null; requestId: string | null; response: Response; budget: SessionBudgetSnapshot | null; sessionInvalidReason: SessionInvalidReason | null; } export declare function buildCallHeaders(options: CallOptions | undefined, ctxWallet: { address: string | null; network: NetworkId | null; }, ctxToken: string | null): { userAddress: string | undefined; network: NetworkId | undefined; key: string | undefined; paymentSignature: string | undefined; x402MaxAmountWei: string | undefined; idempotencyKey: string | undefined; runId: string | undefined; }; export declare function requestResponseWithPayment(client: HttpClient, ctx: InferenceContext, config: RequestOptions, options: CallOptions | undefined): Promise; declare class ResponsesNamespace { private readonly client; private readonly ctx; constructor(client: HttpClient, ctx: InferenceContext); create(params: ResponsesCreateParams, options?: CallOptions): Promise>; stream(params: ResponsesCreateParams, options?: CallOptions): AsyncGenerator; get(responseId: string, options?: CallOptions): Promise; inputItems(responseId: string, options?: CallOptions): Promise<{ object: "list"; data: Record[]; }>; append(responseId: string, params: { input?: unknown; params?: Record; custom_params?: Record; [key: string]: unknown; } | unknown, options?: CallOptions): Promise<{ object: "list"; data: Record[]; }>; cancel(responseId: string, options?: CallOptions): Promise; } export declare class Inference { readonly responses: ResponsesNamespace; constructor(client: HttpClient, ctx: InferenceContext); } //# sourceMappingURL=inference.d.ts.map