@obelyzk/sdk 1.5.0 → 1.6.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 CHANGED
@@ -176,11 +176,11 @@ const client = createProverClient({
176
176
  });
177
177
  ```
178
178
 
179
- See the [Self-Hosting Guide](../../libs/stwo-ml/scripts/pipeline/GETTING_STARTED.md#option-3-self-host-a-gpu-prover) for setup instructions.
179
+ See the [Self-Hosting Guide](../../libs/obelyzk.rs/scripts/pipeline/GETTING_STARTED.md#option-3-self-host-a-gpu-prover) for setup instructions.
180
180
 
181
181
  ## Links
182
182
 
183
- - [GitHub](https://github.com/obelyzk/stwo-ml)
183
+ - [GitHub](https://github.com/Bitsage-Network/obelyzk.rs)
184
184
  - [npm](https://www.npmjs.com/package/@obelyzk/sdk)
185
- - [Getting Started](../../libs/stwo-ml/scripts/pipeline/GETTING_STARTED.md)
186
- - [On-Chain Docs](../../libs/stwo-ml/docs/ON_CHAIN_VERIFICATION.md)
185
+ - [Getting Started](../../libs/obelyzk.rs/scripts/pipeline/GETTING_STARTED.md)
186
+ - [On-Chain Docs](../../libs/obelyzk.rs/docs/ON_CHAIN_VERIFICATION.md)
package/dist/index.d.mts CHANGED
@@ -692,6 +692,34 @@ declare class StwoProverClient {
692
692
  /**
693
693
  * Generate proof for AI/ML inference
694
694
  */
695
+ /**
696
+ * Verifiable chat inference — send a prompt, get a response with on-chain proof.
697
+ *
698
+ * @example
699
+ * ```typescript
700
+ * const result = await prover.chat("What is 2+2?", { model: "local", maxTokens: 1 });
701
+ * console.log(result.text); // model output
702
+ * console.log(result.txHash); // Starknet TX hash
703
+ * console.log(result.explorerUrl); // Starkscan link
704
+ * console.log(result.calldataFelts); // ~950 felts
705
+ * console.log(result.modelId); // weight commitment hash
706
+ * ```
707
+ */
708
+ chat(prompt: string, options?: {
709
+ model?: string;
710
+ maxTokens?: number;
711
+ sessionId?: string;
712
+ }): Promise<{
713
+ text: string;
714
+ txHash?: string;
715
+ proofHash?: string;
716
+ modelId?: string;
717
+ ioCommitment?: string;
718
+ calldataFelts?: number;
719
+ explorerUrl?: string;
720
+ proveTimeSecs?: number;
721
+ trustModel: string;
722
+ }>;
695
723
  proveInference(modelId: string, inputs: bigint[], outputs: bigint[], options?: {
696
724
  priority?: ProofJobPriority;
697
725
  requireTee?: boolean;
package/dist/index.d.ts CHANGED
@@ -692,6 +692,34 @@ declare class StwoProverClient {
692
692
  /**
693
693
  * Generate proof for AI/ML inference
694
694
  */
695
+ /**
696
+ * Verifiable chat inference — send a prompt, get a response with on-chain proof.
697
+ *
698
+ * @example
699
+ * ```typescript
700
+ * const result = await prover.chat("What is 2+2?", { model: "local", maxTokens: 1 });
701
+ * console.log(result.text); // model output
702
+ * console.log(result.txHash); // Starknet TX hash
703
+ * console.log(result.explorerUrl); // Starkscan link
704
+ * console.log(result.calldataFelts); // ~950 felts
705
+ * console.log(result.modelId); // weight commitment hash
706
+ * ```
707
+ */
708
+ chat(prompt: string, options?: {
709
+ model?: string;
710
+ maxTokens?: number;
711
+ sessionId?: string;
712
+ }): Promise<{
713
+ text: string;
714
+ txHash?: string;
715
+ proofHash?: string;
716
+ modelId?: string;
717
+ ioCommitment?: string;
718
+ calldataFelts?: number;
719
+ explorerUrl?: string;
720
+ proveTimeSecs?: number;
721
+ trustModel: string;
722
+ }>;
695
723
  proveInference(modelId: string, inputs: bigint[], outputs: bigint[], options?: {
696
724
  priority?: ProofJobPriority;
697
725
  requireTee?: boolean;
package/dist/index.js CHANGED
@@ -6418,6 +6418,53 @@ var StwoProverClient = class {
6418
6418
  /**
6419
6419
  * Generate proof for AI/ML inference
6420
6420
  */
6421
+ /**
6422
+ * Verifiable chat inference — send a prompt, get a response with on-chain proof.
6423
+ *
6424
+ * @example
6425
+ * ```typescript
6426
+ * const result = await prover.chat("What is 2+2?", { model: "local", maxTokens: 1 });
6427
+ * console.log(result.text); // model output
6428
+ * console.log(result.txHash); // Starknet TX hash
6429
+ * console.log(result.explorerUrl); // Starkscan link
6430
+ * console.log(result.calldataFelts); // ~950 felts
6431
+ * console.log(result.modelId); // weight commitment hash
6432
+ * ```
6433
+ */
6434
+ async chat(prompt, options) {
6435
+ const response = await fetch(`${this.config.baseUrl}/v1/chat/completions`, {
6436
+ method: "POST",
6437
+ headers: {
6438
+ "Content-Type": "application/json",
6439
+ ...this.config.apiKey ? { Authorization: `Bearer ${this.config.apiKey}` } : {}
6440
+ },
6441
+ body: JSON.stringify({
6442
+ model: options?.model ?? "local",
6443
+ messages: [{ role: "user", content: prompt }],
6444
+ max_tokens: options?.maxTokens ?? 1,
6445
+ stream: false,
6446
+ session_id: options?.sessionId
6447
+ })
6448
+ });
6449
+ if (!response.ok) {
6450
+ const err = await response.text();
6451
+ throw new Error(`Chat failed (${response.status}): ${err}`);
6452
+ }
6453
+ const data = await response.json();
6454
+ const choice = data.choices?.[0];
6455
+ const meta = data.obelyzk ?? {};
6456
+ return {
6457
+ text: choice?.message?.content ?? "",
6458
+ txHash: meta.tx_hash,
6459
+ proofHash: meta.proof_hash,
6460
+ modelId: meta.model_id,
6461
+ ioCommitment: meta.io_commitment,
6462
+ calldataFelts: meta.calldata_felts,
6463
+ explorerUrl: meta.explorer_url,
6464
+ proveTimeSecs: meta.prove_time_secs,
6465
+ trustModel: meta.trust_model ?? "unknown"
6466
+ };
6467
+ }
6421
6468
  async proveInference(modelId, inputs, outputs, options) {
6422
6469
  const job = await this.submitProofJob({
6423
6470
  proofType: "ai_inference",
package/dist/index.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ import "./chunk-DGYMDV5X.mjs";
2
+ import {
3
+ AgentFirewallSDK
4
+ } from "./chunk-Y4PBMUWM.mjs";
1
5
  import {
2
6
  BatchClient,
3
7
  BitSageClient,
@@ -65,10 +69,6 @@ import {
65
69
  toFelt,
66
70
  verifyTransferProof
67
71
  } from "./chunk-LXJT3QK6.mjs";
68
- import "./chunk-DGYMDV5X.mjs";
69
- import {
70
- AgentFirewallSDK
71
- } from "./chunk-Y4PBMUWM.mjs";
72
72
  import {
73
73
  AssetId,
74
74
  CURVE_ORDER,
@@ -500,6 +500,53 @@ var StwoProverClient = class {
500
500
  /**
501
501
  * Generate proof for AI/ML inference
502
502
  */
503
+ /**
504
+ * Verifiable chat inference — send a prompt, get a response with on-chain proof.
505
+ *
506
+ * @example
507
+ * ```typescript
508
+ * const result = await prover.chat("What is 2+2?", { model: "local", maxTokens: 1 });
509
+ * console.log(result.text); // model output
510
+ * console.log(result.txHash); // Starknet TX hash
511
+ * console.log(result.explorerUrl); // Starkscan link
512
+ * console.log(result.calldataFelts); // ~950 felts
513
+ * console.log(result.modelId); // weight commitment hash
514
+ * ```
515
+ */
516
+ async chat(prompt, options) {
517
+ const response = await fetch(`${this.config.baseUrl}/v1/chat/completions`, {
518
+ method: "POST",
519
+ headers: {
520
+ "Content-Type": "application/json",
521
+ ...this.config.apiKey ? { Authorization: `Bearer ${this.config.apiKey}` } : {}
522
+ },
523
+ body: JSON.stringify({
524
+ model: options?.model ?? "local",
525
+ messages: [{ role: "user", content: prompt }],
526
+ max_tokens: options?.maxTokens ?? 1,
527
+ stream: false,
528
+ session_id: options?.sessionId
529
+ })
530
+ });
531
+ if (!response.ok) {
532
+ const err = await response.text();
533
+ throw new Error(`Chat failed (${response.status}): ${err}`);
534
+ }
535
+ const data = await response.json();
536
+ const choice = data.choices?.[0];
537
+ const meta = data.obelyzk ?? {};
538
+ return {
539
+ text: choice?.message?.content ?? "",
540
+ txHash: meta.tx_hash,
541
+ proofHash: meta.proof_hash,
542
+ modelId: meta.model_id,
543
+ ioCommitment: meta.io_commitment,
544
+ calldataFelts: meta.calldata_felts,
545
+ explorerUrl: meta.explorer_url,
546
+ proveTimeSecs: meta.prove_time_secs,
547
+ trustModel: meta.trust_model ?? "unknown"
548
+ };
549
+ }
503
550
  async proveInference(modelId, inputs, outputs, options) {
504
551
  const job = await this.submitProofJob({
505
552
  proofType: "ai_inference",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obelyzk/sdk",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "ObelyZK SDK — verifiable ML inference on Starknet with recursive STARK proofs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",