@turnstileai/sdk 0.1.6 → 0.1.7

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.
Files changed (2) hide show
  1. package/README.md +57 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # @turnstileai/sdk
2
2
 
3
- The official TypeScript/JavaScript SDK for TurnstileAI, a verification-first AI gateway for routed completions, run records, and optional ledger-backed checkpoints.
3
+ ![npm version](https://img.shields.io/npm/v/@turnstileai/sdk)
4
+ ![license](https://img.shields.io/npm/l/@turnstileai/sdk)
5
+ ![node version](https://img.shields.io/node/v/@turnstileai/sdk)
6
+
7
+ TypeScript SDK for TurnstileAI, a verification-first AI gateway for trustable completions, receipts, and on-chain proof.
8
+
9
+ Repository: https://github.com/turnstileai/TurnstileAI
10
+
11
+ ## Why TurnstileAI
12
+
13
+ TurnstileAI is designed for applications that want more than plain text completions. It adds verification-oriented records, provider visibility, and optional Solana-backed checkpoints so inference can be easier to inspect, trust, and audit.
4
14
 
5
15
  ## Installation
6
16
 
@@ -34,7 +44,30 @@ console.log(JSON.stringify(result.record, null, 2));
34
44
  console.log(JSON.stringify(result.verification, null, 2));
35
45
  ```
36
46
 
37
- ## Sandboxed Local Testing (No Server Needed)
47
+ ## Full Example
48
+
49
+ ```ts
50
+ import { TurnstileAI } from "@turnstileai/sdk";
51
+
52
+ const client = new TurnstileAI({
53
+ apiKey: process.env.TURNSTILEAI_API_KEY!
54
+ });
55
+
56
+ const result = await client.chat({
57
+ model: "openrouter/llama-3.1-70b",
58
+ messages: [
59
+ { role: "user", content: "Summarize why Solana finality matters." }
60
+ ],
61
+ receipt: true,
62
+ anchor: "solana"
63
+ });
64
+
65
+ console.log(result.output);
66
+ console.log(result.record?.id);
67
+ console.log(result.verification?.status);
68
+ ```
69
+
70
+ ## Sandboxed Local Testing
38
71
 
39
72
  If the SDK detects an API key starting with `ts_test_` or the environment variable `TURNSTILEAI_MOCK=true` is set, it can fall back to local mock mode for offline development and integration testing.
40
73
 
@@ -43,7 +76,7 @@ If the SDK detects an API key starting with `ts_test_` or the environment variab
43
76
  | Parameter | Type | Description |
44
77
  | --- | --- | --- |
45
78
  | `apiKey` | `string` | Your TurnstileAI API key. |
46
- | `baseURL` | `string` | The TurnstileAI API base URL, defaults to `https://api.turnstileai.com/v1`. |
79
+ | `baseURL` | `string` | API base URL, defaults to `https://api.turnstileai.com/v1`. |
47
80
  | `timeout` | `number` | Request timeout in milliseconds. |
48
81
  | `defaultRouteMode` | `RouteMode` | Optional default routing strategy. |
49
82
  | `defaultLedgerMode` | `LedgerMode` | Optional default ledger/checkpoint mode. |
@@ -58,8 +91,8 @@ If the SDK detects an API key starting with `ts_test_` or the environment variab
58
91
  | `anchor` | `string` | `"off-chain"` | Checkpoint mode: `"solana"`, `"off-chain"`, or `"none"`. |
59
92
  | `routeMode` | `string` | `"trust-first"` | Routing strategy for provider selection. |
60
93
  | `provider` | `string` | Optional | Pin inference to a provider. |
61
- | `maxSpendUsd` | `number` | Optional | Set a maximum spend cap for a request. |
62
- | `temperature` | `number` | Optional | Sampling temperature for completion generation. |
94
+ | `maxSpendUsd` | `number` | Optional | Maximum spend cap for a request. |
95
+ | `temperature` | `number` | Optional | Sampling temperature. |
63
96
  | `maxTokens` | `number` | Optional | Output token limit. |
64
97
 
65
98
  ## Record APIs
@@ -82,6 +115,25 @@ turnstileai providers list --key=ts_live_xxx
82
115
  turnstileai usage overview --key=ts_live_xxx
83
116
  ```
84
117
 
118
+ ## Development
119
+
120
+ Build the package:
121
+
122
+ ```bash
123
+ npm run build
124
+ ```
125
+
126
+ Run tests:
127
+
128
+ ```bash
129
+ npm test
130
+ ```
131
+
132
+ ## Repository
133
+
134
+ - GitHub: https://github.com/turnstileai/TurnstileAI
135
+ - Issues: https://github.com/turnstileai/TurnstileAI/issues
136
+
85
137
  ## License
86
138
 
87
139
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turnstileai/sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "TypeScript SDK for TurnstileAI, a verification-first AI gateway",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",