@dtelecom/x402-client 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 dTelecom
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # @dtelecom/x402-client
2
+
3
+ TypeScript SDK for the [dTelecom x402 gateway](https://x402.dtelecom.org) — buy credits with USDC and create WebRTC, STT, and TTS sessions for AI agents.
4
+
5
+ Uses the [x402 HTTP payment protocol](https://www.x402.org/) for on-chain micropayments on Base.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @dtelecom/x402-client @x402/fetch @x402/evm viem
11
+ ```
12
+
13
+ `@x402/fetch` and `@x402/evm` are peer dependencies — they handle the 402 payment flow.
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { DtelecomGateway } from '@dtelecom/x402-client';
19
+ import { privateKeyToAccount } from 'viem/accounts';
20
+
21
+ const gateway = new DtelecomGateway({
22
+ gatewayUrl: 'https://x402.dtelecom.org',
23
+ account: privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`),
24
+ });
25
+
26
+ // Buy credits ($0.10 USDC on Base)
27
+ const purchase = await gateway.buyCredits({ amountUsd: 0.10 });
28
+ console.log(`Credits: ${purchase.creditedMicrocredits}`);
29
+
30
+ // Create agent session (WebRTC + STT + TTS bundle)
31
+ const session = await gateway.createAgentSession({
32
+ roomName: 'tutor-room-123',
33
+ participantIdentity: 'student-1',
34
+ durationMinutes: 10,
35
+ language: 'en',
36
+ });
37
+
38
+ console.log(session.webrtc.token); // JWT for WebRTC SFU
39
+ console.log(session.stt.token); // Token for STT server
40
+ console.log(session.tts.token); // Token for TTS server
41
+ ```
42
+
43
+ ## Wallet Support
44
+
45
+ The SDK accepts a viem `LocalAccount` — the standard interface for server-side wallets:
46
+
47
+ ```typescript
48
+ // Private key
49
+ import { privateKeyToAccount } from 'viem/accounts';
50
+ const account = privateKeyToAccount('0x...');
51
+
52
+ // Coinbase CDP server wallet
53
+ import { toAccount } from 'viem/accounts';
54
+ const account = toAccount(cdpServerAccount);
55
+
56
+ // AWS/GCP KMS via viem adapters
57
+ const account = await createKmsAccount({ ... });
58
+ ```
59
+
60
+ ## API
61
+
62
+ ### Constructor
63
+
64
+ ```typescript
65
+ new DtelecomGateway({ gatewayUrl: string, account: LocalAccount })
66
+ ```
67
+
68
+ ### Credits
69
+
70
+ | Method | Description |
71
+ |--------|-------------|
72
+ | `buyCredits({ amountUsd })` | Purchase credits via x402 USDC payment on Base |
73
+
74
+ ### Account
75
+
76
+ | Method | Description |
77
+ |--------|-------------|
78
+ | `getAccount()` | Get account details and balance |
79
+ | `getTransactions({ limit?, offset? })` | List credit transactions |
80
+ | `getSessions({ limit?, offset?, status? })` | List sessions |
81
+
82
+ ### Agent Session (WebRTC + STT + TTS bundle)
83
+
84
+ | Method | Description |
85
+ |--------|-------------|
86
+ | `createAgentSession({ roomName, participantIdentity, durationMinutes, language?, ttsMaxCharacters?, metadata? })` | Create bundled session |
87
+ | `extendAgentSession({ bundleId, additionalMinutes, additionalTtsCharacters? })` | Extend all sessions in bundle |
88
+
89
+ ### Standalone Sessions
90
+
91
+ | Method | Description |
92
+ |--------|-------------|
93
+ | `createWebRTCToken({ roomName, participantIdentity, durationMinutes, metadata? })` | Create WebRTC session |
94
+ | `extendWebRTCToken({ sessionId, additionalMinutes })` | Extend WebRTC session |
95
+ | `createSTTSession({ durationMinutes, language? })` | Create STT session |
96
+ | `extendSTTSession({ sessionId, additionalMinutes })` | Extend STT session |
97
+ | `createTTSSession({ maxCharacters, language? })` | Create TTS session |
98
+ | `extendTTSSession({ sessionId, additionalCharacters })` | Extend TTS session |
99
+
100
+ ### Error Handling
101
+
102
+ ```typescript
103
+ import {
104
+ GatewayError, // Base error (any non-2xx)
105
+ InsufficientCreditsError, // 402 — not enough credits
106
+ ConcurrencyLimitError, // 429 — too many active sessions
107
+ RateLimitError, // 429 — too many requests
108
+ NoCapacityError, // 503 — no servers available
109
+ PaymentError, // x402 payment failed
110
+ } from '@dtelecom/x402-client';
111
+
112
+ try {
113
+ await gateway.createAgentSession({ ... });
114
+ } catch (err) {
115
+ if (err instanceof InsufficientCreditsError) {
116
+ await gateway.buyCredits({ amountUsd: 1.00 });
117
+ }
118
+ }
119
+ ```
120
+
121
+ ## Pricing
122
+
123
+ | Service | Rate | Unit |
124
+ |---------|------|------|
125
+ | WebRTC | $0.001 | per minute |
126
+ | STT | $0.006 | per minute |
127
+ | TTS | $0.008 | per 1K characters |
128
+
129
+ 1 USD = 1,000,000 microcredits.
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,231 @@
1
+ import { LocalAccount } from 'viem/accounts';
2
+
3
+ interface BuyCreditsRequest {
4
+ amountUsd: number;
5
+ }
6
+ interface CreateWebRTCTokenRequest {
7
+ roomName: string;
8
+ participantIdentity: string;
9
+ durationMinutes: number;
10
+ metadata?: string;
11
+ }
12
+ interface ExtendWebRTCTokenRequest {
13
+ sessionId: string;
14
+ additionalMinutes: number;
15
+ }
16
+ interface CreateSTTSessionRequest {
17
+ durationMinutes: number;
18
+ language?: string;
19
+ }
20
+ interface ExtendSTTSessionRequest {
21
+ sessionId: string;
22
+ additionalMinutes: number;
23
+ }
24
+ interface CreateTTSSessionRequest {
25
+ maxCharacters: number;
26
+ language?: string;
27
+ }
28
+ interface ExtendTTSSessionRequest {
29
+ sessionId: string;
30
+ additionalCharacters: number;
31
+ }
32
+ interface CreateAgentSessionRequest {
33
+ roomName: string;
34
+ participantIdentity: string;
35
+ durationMinutes: number;
36
+ language?: string;
37
+ ttsMaxCharacters?: number;
38
+ metadata?: string;
39
+ }
40
+ interface ExtendAgentSessionRequest {
41
+ bundleId: string;
42
+ additionalMinutes: number;
43
+ additionalTtsCharacters?: number;
44
+ }
45
+ interface PaginationOptions {
46
+ limit?: number;
47
+ offset?: number;
48
+ }
49
+ interface SessionsOptions extends PaginationOptions {
50
+ status?: string;
51
+ }
52
+ interface BuyCreditsResponse {
53
+ accountId: string;
54
+ creditedMicrocredits: string;
55
+ amountUsd: number;
56
+ }
57
+ interface AccountResponse {
58
+ id: string;
59
+ walletAddress: string;
60
+ walletChain: string;
61
+ creditBalance: string;
62
+ availableBalance: string;
63
+ maxConcurrentSessions: number;
64
+ maxApiRate: number;
65
+ createdAt: string;
66
+ }
67
+ interface Transaction {
68
+ id: string;
69
+ amount: string;
70
+ balanceAfter: string;
71
+ type: string;
72
+ referenceId: string | null;
73
+ service: string | null;
74
+ description: string | null;
75
+ createdAt: string;
76
+ }
77
+ interface TransactionsResponse {
78
+ transactions: Transaction[];
79
+ limit: number;
80
+ offset: number;
81
+ }
82
+ interface Session {
83
+ id: string;
84
+ service: string;
85
+ bundleId: string | null;
86
+ status: string;
87
+ roomName: string | null;
88
+ serverUrl: string | null;
89
+ reservedMicrocredits: string;
90
+ chargedMicrocredits: string;
91
+ tokenExpiresAt: string | null;
92
+ startedAt: string | null;
93
+ endedAt: string | null;
94
+ settlementMethod: string;
95
+ createdAt: string;
96
+ }
97
+ interface SessionsResponse {
98
+ sessions: Session[];
99
+ limit: number;
100
+ offset: number;
101
+ }
102
+ interface WebRTCTokenResponse {
103
+ sessionId: string;
104
+ token: string;
105
+ wsUrl: string;
106
+ expiresAt: string;
107
+ }
108
+ interface ExtendWebRTCTokenResponse {
109
+ token: string;
110
+ wsUrl: string;
111
+ newExpiresAt: string;
112
+ }
113
+ interface STTSessionResponse {
114
+ sessionId: string;
115
+ token: string;
116
+ serverUrl: string;
117
+ expiresAt: string;
118
+ }
119
+ interface ExtendSTTSessionResponse {
120
+ token: string;
121
+ newExpiresAt: string;
122
+ }
123
+ interface TTSSessionResponse {
124
+ sessionId: string;
125
+ token: string;
126
+ serverUrl: string;
127
+ expiresAt: string;
128
+ }
129
+ interface ExtendTTSSessionResponse {
130
+ token: string;
131
+ maxCharacters: number;
132
+ newExpiresAt: string;
133
+ }
134
+ interface AgentSessionResponse {
135
+ bundleId: string;
136
+ webrtc: {
137
+ sessionId: string;
138
+ token: string;
139
+ wsUrl: string;
140
+ };
141
+ stt: {
142
+ sessionId: string;
143
+ token: string;
144
+ serverUrl: string;
145
+ };
146
+ tts: {
147
+ sessionId: string;
148
+ token: string;
149
+ serverUrl: string;
150
+ };
151
+ expiresAt: string;
152
+ }
153
+ interface ExtendAgentSessionResponse {
154
+ webrtc?: {
155
+ token: string;
156
+ newExpiresAt: string;
157
+ };
158
+ stt?: {
159
+ token: string;
160
+ newExpiresAt: string;
161
+ };
162
+ tts?: {
163
+ token: string;
164
+ newExpiresAt: string;
165
+ };
166
+ }
167
+
168
+ interface DtelecomGatewayConfig {
169
+ /** Gateway base URL (e.g. "https://x402.dtelecom.org") */
170
+ gatewayUrl: string;
171
+ /** viem LocalAccount — from privateKeyToAccount(), CDP toAccount(), KMS adapter, etc. */
172
+ account: LocalAccount;
173
+ }
174
+ declare class DtelecomGateway {
175
+ private readonly baseUrl;
176
+ private readonly account;
177
+ private readonly fetchWithPayment;
178
+ constructor(config: DtelecomGatewayConfig);
179
+ buyCredits(options: BuyCreditsRequest): Promise<BuyCreditsResponse>;
180
+ getAccount(): Promise<AccountResponse>;
181
+ getTransactions(options?: PaginationOptions): Promise<TransactionsResponse>;
182
+ getSessions(options?: SessionsOptions): Promise<SessionsResponse>;
183
+ createAgentSession(options: CreateAgentSessionRequest): Promise<AgentSessionResponse>;
184
+ extendAgentSession(options: ExtendAgentSessionRequest): Promise<ExtendAgentSessionResponse>;
185
+ createWebRTCToken(options: CreateWebRTCTokenRequest): Promise<WebRTCTokenResponse>;
186
+ extendWebRTCToken(options: ExtendWebRTCTokenRequest): Promise<ExtendWebRTCTokenResponse>;
187
+ createSTTSession(options: CreateSTTSessionRequest): Promise<STTSessionResponse>;
188
+ extendSTTSession(options: ExtendSTTSessionRequest): Promise<ExtendSTTSessionResponse>;
189
+ createTTSSession(options: CreateTTSSessionRequest): Promise<TTSSessionResponse>;
190
+ extendTTSSession(options: ExtendTTSSessionRequest): Promise<ExtendTTSSessionResponse>;
191
+ private request;
192
+ private requestWithPayment;
193
+ private handleResponse;
194
+ }
195
+
196
+ declare class GatewayError extends Error {
197
+ readonly status: number;
198
+ constructor(message: string, status: number);
199
+ }
200
+ declare class InsufficientCreditsError extends GatewayError {
201
+ constructor(message: string);
202
+ }
203
+ declare class ConcurrencyLimitError extends GatewayError {
204
+ constructor(message: string);
205
+ }
206
+ declare class RateLimitError extends GatewayError {
207
+ constructor(message: string);
208
+ }
209
+ declare class NoCapacityError extends GatewayError {
210
+ readonly service: string;
211
+ constructor(message: string, service: string);
212
+ }
213
+ declare class PaymentError extends GatewayError {
214
+ constructor(message: string);
215
+ }
216
+
217
+ interface AuthHeaders {
218
+ Authorization: string;
219
+ "X-Wallet-Address": string;
220
+ "X-Wallet-Chain": string;
221
+ "X-Timestamp": string;
222
+ }
223
+ /**
224
+ * Create wallet-auth headers for the gateway.
225
+ *
226
+ * Signs: `${METHOD}\n${path}\n${timestamp}`
227
+ * Result: `Authorization: evm:<signature>`
228
+ */
229
+ declare function createAuthHeaders(account: LocalAccount, method: string, path: string): Promise<AuthHeaders>;
230
+
231
+ export { type AccountResponse, type AgentSessionResponse, type AuthHeaders, type BuyCreditsRequest, type BuyCreditsResponse, ConcurrencyLimitError, type CreateAgentSessionRequest, type CreateSTTSessionRequest, type CreateTTSSessionRequest, type CreateWebRTCTokenRequest, DtelecomGateway, type DtelecomGatewayConfig, type ExtendAgentSessionRequest, type ExtendAgentSessionResponse, type ExtendSTTSessionRequest, type ExtendSTTSessionResponse, type ExtendTTSSessionRequest, type ExtendTTSSessionResponse, type ExtendWebRTCTokenRequest, type ExtendWebRTCTokenResponse, GatewayError, InsufficientCreditsError, NoCapacityError, type PaginationOptions, PaymentError, RateLimitError, type STTSessionResponse, type Session, type SessionsOptions, type SessionsResponse, type TTSSessionResponse, type Transaction, type TransactionsResponse, type WebRTCTokenResponse, createAuthHeaders };
@@ -0,0 +1,231 @@
1
+ import { LocalAccount } from 'viem/accounts';
2
+
3
+ interface BuyCreditsRequest {
4
+ amountUsd: number;
5
+ }
6
+ interface CreateWebRTCTokenRequest {
7
+ roomName: string;
8
+ participantIdentity: string;
9
+ durationMinutes: number;
10
+ metadata?: string;
11
+ }
12
+ interface ExtendWebRTCTokenRequest {
13
+ sessionId: string;
14
+ additionalMinutes: number;
15
+ }
16
+ interface CreateSTTSessionRequest {
17
+ durationMinutes: number;
18
+ language?: string;
19
+ }
20
+ interface ExtendSTTSessionRequest {
21
+ sessionId: string;
22
+ additionalMinutes: number;
23
+ }
24
+ interface CreateTTSSessionRequest {
25
+ maxCharacters: number;
26
+ language?: string;
27
+ }
28
+ interface ExtendTTSSessionRequest {
29
+ sessionId: string;
30
+ additionalCharacters: number;
31
+ }
32
+ interface CreateAgentSessionRequest {
33
+ roomName: string;
34
+ participantIdentity: string;
35
+ durationMinutes: number;
36
+ language?: string;
37
+ ttsMaxCharacters?: number;
38
+ metadata?: string;
39
+ }
40
+ interface ExtendAgentSessionRequest {
41
+ bundleId: string;
42
+ additionalMinutes: number;
43
+ additionalTtsCharacters?: number;
44
+ }
45
+ interface PaginationOptions {
46
+ limit?: number;
47
+ offset?: number;
48
+ }
49
+ interface SessionsOptions extends PaginationOptions {
50
+ status?: string;
51
+ }
52
+ interface BuyCreditsResponse {
53
+ accountId: string;
54
+ creditedMicrocredits: string;
55
+ amountUsd: number;
56
+ }
57
+ interface AccountResponse {
58
+ id: string;
59
+ walletAddress: string;
60
+ walletChain: string;
61
+ creditBalance: string;
62
+ availableBalance: string;
63
+ maxConcurrentSessions: number;
64
+ maxApiRate: number;
65
+ createdAt: string;
66
+ }
67
+ interface Transaction {
68
+ id: string;
69
+ amount: string;
70
+ balanceAfter: string;
71
+ type: string;
72
+ referenceId: string | null;
73
+ service: string | null;
74
+ description: string | null;
75
+ createdAt: string;
76
+ }
77
+ interface TransactionsResponse {
78
+ transactions: Transaction[];
79
+ limit: number;
80
+ offset: number;
81
+ }
82
+ interface Session {
83
+ id: string;
84
+ service: string;
85
+ bundleId: string | null;
86
+ status: string;
87
+ roomName: string | null;
88
+ serverUrl: string | null;
89
+ reservedMicrocredits: string;
90
+ chargedMicrocredits: string;
91
+ tokenExpiresAt: string | null;
92
+ startedAt: string | null;
93
+ endedAt: string | null;
94
+ settlementMethod: string;
95
+ createdAt: string;
96
+ }
97
+ interface SessionsResponse {
98
+ sessions: Session[];
99
+ limit: number;
100
+ offset: number;
101
+ }
102
+ interface WebRTCTokenResponse {
103
+ sessionId: string;
104
+ token: string;
105
+ wsUrl: string;
106
+ expiresAt: string;
107
+ }
108
+ interface ExtendWebRTCTokenResponse {
109
+ token: string;
110
+ wsUrl: string;
111
+ newExpiresAt: string;
112
+ }
113
+ interface STTSessionResponse {
114
+ sessionId: string;
115
+ token: string;
116
+ serverUrl: string;
117
+ expiresAt: string;
118
+ }
119
+ interface ExtendSTTSessionResponse {
120
+ token: string;
121
+ newExpiresAt: string;
122
+ }
123
+ interface TTSSessionResponse {
124
+ sessionId: string;
125
+ token: string;
126
+ serverUrl: string;
127
+ expiresAt: string;
128
+ }
129
+ interface ExtendTTSSessionResponse {
130
+ token: string;
131
+ maxCharacters: number;
132
+ newExpiresAt: string;
133
+ }
134
+ interface AgentSessionResponse {
135
+ bundleId: string;
136
+ webrtc: {
137
+ sessionId: string;
138
+ token: string;
139
+ wsUrl: string;
140
+ };
141
+ stt: {
142
+ sessionId: string;
143
+ token: string;
144
+ serverUrl: string;
145
+ };
146
+ tts: {
147
+ sessionId: string;
148
+ token: string;
149
+ serverUrl: string;
150
+ };
151
+ expiresAt: string;
152
+ }
153
+ interface ExtendAgentSessionResponse {
154
+ webrtc?: {
155
+ token: string;
156
+ newExpiresAt: string;
157
+ };
158
+ stt?: {
159
+ token: string;
160
+ newExpiresAt: string;
161
+ };
162
+ tts?: {
163
+ token: string;
164
+ newExpiresAt: string;
165
+ };
166
+ }
167
+
168
+ interface DtelecomGatewayConfig {
169
+ /** Gateway base URL (e.g. "https://x402.dtelecom.org") */
170
+ gatewayUrl: string;
171
+ /** viem LocalAccount — from privateKeyToAccount(), CDP toAccount(), KMS adapter, etc. */
172
+ account: LocalAccount;
173
+ }
174
+ declare class DtelecomGateway {
175
+ private readonly baseUrl;
176
+ private readonly account;
177
+ private readonly fetchWithPayment;
178
+ constructor(config: DtelecomGatewayConfig);
179
+ buyCredits(options: BuyCreditsRequest): Promise<BuyCreditsResponse>;
180
+ getAccount(): Promise<AccountResponse>;
181
+ getTransactions(options?: PaginationOptions): Promise<TransactionsResponse>;
182
+ getSessions(options?: SessionsOptions): Promise<SessionsResponse>;
183
+ createAgentSession(options: CreateAgentSessionRequest): Promise<AgentSessionResponse>;
184
+ extendAgentSession(options: ExtendAgentSessionRequest): Promise<ExtendAgentSessionResponse>;
185
+ createWebRTCToken(options: CreateWebRTCTokenRequest): Promise<WebRTCTokenResponse>;
186
+ extendWebRTCToken(options: ExtendWebRTCTokenRequest): Promise<ExtendWebRTCTokenResponse>;
187
+ createSTTSession(options: CreateSTTSessionRequest): Promise<STTSessionResponse>;
188
+ extendSTTSession(options: ExtendSTTSessionRequest): Promise<ExtendSTTSessionResponse>;
189
+ createTTSSession(options: CreateTTSSessionRequest): Promise<TTSSessionResponse>;
190
+ extendTTSSession(options: ExtendTTSSessionRequest): Promise<ExtendTTSSessionResponse>;
191
+ private request;
192
+ private requestWithPayment;
193
+ private handleResponse;
194
+ }
195
+
196
+ declare class GatewayError extends Error {
197
+ readonly status: number;
198
+ constructor(message: string, status: number);
199
+ }
200
+ declare class InsufficientCreditsError extends GatewayError {
201
+ constructor(message: string);
202
+ }
203
+ declare class ConcurrencyLimitError extends GatewayError {
204
+ constructor(message: string);
205
+ }
206
+ declare class RateLimitError extends GatewayError {
207
+ constructor(message: string);
208
+ }
209
+ declare class NoCapacityError extends GatewayError {
210
+ readonly service: string;
211
+ constructor(message: string, service: string);
212
+ }
213
+ declare class PaymentError extends GatewayError {
214
+ constructor(message: string);
215
+ }
216
+
217
+ interface AuthHeaders {
218
+ Authorization: string;
219
+ "X-Wallet-Address": string;
220
+ "X-Wallet-Chain": string;
221
+ "X-Timestamp": string;
222
+ }
223
+ /**
224
+ * Create wallet-auth headers for the gateway.
225
+ *
226
+ * Signs: `${METHOD}\n${path}\n${timestamp}`
227
+ * Result: `Authorization: evm:<signature>`
228
+ */
229
+ declare function createAuthHeaders(account: LocalAccount, method: string, path: string): Promise<AuthHeaders>;
230
+
231
+ export { type AccountResponse, type AgentSessionResponse, type AuthHeaders, type BuyCreditsRequest, type BuyCreditsResponse, ConcurrencyLimitError, type CreateAgentSessionRequest, type CreateSTTSessionRequest, type CreateTTSSessionRequest, type CreateWebRTCTokenRequest, DtelecomGateway, type DtelecomGatewayConfig, type ExtendAgentSessionRequest, type ExtendAgentSessionResponse, type ExtendSTTSessionRequest, type ExtendSTTSessionResponse, type ExtendTTSSessionRequest, type ExtendTTSSessionResponse, type ExtendWebRTCTokenRequest, type ExtendWebRTCTokenResponse, GatewayError, InsufficientCreditsError, NoCapacityError, type PaginationOptions, PaymentError, RateLimitError, type STTSessionResponse, type Session, type SessionsOptions, type SessionsResponse, type TTSSessionResponse, type Transaction, type TransactionsResponse, type WebRTCTokenResponse, createAuthHeaders };