@spekoai/sdk 0.0.3 → 0.3.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 (36) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +5 -6
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/lib/client.d.ts +9 -5
  6. package/dist/lib/client.d.ts.map +1 -1
  7. package/dist/lib/client.js +13 -6
  8. package/dist/lib/http.d.ts +1 -0
  9. package/dist/lib/http.d.ts.map +1 -1
  10. package/dist/lib/http.js +3 -0
  11. package/dist/lib/resources/complete.d.ts +2 -2
  12. package/dist/lib/resources/complete.js +2 -2
  13. package/dist/lib/resources/credits.d.ts +28 -0
  14. package/dist/lib/resources/credits.d.ts.map +1 -0
  15. package/dist/lib/resources/credits.js +37 -0
  16. package/dist/lib/resources/phone-numbers.d.ts +49 -0
  17. package/dist/lib/resources/phone-numbers.d.ts.map +1 -0
  18. package/dist/lib/resources/phone-numbers.js +66 -0
  19. package/dist/lib/resources/realtime.d.ts +15 -0
  20. package/dist/lib/resources/realtime.d.ts.map +1 -0
  21. package/dist/lib/resources/realtime.js +173 -0
  22. package/dist/lib/resources/synthesize.d.ts +1 -2
  23. package/dist/lib/resources/synthesize.d.ts.map +1 -1
  24. package/dist/lib/resources/synthesize.js +4 -3
  25. package/dist/lib/resources/transcribe.d.ts +1 -2
  26. package/dist/lib/resources/transcribe.d.ts.map +1 -1
  27. package/dist/lib/resources/transcribe.js +8 -5
  28. package/dist/lib/resources/voice.d.ts +29 -0
  29. package/dist/lib/resources/voice.d.ts.map +1 -0
  30. package/dist/lib/resources/voice.js +30 -0
  31. package/dist/lib/types/index.d.ts +233 -52
  32. package/dist/lib/types/index.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/lib/resources/sessions.d.ts +0 -44
  35. package/dist/lib/resources/sessions.d.ts.map +0 -1
  36. package/dist/lib/resources/sessions.js +0 -46
