telnyx 7.7.0 → 7.9.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 (255) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/client.d.mts +9 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +9 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai/ai.d.mts +9 -38
  12. package/resources/ai/ai.d.mts.map +1 -1
  13. package/resources/ai/ai.d.ts +9 -38
  14. package/resources/ai/ai.d.ts.map +1 -1
  15. package/resources/ai/ai.js +4 -30
  16. package/resources/ai/ai.js.map +1 -1
  17. package/resources/ai/ai.mjs +5 -31
  18. package/resources/ai/ai.mjs.map +1 -1
  19. package/resources/ai/anthropic/anthropic.d.mts +10 -0
  20. package/resources/ai/anthropic/anthropic.d.mts.map +1 -0
  21. package/resources/ai/anthropic/anthropic.d.ts +10 -0
  22. package/resources/ai/anthropic/anthropic.d.ts.map +1 -0
  23. package/resources/ai/anthropic/anthropic.js +17 -0
  24. package/resources/ai/anthropic/anthropic.js.map +1 -0
  25. package/resources/ai/anthropic/anthropic.mjs +12 -0
  26. package/resources/ai/anthropic/anthropic.mjs.map +1 -0
  27. package/resources/ai/anthropic/index.d.mts +3 -0
  28. package/resources/ai/anthropic/index.d.mts.map +1 -0
  29. package/resources/ai/anthropic/index.d.ts +3 -0
  30. package/resources/ai/anthropic/index.d.ts.map +1 -0
  31. package/resources/ai/anthropic/index.js +9 -0
  32. package/resources/ai/anthropic/index.js.map +1 -0
  33. package/resources/ai/anthropic/index.mjs +4 -0
  34. package/resources/ai/anthropic/index.mjs.map +1 -0
  35. package/resources/ai/anthropic/v1.d.mts +148 -0
  36. package/resources/ai/anthropic/v1.d.mts.map +1 -0
  37. package/resources/ai/anthropic/v1.d.ts +148 -0
  38. package/resources/ai/anthropic/v1.d.ts.map +1 -0
  39. package/resources/ai/anthropic/v1.js +35 -0
  40. package/resources/ai/anthropic/v1.js.map +1 -0
  41. package/resources/ai/anthropic/v1.mjs +31 -0
  42. package/resources/ai/anthropic/v1.mjs.map +1 -0
  43. package/resources/ai/anthropic.d.mts +2 -0
  44. package/resources/ai/anthropic.d.mts.map +1 -0
  45. package/resources/ai/anthropic.d.ts +2 -0
  46. package/resources/ai/anthropic.d.ts.map +1 -0
  47. package/resources/ai/anthropic.js +6 -0
  48. package/resources/ai/anthropic.js.map +1 -0
  49. package/resources/ai/anthropic.mjs +3 -0
  50. package/resources/ai/anthropic.mjs.map +1 -0
  51. package/resources/ai/assistants/assistants.d.mts +58 -5
  52. package/resources/ai/assistants/assistants.d.mts.map +1 -1
  53. package/resources/ai/assistants/assistants.d.ts +58 -5
  54. package/resources/ai/assistants/assistants.d.ts.map +1 -1
  55. package/resources/ai/assistants/assistants.js +2 -2
  56. package/resources/ai/assistants/assistants.js.map +1 -1
  57. package/resources/ai/assistants/assistants.mjs +2 -2
  58. package/resources/ai/assistants/assistants.mjs.map +1 -1
  59. package/resources/ai/chat.d.mts +1 -188
  60. package/resources/ai/chat.d.mts.map +1 -1
  61. package/resources/ai/chat.d.ts +1 -188
  62. package/resources/ai/chat.d.ts.map +1 -1
  63. package/resources/ai/chat.js +0 -14
  64. package/resources/ai/chat.js.map +1 -1
  65. package/resources/ai/chat.mjs +0 -14
  66. package/resources/ai/chat.mjs.map +1 -1
  67. package/resources/ai/conversations/conversation-insights.d.mts +105 -0
  68. package/resources/ai/conversations/conversation-insights.d.mts.map +1 -0
  69. package/resources/ai/conversations/conversation-insights.d.ts +105 -0
  70. package/resources/ai/conversations/conversation-insights.d.ts.map +1 -0
  71. package/resources/ai/conversations/conversation-insights.js +24 -0
  72. package/resources/ai/conversations/conversation-insights.js.map +1 -0
  73. package/resources/ai/conversations/conversation-insights.mjs +20 -0
  74. package/resources/ai/conversations/conversation-insights.mjs.map +1 -0
  75. package/resources/ai/conversations/conversations.d.mts +4 -0
  76. package/resources/ai/conversations/conversations.d.mts.map +1 -1
  77. package/resources/ai/conversations/conversations.d.ts +4 -0
  78. package/resources/ai/conversations/conversations.d.ts.map +1 -1
  79. package/resources/ai/conversations/conversations.js +4 -0
  80. package/resources/ai/conversations/conversations.js.map +1 -1
  81. package/resources/ai/conversations/conversations.mjs +4 -0
  82. package/resources/ai/conversations/conversations.mjs.map +1 -1
  83. package/resources/ai/conversations/index.d.mts +1 -0
  84. package/resources/ai/conversations/index.d.mts.map +1 -1
  85. package/resources/ai/conversations/index.d.ts +1 -0
  86. package/resources/ai/conversations/index.d.ts.map +1 -1
  87. package/resources/ai/conversations/index.js +3 -1
  88. package/resources/ai/conversations/index.js.map +1 -1
  89. package/resources/ai/conversations/index.mjs +1 -0
  90. package/resources/ai/conversations/index.mjs.map +1 -1
  91. package/resources/ai/index.d.mts +4 -3
  92. package/resources/ai/index.d.mts.map +1 -1
  93. package/resources/ai/index.d.ts +4 -3
  94. package/resources/ai/index.d.ts.map +1 -1
  95. package/resources/ai/index.js +17 -15
  96. package/resources/ai/index.js.map +1 -1
  97. package/resources/ai/index.mjs +2 -1
  98. package/resources/ai/index.mjs.map +1 -1
  99. package/resources/ai/tools.d.mts +28 -1
  100. package/resources/ai/tools.d.mts.map +1 -1
  101. package/resources/ai/tools.d.ts +28 -1
  102. package/resources/ai/tools.d.ts.map +1 -1
  103. package/resources/calls/actions.d.mts +31 -5
  104. package/resources/calls/actions.d.mts.map +1 -1
  105. package/resources/calls/actions.d.ts +31 -5
  106. package/resources/calls/actions.d.ts.map +1 -1
  107. package/resources/calls/calls.d.mts +11 -0
  108. package/resources/calls/calls.d.mts.map +1 -1
  109. package/resources/calls/calls.d.ts +11 -0
  110. package/resources/calls/calls.d.ts.map +1 -1
  111. package/resources/calls/calls.js.map +1 -1
  112. package/resources/calls/calls.mjs.map +1 -1
  113. package/resources/conferences/actions.d.mts +6 -0
  114. package/resources/conferences/actions.d.mts.map +1 -1
  115. package/resources/conferences/actions.d.ts +6 -0
  116. package/resources/conferences/actions.d.ts.map +1 -1
  117. package/resources/index.d.mts +3 -3
  118. package/resources/index.d.mts.map +1 -1
  119. package/resources/index.d.ts +3 -3
  120. package/resources/index.d.ts.map +1 -1
  121. package/resources/index.js.map +1 -1
  122. package/resources/index.mjs.map +1 -1
  123. package/resources/managed-accounts/managed-accounts.d.mts +11 -2
  124. package/resources/managed-accounts/managed-accounts.d.mts.map +1 -1
  125. package/resources/managed-accounts/managed-accounts.d.ts +11 -2
  126. package/resources/managed-accounts/managed-accounts.d.ts.map +1 -1
  127. package/resources/managed-accounts/managed-accounts.js.map +1 -1
  128. package/resources/managed-accounts/managed-accounts.mjs.map +1 -1
  129. package/resources/messages/index.d.mts +1 -1
  130. package/resources/messages/index.d.mts.map +1 -1
  131. package/resources/messages/index.d.ts +1 -1
  132. package/resources/messages/index.d.ts.map +1 -1
  133. package/resources/messages/index.js.map +1 -1
  134. package/resources/messages/index.mjs.map +1 -1
  135. package/resources/messages/messages.d.mts +4 -82
  136. package/resources/messages/messages.d.mts.map +1 -1
  137. package/resources/messages/messages.d.ts +4 -82
  138. package/resources/messages/messages.d.ts.map +1 -1
  139. package/resources/messages/messages.js +3 -15
  140. package/resources/messages/messages.js.map +1 -1
  141. package/resources/messages/messages.mjs +3 -15
  142. package/resources/messages/messages.mjs.map +1 -1
  143. package/resources/phone-numbers/phone-numbers.d.mts +21 -0
  144. package/resources/phone-numbers/phone-numbers.d.mts.map +1 -1
  145. package/resources/phone-numbers/phone-numbers.d.ts +21 -0
  146. package/resources/phone-numbers/phone-numbers.d.ts.map +1 -1
  147. package/resources/phone-numbers/phone-numbers.js.map +1 -1
  148. package/resources/phone-numbers/phone-numbers.mjs.map +1 -1
  149. package/resources/requirements.d.mts +28 -3
  150. package/resources/requirements.d.mts.map +1 -1
  151. package/resources/requirements.d.ts +28 -3
  152. package/resources/requirements.d.ts.map +1 -1
  153. package/resources/requirements.js +2 -2
  154. package/resources/requirements.js.map +1 -1
  155. package/resources/requirements.mjs +2 -2
  156. package/resources/requirements.mjs.map +1 -1
  157. package/resources/speech-to-text/speech-to-text.d.mts +1 -1
  158. package/resources/speech-to-text/speech-to-text.d.mts.map +1 -1
  159. package/resources/speech-to-text/speech-to-text.d.ts +1 -1
  160. package/resources/speech-to-text/speech-to-text.d.ts.map +1 -1
  161. package/resources/storage/cloudfs/actions.d.mts +43 -0
  162. package/resources/storage/cloudfs/actions.d.mts.map +1 -0
  163. package/resources/storage/cloudfs/actions.d.ts +43 -0
  164. package/resources/storage/cloudfs/actions.d.ts.map +1 -0
  165. package/resources/storage/cloudfs/actions.js +39 -0
  166. package/resources/storage/cloudfs/actions.js.map +1 -0
  167. package/resources/storage/cloudfs/actions.mjs +35 -0
  168. package/resources/storage/cloudfs/actions.mjs.map +1 -0
  169. package/resources/storage/cloudfs/cloudfs.d.mts +345 -0
  170. package/resources/storage/cloudfs/cloudfs.d.mts.map +1 -0
  171. package/resources/storage/cloudfs/cloudfs.d.ts +345 -0
  172. package/resources/storage/cloudfs/cloudfs.d.ts.map +1 -0
  173. package/resources/storage/cloudfs/cloudfs.js +116 -0
  174. package/resources/storage/cloudfs/cloudfs.js.map +1 -0
  175. package/resources/storage/cloudfs/cloudfs.mjs +111 -0
  176. package/resources/storage/cloudfs/cloudfs.mjs.map +1 -0
  177. package/resources/storage/cloudfs/index.d.mts +3 -0
  178. package/resources/storage/cloudfs/index.d.mts.map +1 -0
  179. package/resources/storage/cloudfs/index.d.ts +3 -0
  180. package/resources/storage/cloudfs/index.d.ts.map +1 -0
  181. package/resources/storage/cloudfs/index.js +9 -0
  182. package/resources/storage/cloudfs/index.js.map +1 -0
  183. package/resources/storage/cloudfs/index.mjs +4 -0
  184. package/resources/storage/cloudfs/index.mjs.map +1 -0
  185. package/resources/storage/cloudfs.d.mts +2 -0
  186. package/resources/storage/cloudfs.d.mts.map +1 -0
  187. package/resources/storage/cloudfs.d.ts +2 -0
  188. package/resources/storage/cloudfs.d.ts.map +1 -0
  189. package/resources/storage/cloudfs.js +6 -0
  190. package/resources/storage/cloudfs.js.map +1 -0
  191. package/resources/storage/cloudfs.mjs +3 -0
  192. package/resources/storage/cloudfs.mjs.map +1 -0
  193. package/resources/storage/index.d.mts +1 -0
  194. package/resources/storage/index.d.mts.map +1 -1
  195. package/resources/storage/index.d.ts +1 -0
  196. package/resources/storage/index.d.ts.map +1 -1
  197. package/resources/storage/index.js +7 -5
  198. package/resources/storage/index.js.map +1 -1
  199. package/resources/storage/index.mjs +1 -0
  200. package/resources/storage/index.mjs.map +1 -1
  201. package/resources/storage/storage.d.mts +4 -0
  202. package/resources/storage/storage.d.mts.map +1 -1
  203. package/resources/storage/storage.d.ts +4 -0
  204. package/resources/storage/storage.d.ts.map +1 -1
  205. package/resources/storage/storage.js +4 -0
  206. package/resources/storage/storage.js.map +1 -1
  207. package/resources/storage/storage.mjs +4 -0
  208. package/resources/storage/storage.mjs.map +1 -1
  209. package/resources/text-to-speech/text-to-speech.d.mts +16 -11
  210. package/resources/text-to-speech/text-to-speech.d.mts.map +1 -1
  211. package/resources/text-to-speech/text-to-speech.d.ts +16 -11
  212. package/resources/text-to-speech/text-to-speech.d.ts.map +1 -1
  213. package/resources/verify-profiles.d.mts +3 -3
  214. package/resources/verify-profiles.d.ts +3 -3
  215. package/resources/webhooks.d.mts +125 -19
  216. package/resources/webhooks.d.mts.map +1 -1
  217. package/resources/webhooks.d.ts +125 -19
  218. package/resources/webhooks.d.ts.map +1 -1
  219. package/src/client.ts +5 -8
  220. package/src/resources/ai/ai.ts +10 -57
  221. package/src/resources/ai/anthropic/anthropic.ts +19 -0
  222. package/src/resources/ai/anthropic/index.ts +4 -0
  223. package/src/resources/ai/anthropic/v1.ts +157 -0
  224. package/src/resources/ai/anthropic.ts +3 -0
  225. package/src/resources/ai/assistants/assistants.ts +68 -5
  226. package/src/resources/ai/chat.ts +2 -234
  227. package/src/resources/ai/conversations/conversation-insights.ts +125 -0
  228. package/src/resources/ai/conversations/conversations.ts +15 -0
  229. package/src/resources/ai/conversations/index.ts +5 -0
  230. package/src/resources/ai/index.ts +3 -9
  231. package/src/resources/ai/tools.ts +32 -0
  232. package/src/resources/calls/actions.ts +31 -5
  233. package/src/resources/calls/calls.ts +12 -0
  234. package/src/resources/conferences/actions.ts +6 -0
  235. package/src/resources/index.ts +1 -4
  236. package/src/resources/managed-accounts/managed-accounts.ts +13 -2
  237. package/src/resources/messages/index.ts +0 -2
  238. package/src/resources/messages/messages.ts +3 -112
  239. package/src/resources/phone-numbers/phone-numbers.ts +24 -0
  240. package/src/resources/requirements.ts +38 -3
  241. package/src/resources/speech-to-text/speech-to-text.ts +1 -1
  242. package/src/resources/storage/cloudfs/actions.ts +59 -0
  243. package/src/resources/storage/cloudfs/cloudfs.ts +446 -0
  244. package/src/resources/storage/cloudfs/index.ts +13 -0
  245. package/src/resources/storage/cloudfs.ts +3 -0
  246. package/src/resources/storage/index.ts +10 -0
  247. package/src/resources/storage/storage.ts +24 -0
  248. package/src/resources/text-to-speech/text-to-speech.ts +16 -11
  249. package/src/resources/verify-profiles.ts +3 -3
  250. package/src/resources/webhooks.ts +152 -11
  251. package/src/version.ts +1 -1
  252. package/version.d.mts +1 -1
  253. package/version.d.ts +1 -1
  254. package/version.js +1 -1
  255. package/version.mjs +1 -1
