@speechweave/node 1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpeechWeave
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,116 @@
1
+ # @speechweave/node
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@speechweave/node.svg)](https://www.npmjs.com/package/@speechweave/node)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Official Node.js client for the SpeechWeave `/v1` API. Node.js 18+.
7
+
8
+ **Docs:** [speechweave.com/docs](https://speechweave.com/docs) · [API reference](https://speechweave.com/docs/api)
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @speechweave/node
14
+ ```
15
+
16
+ Set your API key:
17
+
18
+ ```bash
19
+ export SPEECHWEAVE_API_KEY="sk_..."
20
+ ```
21
+
22
+ ## Migrating from OpenAI
23
+
24
+ You don't need this SDK for a quick swap — use the official `openai` package and point it at SpeechWeave:
25
+
26
+ ```ts
27
+ import fs from "node:fs";
28
+ import OpenAI from "openai";
29
+
30
+ const client = new OpenAI({
31
+ apiKey: process.env.SPEECHWEAVE_API_KEY!,
32
+ baseURL: "https://api.speechweave.com/v1",
33
+ });
34
+
35
+ const result = await client.audio.transcriptions.create({
36
+ file: fs.createReadStream("clip.mp3"),
37
+ model: "core",
38
+ });
39
+
40
+ console.log(result.text);
41
+ ```
42
+
43
+ OpenAI model names like `whisper-1` are aliased to `core` on our backend. See the [OpenAI migration guide](https://speechweave.com/docs/migration/openai).
44
+
45
+ **When to use @speechweave/node:** native jobs API, presigned uploads for large files, `waitForJob`, and webhook verification.
46
+
47
+ ## Quick start
48
+
49
+ ```ts
50
+ import { SpeechWeave, waitForJob } from "@speechweave/node";
51
+
52
+ const client = new SpeechWeave();
53
+
54
+ const job = await client.transcribeFile(buffer, {
55
+ filename: "audio.wav",
56
+ model: "core",
57
+ language: "en",
58
+ });
59
+
60
+ const result = await waitForJob(client, job.id, { timeout_ms: 300_000 });
61
+ console.log(result.transcript);
62
+ ```
63
+
64
+ For `jobs.create`, URL input, cancel, and other job operations, see the [API reference](https://speechweave.com/docs/api).
65
+
66
+ ## Provider-shaped helpers (optional)
67
+
68
+ Convenience helpers if you want OpenAI/Deepgram/AssemblyAI response shapes without adding another package. They use presigned uploads like the native API.
69
+
70
+ ```ts
71
+ const { text } = await client.audio.transcriptions.create({
72
+ file: buffer,
73
+ filename: "clip.mp3",
74
+ model: "core",
75
+ });
76
+ ```
77
+
78
+ Pass `wait: false` to return the created job without polling.
79
+
80
+ More examples: [OpenAI](https://speechweave.com/docs/migration/openai) · [Deepgram](https://speechweave.com/docs/migration/deepgram) · [AssemblyAI](https://speechweave.com/docs/migration/assemblyai)
81
+
82
+ ## Configuration
83
+
84
+ - `api_key` — or set `SPEECHWEAVE_API_KEY`
85
+ - `base_url` — defaults to `https://api.speechweave.com/v1`
86
+ - `fetch_func` — optional custom `fetch` implementation
87
+
88
+ ## Errors
89
+
90
+ ```ts
91
+ import { SpeechWeave, SpeechWeaveError } from "@speechweave/node";
92
+
93
+ try {
94
+ const client = new SpeechWeave({ api_key: "bad_key" });
95
+ await client.getJob("job_123");
96
+ } catch (e) {
97
+ if (e instanceof SpeechWeaveError) {
98
+ console.log(e.status);
99
+ console.log(e.code);
100
+ }
101
+ }
102
+ ```
103
+
104
+ ## Webhooks
105
+
106
+ ```ts
107
+ import { verifyWebhook } from "@speechweave/node";
108
+
109
+ const result = verifyWebhook(
110
+ WEBHOOK_SECRET,
111
+ rawBody,
112
+ signatureHeader,
113
+ );
114
+ ```
115
+
116
+ Configure webhooks in the dashboard. Payloads are signed with `SpeechWeave-Signature`.