@@ -5,7 +5,7 @@ export declare class Synthesize {
5
5
  constructor(http: HttpClient);
6
6
  /**
7
7
  * Synthesize text into audio. The Speko router picks the best TTS provider
8
- * for your `(language, vertical, optimizeFor)` and falls over automatically.
8
+ * for your `(language, optimizeFor)` and falls over automatically.
9
9
  *
10
10
  * The returned audio's format depends on the chosen provider — check the
11
11
  * `contentType` field on the result. ElevenLabs returns `audio/mpeg`,
@@ -15,7 +15,6 @@ export declare class Synthesize {
15
15
  * ```ts
16
16
  * const result = await speko.synthesize('Hello world', {
17
17
  * language: 'en',
18
- * vertical: 'general',
19
18
  * });
20
19
  * await writeFile(`out.${result.contentType.includes('mpeg') ? 'mp3' : 'pcm'}`, result.audio);
21
20
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/synthesize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,CAAC;CA2B7B"}
1
+ {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/synthesize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;OAeG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,CAAC;CA4B7B"}
@@ -5,7 +5,7 @@ export class Synthesize {
5
5
  }
6
6
  /**
7
7
  * Synthesize text into audio. The Speko router picks the best TTS provider
8
- * for your `(language, vertical, optimizeFor)` and falls over automatically.
8
+ * for your `(language, optimizeFor)` and falls over automatically.
9
9
  *
10
10
  * The returned audio's format depends on the chosen provider — check the
11
11
  * `contentType` field on the result. ElevenLabs returns `audio/mpeg`,
@@ -15,7 +15,6 @@ export class Synthesize {
15
15
  * ```ts
16
16
  * const result = await speko.synthesize('Hello world', {
17
17
  * language: 'en',
18
- * vertical: 'general',
19
18
  * });
20
19
  * await writeFile(`out.${result.contentType.includes('mpeg') ? 'mp3' : 'pcm'}`, result.audio);
21
20
  * ```
@@ -23,7 +22,7 @@ export class Synthesize {
23
22
  async call(text, options, abortSignal) {
24
23
  const intent = {
25
24
  language: options.language,
26
- vertical: options.vertical,
25
+ ...(options.region !== undefined && { region: options.region }),
27
26
  ...(options.optimizeFor !== undefined && { optimizeFor: options.optimizeFor }),
28
27
  };
29
28
  const body = { text, intent };
@@ -31,6 +30,8 @@ export class Synthesize {
31
30
  body['voice'] = options.voice;
32
31
  if (options.speed !== undefined)
33
32
  body['speed'] = options.speed;
33
+ if (options.constraints !== undefined)
34
+ body['constraints'] = options.constraints;
34
35
  const { bytes, headers } = await this.http.requestBinary('POST', '/v1/synthesize', body, abortSignal);
35
36
  return {
36
37
  audio: bytes,
@@ -5,14 +5,13 @@ export declare class Transcribe {
5
5
  constructor(http: HttpClient);
6
6
  /**
7
7
  * Transcribe audio. The Speko router picks the best STT provider for
8
- * your `(language, vertical, optimizeFor)` and falls over automatically.
8
+ * your `(language, optimizeFor)` and falls over automatically.
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
12
  * const audio = await readFile('./call.wav');
13
13
  * const { text, provider, confidence } = await speko.transcribe(audio, {
14
14
  * language: 'es-MX',
15
- * vertical: 'healthcare',
16
15
  * });
17
16
  * ```
18
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/transcribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;OAYG;IACG,IAAI,CACR,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,CAAC;CAkB7B"}
1
+ {"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/transcribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;OAWG;IACG,IAAI,CACR,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,CAAC;CAuB7B"}
@@ -5,26 +5,29 @@ export class Transcribe {
5
5
  }
6
6
  /**
7
7
  * Transcribe audio. The Speko router picks the best STT provider for
8
- * your `(language, vertical, optimizeFor)` and falls over automatically.
8
+ * your `(language, optimizeFor)` and falls over automatically.
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
12
  * const audio = await readFile('./call.wav');
13
13
  * const { text, provider, confidence } = await speko.transcribe(audio, {
14
14
  * language: 'es-MX',
15
- * vertical: 'healthcare',
16
15
  * });
17
16
  * ```
18
17
  */
19
18
  async call(audio, options, abortSignal) {
20
19
  const intent = {
21
20
  language: options.language,
22
- vertical: options.vertical,
21
+ ...(options.region !== undefined && { region: options.region }),
23
22
  ...(options.optimizeFor !== undefined && { optimizeFor: options.optimizeFor }),
24
23
  };
25
- return this.http.requestRaw('POST', '/v1/transcribe', audio, {
24
+ const headers = {
26
25
  'Content-Type': options.contentType ?? 'audio/wav',
27
26
  'X-Speko-Intent': JSON.stringify(intent),
28
- }, abortSignal);
27
+ };
28
+ if (options.constraints) {
29
+ headers['X-Speko-Constraints'] = JSON.stringify(options.constraints);
30
+ }
31
+ return this.http.requestRaw('POST', '/v1/transcribe', audio, headers, abortSignal);
29
32
  }
30
33
  }