@@ -0,0 +1,157 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+
7
+ export class V1 extends APIResource {
8
+ /**
9
+ * Send a message to a language model using the Anthropic Messages API format. This
10
+ * endpoint is compatible with the
11
+ * [Anthropic Messages API](https://docs.anthropic.com/en/api/messages) and may be
12
+ * used with the Anthropic JS or Python SDK by setting the base URL to
13
+ * `https://api.telnyx.com/v2/ai/anthropic`.
14
+ *
15
+ * The endpoint translates Anthropic-format requests into Telnyx's inference
16
+ * internals, then translates the response back to the Anthropic message shape.
17
+ * Streaming responses use Anthropic SSE event types (`message_start`,
18
+ * `content_block_start`, `content_block_delta`, `content_block_stop`,
19
+ * `message_delta`, `message_stop`).
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const response = await client.ai.anthropic.v1.messages({
24
+ * max_tokens: 1024,
25
+ * messages: [{ role: 'user', content: 'Hello, world!' }],
26
+ * model: 'zai-org/GLM-5.2',
27
+ * system: 'You are a friendly chatbot.',
28
+ * });
29
+ * ```
30
+ */
31
+ messages(body: V1MessagesParams, options?: RequestOptions): APIPromise<V1MessagesResponse> {
32
+ return this._client.post('/ai/anthropic/v1/messages', { body, ...options });
33
+ }
34
+ }
35
+
36
+ /**
37
+ * An Anthropic-format message response with `type: "message"`, `role`, `content`,
38
+ * `stop_reason`, `stop_sequence`, and `usage`. When `stream` is true, the response
39
+ * is a text/event-stream of Anthropic SSE events.
40
+ */
41
+ export type V1MessagesResponse = { [key: string]: unknown };
42
+
43
+ export interface V1MessagesParams {
44
+ /**
45
+ * The maximum number of tokens to generate in the response.
46
+ */
47
+ max_tokens: number;
48
+
49
+ /**
50
+ * The messages to send to the model, following the
51
+ * [Anthropic Messages API](https://docs.anthropic.com/en/api/messages) format.
52
+ */
53
+ messages: Array<{ [key: string]: unknown }>;
54
+
55
+ /**
56
+ * The model to use for generating the response, for example `zai-org/GLM-5.2` or
57
+ * another model available from the Telnyx models endpoint.
58
+ */
59
+ model: string;
60
+
61
+ /**
62
+ * If you are using an external inference provider, this field allows you to pass
63
+ * along a reference to your API key. After creating an
64
+ * [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
65
+ * for your API key, pass the secret's `identifier` in this field.
66
+ */
67
+ api_key_ref?: string;
68
+
69
+ /**
70
+ * The billing group ID to associate with this request.
71
+ */
72
+ billing_group_id?: string;
73
+
74
+ /**
75
+ * Configuration for model fallback behavior when the primary model is unavailable.
76
+ */
77
+ fallback_config?: { [key: string]: unknown };
78
+
79
+ /**
80
+ * Maximum number of retries for the request.
81
+ */
82
+ max_retries?: number;
83
+
84
+ /**
85
+ * List of MCP (Model Context Protocol) servers to make available to the model.
86
+ */
87
+ mcp_servers?: Array<{ [key: string]: unknown }>;
88
+
89
+ /**
90
+ * An object describing metadata about the request.
91
+ */
92
+ metadata?: { [key: string]: unknown };
93
+
94
+ /**
95
+ * Service tier for the request.
96
+ */
97
+ service_tier?: string;
98
+
99
+ /**
100
+ * Custom sequences that will cause the model to stop generating.
101
+ */
102
+ stop_sequences?: Array<string>;
103
+
104
+ /**
105
+ * Whether to stream the response as Anthropic-format Server-Sent Events.
106
+ */
107
+ stream?: boolean;
108
+
109
+ /**
110
+ * System prompt. Can be a string or an array of content blocks following the
111
+ * Anthropic API format.
112
+ */
113
+ system?: string | Array<{ [key: string]: unknown }>;
114
+
115
+ /**
116
+ * Amount of randomness injected into the response. Ranges from 0 to 1.
117
+ */
118
+ temperature?: number;
119
+
120
+ /**
121
+ * Extended thinking configuration for models that support it. Set `type` to
122
+ * `enabled` to turn on extended thinking.
123
+ */
124
+ thinking?: { [key: string]: unknown };
125
+
126
+ /**
127
+ * Request timeout in seconds.
128
+ */
129
+ timeout?: number;
130
+
131
+ /**
132
+ * Controls how the model uses tools, following the Anthropic API format.
133
+ */
134
+ tool_choice?: { [key: string]: unknown };
135
+
136
+ /**
137
+ * Definitions of tools that the model may use, following the Anthropic API format.
138
+ */
139
+ tools?: Array<{ [key: string]: unknown }>;
140
+
141
+ /**
142
+ * Top-k sampling parameter. Only sample from the top K options for each subsequent
143
+ * token.
144
+ */
145
+ top_k?: number;
146
+
147
+ /**
148
+ * Nucleus sampling parameter. Use temperature or top_p, but not both.
149
+ */
150
+ top_p?: number;
151
+
152
+ [k: string]: unknown;
153
+ }
154
+
155
+ export declare namespace V1 {
156
+ export { type V1MessagesResponse as V1MessagesResponse, type V1MessagesParams as V1MessagesParams };
157
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './anthropic/index';
@@ -4,6 +4,7 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as AssistantsAPI from './assistants';
5
5
  import * as Shared from '../../shared';
6
6
  import * as ChatAPI from '../chat';
7
+ import * as ToolsAPI from '../tools';
7
8
  import * as CanaryDeploysAPI from './canary-deploys';
8
9
  import {
9
10
  CanaryDeploy,
@@ -37,7 +38,7 @@ import {
37
38
  } from './scheduled-events';
38
39
  import * as TagsAPI from './tags';
39
40
  import { TagAddParams, TagRemoveParams, Tags, TagsResponse } from './tags';
40
- import * as ToolsAPI from './tools';
41
+ import * as AssistantsToolsAPI from './tools';
41
42
  import {
42
43
  ToolAddParams,
43
44
  ToolAddResponse,
@@ -77,7 +78,7 @@ export class Assistants extends APIResource {
77
78
  tests: TestsAPI.Tests = new TestsAPI.Tests(this._client);
78
79
  canaryDeploys: CanaryDeploysAPI.CanaryDeploys = new CanaryDeploysAPI.CanaryDeploys(this._client);
79
80
  scheduledEvents: ScheduledEventsAPI.ScheduledEvents = new ScheduledEventsAPI.ScheduledEvents(this._client);
80
- tools: ToolsAPI.Tools = new ToolsAPI.Tools(this._client);
81
+ tools: AssistantsToolsAPI.Tools = new AssistantsToolsAPI.Tools(this._client);
81
82
  versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client);
82
83
  tags: TagsAPI.Tags = new TagsAPI.Tags(this._client);
83
84
  instructions: InstructionsAPI.Instructions = new InstructionsAPI.Instructions(this._client);
@@ -375,6 +376,7 @@ export interface AssistantMcpServer {
375
376
  */
376
377
  export type AssistantTool =
377
378
  | InferenceEmbeddingWebhookToolParams
379
+ | AssistantTool.ClientSideTool
378
380
  | RetrievalTool
379
381
  | AssistantTool.Handoff
380
382
  | HangupTool
@@ -383,9 +385,58 @@ export type AssistantTool =
383
385
  | AssistantTool.Refer
384
386
  | AssistantTool.SendDtmf
385
387
  | AssistantTool.SendMessage
386
- | AssistantTool.SkipTurn;
388
+ | AssistantTool.SkipTurn
389
+ | AssistantTool.Pay;
387
390
 
388
391
  export namespace AssistantTool {
392
+ export interface ClientSideTool {
393
+ client_side_tool: ClientSideTool.ClientSideTool;
394
+
395
+ type: 'client_side_tool';
396
+ }
397
+
398
+ export namespace ClientSideTool {
399
+ export interface ClientSideTool {
400
+ /**
401
+ * The description of the tool.
402
+ */
403
+ description: string;
404
+
405
+ /**
406
+ * The name of the tool.
407
+ */
408
+ name: string;
409
+
410
+ /**
411
+ * The parameters the tool accepts, described as a JSON Schema object. See the
412
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema) for
413
+ * documentation about the format
414
+ */
415
+ parameters: ClientSideTool.Parameters;
416
+ }
417
+
418
+ export namespace ClientSideTool {
419
+ /**
420
+ * The parameters the tool accepts, described as a JSON Schema object. See the
421
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema) for
422
+ * documentation about the format
423
+ */
424
+ export interface Parameters {
425
+ /**
426
+ * The properties of the parameters.
427
+ */
428
+ properties?: { [key: string]: unknown };
429
+
430
+ /**
431
+ * The required properties of the parameters.
432
+ */
433
+ required?: Array<string>;
434
+
435
+ type?: 'object';
436
+ }
437
+ }
438
+ }
439
+
389
440
  /**
390
441
  * The handoff tool allows the assistant to hand off control of the conversation to
391
442
  * another AI assistant. By default, this will happen transparently to the end
@@ -850,6 +901,18 @@ export namespace AssistantTool {
850
901
  description?: string;
851
902
  }
852
903
  }
904
+
905
+ /**
906
+ * (BETA) The pay tool allows the assistant to collect card payments from the
907
+ * caller via DTMF during the conversation. Recording is automatically paused while
908
+ * the pay tool is active and resumes when the payment flow completes. The
909
+ * connector_name must reference a pay connector configured in the Telnyx API.
910
+ */
911
+ export interface Pay {
912
+ pay: ToolsAPI.PayToolParams;
913
+
914
+ type: 'pay';
915
+ }
853
916
  }
854
917
 
855
918
  export interface AssistantsList {
@@ -2465,7 +2528,7 @@ export interface TranscriptionSettings {
2465
2528
  * - `xai/grok-stt` is a multilingual Grok STT model.
2466
2529
  * - `soniox/stt-rt-v4` is a multilingual streaming model with automatic language
2467
2530
  * detection and configurable endpointing.
2468
- * - `parakeet/tdt-0.6b-v3` is a multilingual transcription model with automatic
2531
+ * - `nvidia/parakeet-v3` is a multilingual transcription model with automatic
2469
2532
  * language detection.
2470
2533
  */
2471
2534
  model?:
@@ -2476,7 +2539,7 @@ export interface TranscriptionSettings {
2476
2539
  | 'assemblyai/universal-streaming'
2477
2540
  | 'xai/grok-stt'
2478
2541
  | 'soniox/stt-rt-v4'
2479
- | 'parakeet/tdt-0.6b-v3'
2542
+ | 'nvidia/parakeet-v3'
2480
2543
  | 'distil-whisper/distil-large-v2'
2481
2544
  | 'openai/whisper-large-v3-turbo';
2482
2545
 
@@ -2,28 +2,8 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as ChatAPI from './chat';
5
- import { APIPromise } from '../../core/api-promise';
6
- import { RequestOptions } from '../../internal/request-options';
7
5
 
8
- /**
9
- * Generate text with LLMs
10
- */
11
- export class Chat extends APIResource {
12
- /**
13
- * **Deprecated**: Use `POST /v2/ai/openai/chat/completions` instead. Chat with a
14
- * language model. This endpoint is consistent with the
15
- * [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
16
- * and may be used with the OpenAI JS or Python SDK.
17
- *
18
- * @deprecated
19
- */
20
- createCompletion(
21
- body: ChatCreateCompletionParams,
22
- options?: RequestOptions,
23
- ): APIPromise<ChatCreateCompletionResponse> {
24
- return this._client.post('/ai/chat/completions', { body, ...options });
25
- }
26
- }
6
+ export class Chat extends APIResource {}
27
7
 
28
8
  export interface BucketIDs {
29
9
  /**
@@ -244,218 +224,6 @@ export namespace ChatCompletionRequest {
244
224
  }
245
225
  }
246
226
 
247
- export type ChatCreateCompletionResponse = { [key: string]: unknown };
248
-
249
- export interface ChatCreateCompletionParams {
250
- /**
251
- * A list of the previous chat messages for context.
252
- */
253
- messages: Array<ChatCreateCompletionParams.Message>;
254
-
255
- /**
256
- * If you are using an external inference provider like xAI or OpenAI, this field
257
- * allows you to pass along a reference to your API key. After creating an
258
- * [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
259
- * for you API key, pass the secret's `identifier` in this field.
260
- */
261
- api_key_ref?: string;
262
-
263
- /**
264
- * This is used with `use_beam_search` to determine how many candidate beams to
265
- * explore.
266
- */
267
- best_of?: number;
268
-
269
- /**
270
- * This is used with `use_beam_search`. If `true`, generation stops as soon as
271
- * there are `best_of` complete candidates; if `false`, a heuristic is applied and
272
- * the generation stops when is it very unlikely to find better candidates.
273
- */
274
- early_stopping?: boolean;
275
-
276
- /**
277
- * Whether to enable the thinking/reasoning phase for models that support it (e.g.,
278
- * QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
279
- * and respond directly, which can reduce latency. Defaults to true.
280
- */
281
- enable_thinking?: boolean;
282
-
283
- /**
284
- * Higher values will penalize the model from repeating the same output tokens.
285
- */
286
- frequency_penalty?: number;
287
-
288
- /**
289
- * If specified, the output will be exactly one of the choices.
290
- */
291
- guided_choice?: Array<string>;
292
-
293
- /**
294
- * Must be a valid JSON schema. If specified, the output will follow the JSON
295
- * schema.
296
- */
297
- guided_json?: { [key: string]: unknown };
298
-
299
- /**
300
- * If specified, the output will follow the regex pattern.
301
- */
302
- guided_regex?: string;
303
-
304
- /**
305
- * This is used with `use_beam_search` to prefer shorter or longer completions.
306
- */
307
- length_penalty?: number;
308
-
309
- /**
310
- * Whether to return log probabilities of the output tokens or not. If true,
311
- * returns the log probabilities of each output token returned in the `content` of
312
- * `message`.
313
- */
314
- logprobs?: boolean;
315
-
316
- /**
317
- * Maximum number of completion tokens the model should generate.
318
- */
319
- max_tokens?: number;
320
-
321
- /**
322
- * This is an alternative to `top_p` that
323
- * [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
324
- * in [0, 1].
325
- */
326
- min_p?: number;
327
-
328
- /**
329
- * The language model to chat with.
330
- */
331
- model?: string;
332
-
333
- /**
334
- * This will return multiple choices for you instead of a single chat completion.
335
- */
336
- n?: number;
337
-
338
- /**
339
- * Higher values will penalize the model from repeating the same output tokens.
340
- */
341
- presence_penalty?: number;
342
-
343
- /**
344
- * Use this is you want to guarantee a JSON output without defining a schema. For
345
- * control over the schema, use `guided_json`.
346
- */
347
- response_format?: ChatCreateCompletionParams.ResponseFormat;
348
-
349
- /**
350
- * If specified, the system will make a best effort to sample deterministically,
351
- * such that repeated requests with the same `seed` and parameters should return
352
- * the same result.
353
- */
354
- seed?: number;
355
-
356
- /**
357
- * Up to 4 sequences where the API will stop generating further tokens. The
358
- * returned text will not contain the stop sequence.
359
- */
360
- stop?: string | Array<string>;
361
-
362
- /**
363
- * Whether or not to stream data-only server-sent events as they become available.
364
- */
365
- stream?: boolean;
366
-
367
- /**
368
- * Adjusts the "creativity" of the model. Lower values make the model more
369
- * deterministic and repetitive, while higher values make the model more random and
370
- * creative.
371
- */
372
- temperature?: number;
373
-
374
- tool_choice?: 'none' | 'auto' | 'required';
375
-
376
- /**
377
- * The `function` tool type follows the same schema as the
378
- * [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
379
- * The `retrieval` tool type is unique to Telnyx. You may pass a list of
380
- * [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
381
- * for retrieval-augmented generation.
382
- */
383
- tools?: Array<ChatCreateCompletionParams.Function | ChatCreateCompletionParams.Retrieval>;
384
-
385
- /**
386
- * This is used with `logprobs`. An integer between 0 and 20 specifying the number
387
- * of most likely tokens to return at each token position, each with an associated
388
- * log probability.
389
- */
390
- top_logprobs?: number;
391
-
392
- /**
393
- * An alternative or complement to `temperature`. This adjusts how many of the top
394
- * possibilities to consider.
395
- */
396
- top_p?: number;
397
-
398
- /**
399
- * Setting this to `true` will allow the model to
400
- * [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
401
- * This is not supported by OpenAI.
402
- */
403
- use_beam_search?: boolean;
404
- }
405
-
406
- export namespace ChatCreateCompletionParams {
407
- export interface Message {
408
- content: string | Array<Message.TextAndImageArray>;
409
-
410
- role: 'system' | 'user' | 'assistant' | 'tool';
411
- }
412
-
413
- export namespace Message {
414
- export interface TextAndImageArray {
415
- type: 'text' | 'image_url';
416
-
417
- image_url?: string;
418
-
419
- text?: string;
420
- }
421
- }
422
-
423
- /**
424
- * Use this is you want to guarantee a JSON output without defining a schema. For
425
- * control over the schema, use `guided_json`.
426
- */
427
- export interface ResponseFormat {
428
- type: 'text' | 'json_object';
429
- }
430
-
431
- export interface Function {
432
- function: Function.Function;
433
-
434
- type: 'function';
435
- }
436
-
437
- export namespace Function {
438
- export interface Function {
439
- name: string;
440
-
441
- description?: string;
442
-
443
- parameters?: { [key: string]: unknown };
444
- }
445
- }
446
-
447
- export interface Retrieval {
448
- retrieval: ChatAPI.BucketIDs;
449
-
450
- type: 'retrieval';
451
- }
452
- }
453
-
454
227
  export declare namespace Chat {
455
- export {
456
- type BucketIDs as BucketIDs,
457
- type ChatCompletionRequest as ChatCompletionRequest,
458
- type ChatCreateCompletionResponse as ChatCreateCompletionResponse,
459
- type ChatCreateCompletionParams as ChatCreateCompletionParams,
460
- };
228
+ export { type BucketIDs as BucketIDs, type ChatCompletionRequest as ChatCompletionRequest };
461
229
  }
@@ -0,0 +1,125 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+
7
+ /**
8
+ * Manage historical AI assistant conversations
9
+ */
10
+ export class ConversationInsights extends APIResource {
11
+ /**
12
+ * Aggregate conversation insights by specified fields
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const response =
17
+ * await client.ai.conversations.conversationInsights.retrieveAggregates();
18
+ * ```
19
+ */
20
+ retrieveAggregates(
21
+ query: ConversationInsightRetrieveAggregatesParams | null | undefined = {},
22
+ options?: RequestOptions,
23
+ ): APIPromise<ConversationInsightRetrieveAggregatesResponse> {
24
+ return this._client.get('/ai/conversations/conversation-insights/aggregates', { query, ...options });
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Aggregated conversation insight counts grouped by the specified fields. Each
30
+ * item in `data` contains the grouped field values and a `record_count` indicating
31
+ * how many conversation insights match that combination.
32
+ */
33
+ export interface ConversationInsightRetrieveAggregatesResponse {
34
+ /**
35
+ * Aggregation result rows. Each row contains the grouped field values and a
36
+ * `record_count`.
37
+ */
38
+ data: Array<ConversationInsightRetrieveAggregatesResponse.Data>;
39
+ }
40
+
41
+ export namespace ConversationInsightRetrieveAggregatesResponse {
42
+ /**
43
+ * An aggregation row. Contains the grouped field values (keyed by the group_by
44
+ * field names) and a `record_count` integer. For example, when grouping by
45
+ * `score`, each row has a `score` value and a `record_count` of conversations with
46
+ * that score. When also splitting by `metadata.assistant_version_id`, each row
47
+ * includes both `score` and `metadata.assistant_version_id` plus their combined
48
+ * `record_count`.
49
+ */
50
+ export interface Data {
51
+ /**
52
+ * Number of conversation insights that match this combination of grouped field
53
+ * values.
54
+ */
55
+ record_count: number;
56
+
57
+ [k: string]: unknown;
58
+ }
59
+ }
60
+
61
+ export interface ConversationInsightRetrieveAggregatesParams {
62
+ /**
63
+ * Filter by creation datetime to scope the aggregation window. Supports range
64
+ * operators (e.g., `created_at=gte.2025-01-01T00:00:00Z` for the start of the
65
+ * range, `created_at=lt.2025-01-02T00:00:00Z` for the end). To build per-day time
66
+ * series (as the portal does for the 'Insights Over Time' chart), issue one
67
+ * request per day bounded by `created_at=gte.<day_start>` and
68
+ * `created_at=lt.<next_day_start>`.
69
+ */
70
+ created_at?: string;
71
+
72
+ /**
73
+ * Fields to group by (can be comma-separated or multiple parameters). Prefix a
74
+ * field with 'metadata.' (e.g. 'metadata.assistant_id') to group by the
75
+ * conversation's metadata instead of the insight result.
76
+ *
77
+ * Common fields used for over-time charts:
78
+ *
79
+ * - `score` — Group by the insight's score value (e.g. for Agent Instruction
80
+ * Following, User Satisfaction).
81
+ * - `metadata.assistant_id` — Group by the assistant that handled the
82
+ * conversation.
83
+ * - `metadata.assistant_version_id` — Group by the assistant version, useful for
84
+ * comparing performance across versions in the portal's 'Insights Over Time'
85
+ * chart.
86
+ * - `metadata.telnyx_conversation_channel` — Group by conversation channel
87
+ * (phone_call, web_chat, etc.).
88
+ */
89
+ group_by?: Array<string>;
90
+
91
+ /**
92
+ * Optional insight ID to filter conversation insights. Only insights matching this
93
+ * ID will be included in the aggregation.
94
+ */
95
+ insight_id?: string;
96
+
97
+ metadata?: ConversationInsightRetrieveAggregatesParams.Metadata;
98
+
99
+ /**
100
+ * Fields to include in the result (can be comma-separated or multiple parameters).
101
+ * Supports the same 'metadata.<key>' prefix as group_by. Each returned row will
102
+ * contain the grouped field values plus a `record_count` indicating how many
103
+ * conversation insights match that combination.
104
+ */
105
+ show?: Array<string>;
106
+ }
107
+
108
+ export namespace ConversationInsightRetrieveAggregatesParams {
109
+ export interface Metadata {
110
+ /**
111
+ * Filter by assistant ID (e.g., `metadata.assistant_id=eq.<assistant_id>`). When
112
+ * provided, only conversation insights for the specified assistant are aggregated.
113
+ * Used by the portal to scope the 'Insights Over Time' chart to a single
114
+ * assistant.
115
+ */
116
+ assistant_id?: string;
117
+ }
118
+ }
119
+
120
+ export declare namespace ConversationInsights {
121
+ export {
122
+ type ConversationInsightRetrieveAggregatesResponse as ConversationInsightRetrieveAggregatesResponse,
123
+ type ConversationInsightRetrieveAggregatesParams as ConversationInsightRetrieveAggregatesParams,
124
+ };
125
+ }
@@ -1,6 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
+ import * as ConversationInsightsAPI from './conversation-insights';
5
+ import {
6
+ ConversationInsightRetrieveAggregatesParams,
7
+ ConversationInsightRetrieveAggregatesResponse,
8
+ ConversationInsights,
9
+ } from './conversation-insights';
4
10
  import * as InsightsAPI from './insights';
5
11
  import {
6
12
  InsightCreateParams,
@@ -41,6 +47,8 @@ export class Conversations extends APIResource {
41
47
  insightGroups: InsightGroupsAPI.InsightGroups = new InsightGroupsAPI.InsightGroups(this._client);
42
48
  insights: InsightsAPI.Insights = new InsightsAPI.Insights(this._client);
43
49
  messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
50
+ conversationInsights: ConversationInsightsAPI.ConversationInsights =
51
+ new ConversationInsightsAPI.ConversationInsights(this._client);
44
52
 
45
53
  /**
46
54
  * Retrieve a list of all AI conversations configured by the user. Supports
@@ -354,6 +362,7 @@ export interface ConversationAddMessageParams {
354
362
  Conversations.InsightGroups = InsightGroups;
355
363
  Conversations.Insights = Insights;
356
364
  Conversations.Messages = Messages;
365
+ Conversations.ConversationInsights = ConversationInsights;
357
366
 
358
367
  export declare namespace Conversations {
359
368
  export {
@@ -394,4 +403,10 @@ export declare namespace Conversations {
394
403
  type MessageListResponsesDefaultFlatPagination as MessageListResponsesDefaultFlatPagination,
395
404
  type MessageListParams as MessageListParams,
396
405
  };
406
+
407
+ export {
408
+ ConversationInsights as ConversationInsights,
409
+ type ConversationInsightRetrieveAggregatesResponse as ConversationInsightRetrieveAggregatesResponse,
410
+ type ConversationInsightRetrieveAggregatesParams as ConversationInsightRetrieveAggregatesParams,
411
+ };
397
412
  }