@modelrelay/sdk 1.44.0 → 4.0.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.
Files changed (37) hide show
  1. package/README.md +14 -30
  2. package/dist/api-Bitsm1tl.d.cts +5290 -0
  3. package/dist/api-Bitsm1tl.d.ts +5290 -0
  4. package/dist/{api-Ct5bpI3U.d.cts → api-CzFaWgs_.d.cts} +2636 -2113
  5. package/dist/{api-Ct5bpI3U.d.ts → api-CzFaWgs_.d.ts} +2636 -2113
  6. package/dist/{api-Bb7sw9L4.d.cts → api-D0wnVpwn.d.cts} +2598 -2148
  7. package/dist/{api-Bb7sw9L4.d.ts → api-D0wnVpwn.d.ts} +2598 -2148
  8. package/dist/billing/index.d.cts +3 -3
  9. package/dist/billing/index.d.ts +3 -3
  10. package/dist/{chunk-SCOP57J4.js → chunk-5O4NJXLJ.js} +2 -63
  11. package/dist/{chunk-4FXUTSRZ.js → chunk-ADQ74R7T.js} +1 -1
  12. package/dist/{chunk-CXJZB6MA.js → chunk-CV3DTA6P.js} +1 -1
  13. package/dist/{chunk-VOFLESGQ.js → chunk-EMQKOEF3.js} +10 -8
  14. package/dist/{chunk-MXXJDLGU.js → chunk-JZRSCFQH.js} +2 -63
  15. package/dist/{chunk-CYGWZYYJ.js → chunk-LW6SC7NQ.js} +2 -63
  16. package/dist/index.cjs +193 -2537
  17. package/dist/index.d.cts +128 -1950
  18. package/dist/index.d.ts +128 -1950
  19. package/dist/index.js +191 -2457
  20. package/dist/node.cjs +8 -9
  21. package/dist/node.d.cts +2 -2
  22. package/dist/node.d.ts +2 -2
  23. package/dist/node.js +8 -9
  24. package/dist/{tools-B7444ZtV.d.cts → tools-DAqAFZ8F.d.cts} +11 -13
  25. package/dist/{tools-B7444ZtV.d.ts → tools-DAqAFZ8F.d.ts} +11 -13
  26. package/dist/{tools-CvfwPjC5.d.cts → tools-bCt1QwNk.d.cts} +24 -124
  27. package/dist/{tools-CvfwPjC5.d.ts → tools-bCt1QwNk.d.ts} +24 -124
  28. package/package.json +1 -1
  29. package/dist/api-DWUVls-S.d.cts +0 -4762
  30. package/dist/api-DWUVls-S.d.ts +0 -4762
  31. package/dist/api-DZpC1zuz.d.cts +0 -4691
  32. package/dist/api-DZpC1zuz.d.ts +0 -4691
  33. package/dist/chunk-BP5HUQ4M.js +0 -1194
  34. package/dist/chunk-PLZWDUOP.js +0 -1194
  35. package/dist/chunk-SXNP5Y5L.js +0 -1194
  36. package/dist/tools-CWEBFsql.d.cts +0 -1192
  37. package/dist/tools-CWEBFsql.d.ts +0 -1192
package/README.md CHANGED
@@ -8,22 +8,6 @@ bun add @modelrelay/sdk
8
8
 
9
9
  Use token providers when you want the SDK to automatically obtain/refresh **bearer tokens** for data-plane calls like `/responses` and `/runs`.
10
10
 
11
- ### OIDC id_token → customer bearer token (exchange)
12
-
13
- ```ts
14
- import { ModelRelay, OIDCExchangeTokenProvider, parseSecretKey } from "@modelrelay/sdk";
15
-
16
- const tokenProvider = new OIDCExchangeTokenProvider({
17
- apiKey: parseSecretKey(process.env.MODELRELAY_API_KEY!),
18
- idTokenProvider: async () => {
19
- // Return an OIDC id_token from your auth system (web login, device flow, etc).
20
- return process.env.OIDC_ID_TOKEN!;
21
- },
22
- });
23
-
24
- const mr = new ModelRelay({ tokenProvider });
25
- ```
26
-
27
11
  ### Secret key → customer bearer token (mint)
28
12
 