@@ -0,0 +1,29 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { VoiceDialParams, VoiceDialResult } from '../types/index.js';
3
+ /**
4
+ * Outbound phone calls via Speko's Telnyx-backed gateway.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const { sessionId, status } = await speko.voice.dial({
9
+ * to: '+12015551234',
10
+ * intent: { language: 'en', optimizeFor: 'latency' },
11
+ * systemPrompt: 'You are a helpful Speko assistant. Greet the caller in English.',
12
+ * });
13
+ * console.log('dialing:', sessionId, status);
14
+ * ```
15
+ */
16
+ export declare class Voice {
17
+ private readonly http;
18
+ constructor(http: HttpClient);
19
+ /**
20
+ * Place an outbound call. The destination's phone rings; once they pick
21
+ * up, audio bridges to a Speko worker running the configured pipeline
22
+ * (STT→LLM→TTS) on a LiveKit room.
23
+ *
24
+ * Lifecycle is observable via Telnyx webhooks (which Speko handles
25
+ * server-side) and reflected in the `voice_session` row's `status`.
26
+ */
27
+ dial(params: VoiceDialParams): Promise<VoiceDialResult>;
28
+ }
29
+ //# sourceMappingURL=voice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/voice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAG9D"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Outbound phone calls via Speko's Telnyx-backed gateway.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const { sessionId, status } = await speko.voice.dial({
7
+ * to: '+12015551234',
8
+ * intent: { language: 'en', optimizeFor: 'latency' },
9
+ * systemPrompt: 'You are a helpful Speko assistant. Greet the caller in English.',
10
+ * });
11
+ * console.log('dialing:', sessionId, status);
12
+ * ```
13
+ */
14
+ export class Voice {
15
+ http;
16
+ constructor(http) {
17
+ this.http = http;
18
+ }
19
+ /**
20
+ * Place an outbound call. The destination's phone rings; once they pick
21
+ * up, audio bridges to a Speko worker running the configured pipeline
22
+ * (STT→LLM→TTS) on a LiveKit room.
23
+ *
24
+ * Lifecycle is observable via Telnyx webhooks (which Speko handles
25
+ * server-side) and reflected in the `voice_session` row's `status`.
26
+ */
27
+ async dial(params) {
28
+ return this.http.post('/v1/sessions/phone', params);
29
+ }
30
+ }
@@ -7,65 +7,23 @@ export interface SpekoClientOptions {
7
7
  /** Request timeout in milliseconds. Defaults to 30000. */
8
8
  timeout?: number;
9
9
  }
10
- /** Pipeline configuration for a voice session. */
11
- export interface PipelineConfig {
12
- stt: {
13
- provider: string;
14
- model?: string;
15
- language?: string;
16
- keywords?: string[];
17
- };
18
- llm: {
19
- provider: string;
20
- model: string;
21
- systemPrompt?: string;
22
- temperature?: number;
23
- maxTokens?: number;
24
- };
25
- tts: {
26
- provider: string;
27
- voice: string;
28
- model?: string;
29
- speed?: number;
30
- };
31
- }
32
- /** Parameters for creating a session. */
33
- export interface CreateSessionParams {
34
- pipeline: PipelineConfig;
35
- metadata?: Record<string, unknown>;
36
- }
37
- /** A voice session returned by the API. */
38
- export interface Session {
39
- id: string;
40
- status: 'created' | 'connecting' | 'active' | 'ended' | 'failed';
41
- roomName: string;
42
- token: string;
43
- livekitUrl: string;
44
- createdAt: string;
45
- }
46
- /** A session detail object. */
47
- export interface SessionDetail {
48
- id: string;
49
- workspaceId: string;
50
- status: 'created' | 'connecting' | 'active' | 'ended' | 'failed';
51
- roomName: string;
52
- pipelineConfig: PipelineConfig;
53
- metadata: Record<string, unknown>;
54
- createdAt: string;
55
- updatedAt: string;
56
- endedAt: string | null;
57
- }
10
+ /** BYOK = customer key, no Speko charge. MANAGED = platform key, billed. */
11
+ export type KeySource = 'BYOK' | 'MANAGED';
58
12
  /** Usage record for a workspace. */
59
13
  export interface UsageSummary {
60
14
  totalSessions: number;
61
15
  totalMinutes: number;
62
16
  totalCost: number;
63
17
  breakdown: UsageByProvider[];
18
+ /** Current organization balance in micro-USD (1_000_000 µ$ = $1), as string. */
19
+ balanceMicroUsd: string;
20
+ balanceUsd: number;
64
21
  }
65
22
  export interface UsageByProvider {
66
23
  provider: string;
67
24
  type: 'stt' | 'llm' | 'tts';
68
25
  metric: string;
26
+ keySource: KeySource;
69
27
  quantity: number;
70
28
  cost: number;
71
29
  }
@@ -76,20 +34,63 @@ export interface UsageQueryParams {
76
34
  /** End date (ISO 8601). */
77
35
  to?: string;
78
36
  }
79
- /** Vertical labels supported by the router. */
80
- export type Vertical = 'general' | 'healthcare' | 'finance' | 'legal';
37
+ /** Current prepaid credit balance. */
38
+ export interface OrganizationBalance {
39
+ balanceMicroUsd: string;
40
+ balanceUsd: number;
41
+ updatedAt: string;
42
+ }
43
+ export type CreditLedgerKind = 'grant' | 'debit' | 'topup' | 'refund' | 'adjustment';
44
+ export interface CreditLedgerEntry {
45
+ id: string;
46
+ kind: CreditLedgerKind;
47
+ /** Signed. Positive for grants/topups/refunds, negative for debits. */
48
+ amountMicroUsd: string;
49
+ metric: string | null;
50
+ provider: string | null;
51
+ sessionId: string | null;
52
+ createdAt: string;
53
+ }
54
+ export interface CreditLedgerPage {
55
+ entries: CreditLedgerEntry[];
56
+ /** Pass back as `cursor` for the next page, or null if exhausted. */
57
+ nextCursor: string | null;
58
+ }
59
+ export interface CreditLedgerQueryParams {
60
+ limit?: number;
61
+ cursor?: string;
62
+ }
81
63
  /** Optimization preset that biases the router's weighted score. */
82
64
  export type OptimizeFor = 'balanced' | 'accuracy' | 'latency' | 'cost';
83
65
  /** Routing intent passed to the proxy primitives. */
84
66
  export interface RoutingIntent {
85
67
  /** BCP-47 language tag, e.g. "en" or "es-MX". */
86
68
  language: string;
87
- vertical: Vertical;
69
+ /**
70
+ * Region to rank streaming providers in (e.g. `"us-east4"`, `"eu-west1"`).
71
+ * Defaults to `"global"` on the server, which surfaces region-agnostic
72
+ * (batch) benchmark rows. Set this when latency to a specific
73
+ * geography matters — STT/TTS rankings differ per region.
74
+ */
75
+ region?: string;
88
76
  optimizeFor?: OptimizeFor;
89
77
  }
78
+ /**
79
+ * Optional constraints layered on top of `RoutingIntent`. The router still
80
+ * ranks candidates by benchmark score — but if `allowedProviders[modality]`
81
+ * is set and non-empty, it only considers that subset.
82
+ */
83
+ export interface PipelineConstraints {
84
+ allowedProviders?: {
85
+ stt?: string[];
86
+ llm?: string[];
87
+ tts?: string[];
88
+ };
89
+ }
90
90
  export interface TranscribeOptions extends RoutingIntent {
91
91
  /** MIME type of the audio body. Defaults to "audio/wav". */
92
92
  contentType?: string;
93
+ constraints?: PipelineConstraints;
93
94
  }
94
95
  export interface TranscribeResult {
95
96
  text: string;
@@ -103,6 +104,7 @@ export interface SynthesizeOptions extends RoutingIntent {
103
104
  /** Optional voice override. Otherwise the SDK uses each provider's default. */
104
105
  voice?: string;
105
106
  speed?: number;
107
+ constraints?: PipelineConstraints;
106
108
  }
107
109
  export interface SynthesizeResult {
108
110
  /** Raw audio bytes. Format depends on the chosen provider — see `contentType`. */
@@ -114,16 +116,50 @@ export interface SynthesizeResult {
114
116
  failoverCount: number;
115
117
  scoresRunId: string | null;
116
118
  }
119
+ /**
120
+ * One LLM-emitted tool invocation. `args` is a JSON-encoded string (LLMs may
121
+ * stream partial JSON; the proxy guarantees a complete, parseable string).
122
+ */
123
+ export interface ChatToolCall {
124
+ id: string;
125
+ name: string;
126
+ args: string;
127
+ }
117
128
  export interface ChatMessage {
118
- role: 'system' | 'user' | 'assistant';
129
+ role: 'system' | 'user' | 'assistant' | 'tool';
119
130
  content: string;
131
+ /** Present on `role: 'assistant'` when the model invoked one or more tools. */
132
+ toolCalls?: ChatToolCall[];
133
+ /** Required on `role: 'tool'` — pairs with the `id` from a prior assistant `toolCalls[]`. */
134
+ toolCallId?: string;
135
+ }
136
+ /**
137
+ * Tool definition exposed to the LLM. `parameters` is a JSON Schema (draft-7)
138
+ * object — typically generated from a Zod schema via
139
+ * `llm.toJsonSchema()` from `@livekit/agents`.
140
+ */
141
+ export interface ChatTool {
142
+ name: string;
143
+ description: string;
144
+ parameters: Record<string, unknown>;
120
145
  }
146
+ /** Mirrors LiveKit's `ToolChoice` for parity with the agents framework. */
147
+ export type ChatToolChoice = 'auto' | 'none' | 'required' | {
148
+ type: 'function';
149
+ function: {
150
+ name: string;
151
+ };
152
+ };
121
153
  export interface CompleteParams {
122
154
  messages: ChatMessage[];
123
155
  intent: RoutingIntent;
124
156
  systemPrompt?: string;
125
157
  temperature?: number;
126
158
  maxTokens?: number;
159
+ constraints?: PipelineConstraints;
160
+ tools?: ChatTool[];
161
+ toolChoice?: ChatToolChoice;
162
+ parallelToolCalls?: boolean;
127
163
  }
128
164
  export interface CompleteResult {
129
165
  text: string;
@@ -135,5 +171,150 @@ export interface CompleteResult {
135
171
  };
136
172
  failoverCount: number;
137
173
  scoresRunId: string | null;
174
+ /** Present when the LLM invoked tools instead of (or in addition to) emitting text. */
175
+ toolCalls?: ChatToolCall[];
176
+ }
177
+ export type RealtimeProvider = 'openai' | 'google' | 'xai';
178
+ export interface RealtimeToolSpec {
179
+ name: string;
180
+ description: string;
181
+ parameters: Record<string, unknown>;
182
+ }
183
+ export interface RealtimeConnectParams {
184
+ provider: RealtimeProvider;
185
+ model: string;
186
+ voice?: string;
187
+ systemPrompt?: string;
188
+ temperature?: number;
189
+ inputSampleRate?: 16000 | 24000;
190
+ outputSampleRate?: 16000 | 24000;
191
+ tools?: RealtimeToolSpec[];
192
+ metadata?: Record<string, unknown>;
193
+ /** Max session duration in seconds. Server-capped at 1800 (30 min). */
194
+ ttlSeconds?: number;
195
+ }
196
+ /**
197
+ * Event shape emitted by a `RealtimeSessionHandle`. Binary audio comes in
198
+ * as `audio` frames; text control messages come through typed variants.
199
+ */
200
+ export type RealtimeFrame = {
201
+ type: 'audio';
202
+ pcm: Uint8Array;
203
+ sampleRate: number;
204
+ } | {
205
+ type: 'transcript';
206
+ role: 'user' | 'assistant';
207
+ text: string;
208
+ final: boolean;
209
+ } | {
210
+ type: 'tool_call';
211
+ callId: string;
212
+ name: string;
213
+ arguments: string;
214
+ } | {
215
+ type: 'usage';
216
+ inputAudioTokens: number;
217
+ outputAudioTokens: number;
218
+ } | {
219
+ type: 'error';
220
+ code: string;
221
+ message: string;
222
+ } | {
223
+ type: 'close';
224
+ code: number;
225
+ reason: string;
226
+ };
227
+ export type RealtimeEventHandler = (frame: RealtimeFrame) => void;
228
+ export interface RealtimeSessionHandle {
229
+ readonly sessionId: string;
230
+ readonly expiresAt: string;
231
+ /** Send a PCM16 audio chunk up to the model. */
232
+ sendAudio(pcm: Uint8Array): void;
233
+ /** Signal user-turn boundary / commit the input buffer. */
234
+ commit(): void;
235
+ /** Interrupt the current assistant response. */
236
+ interrupt(): void;
237
+ /** Return a previously-requested tool call result. */
238
+ sendToolResult(callId: string, output: string): void;
239
+ /** Subscribe to frames. Returns an unsubscribe callback. */
240
+ on(handler: RealtimeEventHandler): () => void;
241
+ /** Close the session. Safe to call multiple times. */
242
+ close(code?: number, reason?: string): void;
243
+ }
244
+ export interface VoiceDialParams {
245
+ /** Destination number in E.164 format (e.g. "+12015551234"). */
246
+ to: string;
247
+ /** Caller ID. Falls back to the org default if omitted server-side. */
248
+ from?: string;
249
+ /** Routing intent — language is required, optimizeFor optional. */
250
+ intent: RoutingIntent;
251
+ constraints?: PipelineConstraints;
252
+ /** TTS voice id passed through to the picked TTS provider. */
253
+ voice?: string;
254
+ /** Agent system prompt. */
255
+ systemPrompt?: string;
256
+ llm?: {
257
+ temperature?: number;
258
+ maxTokens?: number;
259
+ };
260
+ ttsOptions?: {
261
+ sampleRate?: number;
262
+ speed?: number;
263
+ };
264
+ /** Free-form metadata round-tripped to your webhooks. */
265
+ metadata?: Record<string, unknown>;
266
+ }
267
+ export interface VoiceDialResult {
268
+ sessionId: string;
269
+ callControlId: string;
270
+ roomName: string;
271
+ /** 'dialing' on a real call, 'dialing-stub' if Telnyx isn't configured. */
272
+ status: 'dialing' | 'dialing-stub';
273
+ to: string;
274
+ from: string;
275
+ }
276
+ export type PhoneNumberDirection = 'inbound' | 'outbound' | 'both';
277
+ export interface PhoneNumberRow {
278
+ id: string;
279
+ organizationId: string;
280
+ e164: string;
281
+ telnyxPhoneNumberId: string | null;
282
+ direction: PhoneNumberDirection;
283
+ dispatchMetadataTemplate: Record<string, unknown> | null;
284
+ label: string | null;
285
+ createdAt: string;
286
+ updatedAt: string;
287
+ }
288
+ export interface PhoneNumberCreateParams {
289
+ e164: string;
290
+ direction?: PhoneNumberDirection;
291
+ /** LiveKit dispatch metadata template (variables `{{var}}` resolved at dial). */
292
+ dispatchMetadataTemplate?: Record<string, unknown>;
293
+ label?: string;
294
+ }
295
+ export interface PhoneNumberUpdateParams {
296
+ direction?: PhoneNumberDirection;
297
+ dispatchMetadataTemplate?: Record<string, unknown>;
298
+ label?: string;
299
+ }
300
+ export interface AvailablePhoneNumber {
301
+ e164: string;
302
+ friendlyName: string;
303
+ monthlyCostUsd: number;
304
+ upfrontCostUsd: number;
305
+ features: string[];
306
+ region: {
307
+ state: string | null;
308
+ locality: string | null;
309
+ rateCenter: string | null;
310
+ };
311
+ }
312
+ export interface PhoneNumberSearchParams {
313
+ /** 3-digit US area code, e.g. "415". */
314
+ areaCode?: string;
315
+ /** Optional locality filter, e.g. "San Francisco". */
316
+ locality?: string;
317
+ /** Max results — Telnyx caps at 50. Default 10. */
318
+ limit?: number;
138
319
  }
139
320
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE;QACH,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,GAAG,EAAE;QACH,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,GAAG,EAAE;QACH,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,yC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AM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spekoai/sdk",
3
- "version": "0.0.3",
3
+ "version": "0.3.0",
4
4
  "description": "Official Speko TypeScript SDK — one API, every voice provider",
5
5
  "license": "MIT",
6
6
  "author": "Speko",
@@ -1,44 +0,0 @@
1
- import type { HttpClient } from '../http.js';
2
- import type { CreateSessionParams, Session, SessionDetail } from '../types/index.js';
3
- export declare class Sessions {
4
- private readonly http;
5
- constructor(http: HttpClient);
6
- /**
7
- * Create a new voice session.
8
- *
9
- * @example
10
- * ```ts
11
- * const session = await speko.sessions.create({
12
- * pipeline: {
13
- * stt: { provider: 'deepgram' },
14
- * llm: { provider: 'openai', model: 'gpt-4o' },
15
- * tts: { provider: 'elevenlabs', voice: 'rachel' },
16
- * },
17
- * });
18
- * console.log(session.token); // Use to connect via LiveKit
19
- * ```
20
- */
21
- create(params: CreateSessionParams): Promise<Session>;
22
- /**
23
- * Get a session by ID.
24
- *
25
- * @example
26
- * ```ts
27
- * const session = await speko.sessions.get('sess_abc123');
28
- * ```
29
- */
30
- get(sessionId: string): Promise<SessionDetail>;
31
- /**
32
- * End an active session.
33
- *
34
- * @example
35
- * ```ts
36
- * await speko.sessions.end('sess_abc123');
37
- * ```
38
- */
39
- end(sessionId: string): Promise<{
40
- id: string;
41
- status: string;
42
- }>;
43
- }
44
- //# sourceMappingURL=sessions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,mBAAmB,EACnB,OAAO,EACP,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3D;;;;;;;OAOG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIpD;;;;;;;OAOG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAKtE"}
@@ -1,46 +0,0 @@
1
- export class Sessions {
2
- http;
3
- constructor(http) {
4
- this.http = http;
5
- }
6
- /**
7
- * Create a new voice session.
8
- *
9
- * @example
10
- * ```ts
11
- * const session = await speko.sessions.create({
12
- * pipeline: {
13
- * stt: { provider: 'deepgram' },
14
- * llm: { provider: 'openai', model: 'gpt-4o' },
15
- * tts: { provider: 'elevenlabs', voice: 'rachel' },
16
- * },
17
- * });
18
- * console.log(session.token); // Use to connect via LiveKit
19
- * ```
20
- */
21
- async create(params) {
22
- return this.http.post('/v1/sessions', params);
23
- }
24
- /**
25
- * Get a session by ID.
26
- *
27
- * @example
28
- * ```ts
29
- * const session = await speko.sessions.get('sess_abc123');
30
- * ```
31
- */
32
- async get(sessionId) {
33
- return this.http.get(`/v1/sessions/${sessionId}`);
34
- }
35
- /**
36
- * End an active session.
37
- *
38
- * @example
39
- * ```ts
40
- * await speko.sessions.end('sess_abc123');
41
- * ```
42
- */
43
- async end(sessionId) {
44
- return this.http.delete(`/v1/sessions/${sessionId}`);
45
- }
46
- }