29
13
  ```ts
@@ -46,7 +30,7 @@ const mr = ModelRelay.fromSecretKey("mr_sk_...");
46
30
 
47
31
  const req = mr.responses
48
32
  .new()
49
- .model("claude-sonnet-4-20250514")
33
+ .model("claude-sonnet-4-5")
50
34
  .user("Hello")
51
35
  .build();
52
36
 
@@ -125,14 +109,14 @@ import { chain, llmStep } from "@modelrelay/sdk";
125
109
 
126
110
  const summarizeReq = mr.responses
127
111
  .new()
128
- .model("claude-sonnet-4-20250514")
112
+ .model("claude-sonnet-4-5")
129
113
  .system("Summarize the input concisely.")
130
114
  .user("The quick brown fox...")
131
115
  .build();
132
116
 
133
117
  const translateReq = mr.responses
134
118
  .new()
135
- .model("claude-sonnet-4-20250514")
119
+ .model("claude-sonnet-4-5")
136
120
  .system("Translate the input to French.")
137
121
  .user("") // Bound from previous step
138
122
  .build();
@@ -152,10 +136,10 @@ Concurrent LLM calls with optional aggregation:
152
136
  import { parallel, llmStep } from "@modelrelay/sdk";
153
137
 
154
138
  const gpt4Req = mr.responses.new().model("gpt-4.1").user("Analyze this...").build();
155
- const claudeReq = mr.responses.new().model("claude-sonnet-4-20250514").user("Analyze this...").build();
139
+ const claudeReq = mr.responses.new().model("claude-sonnet-4-5").user("Analyze this...").build();
156
140
  const synthesizeReq = mr.responses
157
141
  .new()
158
- .model("claude-sonnet-4-20250514")
142
+ .model("claude-sonnet-4-5")
159
143
  .system("Synthesize the analyses into a unified view.")
160
144
  .user("") // Bound from join output
161
145
  .build();
@@ -177,7 +161,7 @@ import { mapReduce } from "@modelrelay/sdk";
177
161
 
178
162
  const combineReq = mr.responses
179
163
  .new()
180
- .model("claude-sonnet-4-20250514")
164
+ .model("claude-sonnet-4-5")
181
165
  .system("Combine summaries into a cohesive overview.")
182
166
  .user("") // Bound from join output
183
167
  .build();
@@ -197,7 +181,7 @@ For the most common path (**system + user → assistant text**):
197
181
 
198
182
  ```ts
199
183
  const text = await mr.responses.text(
200
- "claude-sonnet-4-20250514",
184
+ "claude-sonnet-4-5",
201
185
  "Answer concisely.",
202
186
  "Say hi.",
203
187
  );
@@ -218,7 +202,7 @@ To stream only message text deltas:
218
202
 
219
203
  ```ts
220
204
  const deltas = await mr.responses.streamTextDeltas(
221
- "claude-sonnet-4-20250514",
205
+ "claude-sonnet-4-5",
222
206
  "Answer concisely.",
223
207
  "Say hi.",
224
208
  );
@@ -244,7 +228,7 @@ const Person = z.object({
244
228
 
245
229
  // Simple one-call API (recommended)
246
230
  const person = await mr.responses.object<z.infer<typeof Person>>({
247
- model: "claude-sonnet-4-20250514",
231
+ model: "claude-sonnet-4-5",
248
232
  schema: Person,
249
233
  prompt: "Extract: John Doe is 30 years old",
250
234
  });
@@ -258,13 +242,13 @@ For parallel structured output calls:
258
242
  ```ts
259
243
  const [security, performance] = await Promise.all([
260
244
  mr.responses.object<SecurityReview>({
261
- model: "claude-sonnet-4-20250514",
245
+ model: "claude-sonnet-4-5",
262
246
  schema: SecuritySchema,
263
247
  system: "You are a security expert.",
264
248
  prompt: code,
265
249
  }),
266
250
  mr.responses.object<PerformanceReview>({
267
- model: "claude-sonnet-4-20250514",
251
+ model: "claude-sonnet-4-5",
268
252
  schema: PerformanceSchema,
269
253
  system: "You are a performance expert.",
270
254
  prompt: code,
@@ -277,7 +261,7 @@ For more control (retries, custom handlers, metadata):
277
261
  ```ts
278
262
  const result = await mr.responses.structured(
279
263
  Person,
280
- mr.responses.new().model("claude-sonnet-4-20250514").user("Extract: John Doe is 30").build(),
264
+ mr.responses.new().model("claude-sonnet-4-5").user("Extract: John Doe is 30").build(),
281
265
  { maxRetries: 2 },
282
266
  );
283
267
 
@@ -303,7 +287,7 @@ const Article = z.object({
303
287
 
304
288
  const stream = await mr.responses.streamStructured(
305
289
  Article,
306
- mr.responses.new().model("claude-sonnet-4-20250514").user("Write an article about TypeScript").build(),
290
+ mr.responses.new().model("claude-sonnet-4-5").user("Write an article about TypeScript").build(),
307
291
  );
308
292
 
309
293
  for await (const event of stream) {
@@ -371,7 +355,7 @@ import {
371
355
 
372
356
  try {
373
357
  const response = await mr.responses.text(
374
- "claude-sonnet-4-20250514",
358
+ "claude-sonnet-4-5",
375
359
  "You are helpful.",
376
360
  "Hello!"
377
361
  );