@speechweave/node 1.0.1 → 1.0.3
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/README.md +40 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,11 +38,47 @@ console.log(result.transcript);
|
|
|
38
38
|
|
|
39
39
|
For `jobs.create`, URL input, cancel, and other job operations, see the [API reference](https://speechweave.com/docs/api).
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Webhooks
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { verifyWebhook } from "@speechweave/node";
|
|
45
|
+
|
|
46
|
+
const result = verifyWebhook(
|
|
47
|
+
WEBHOOK_SECRET,
|
|
48
|
+
rawBody,
|
|
49
|
+
signatureHeader,
|
|
50
|
+
);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Configure webhooks in the dashboard. Payloads are signed with `SpeechWeave-Signature`.
|
|
54
|
+
|
|
55
|
+
## Errors
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { SpeechWeave, SpeechWeaveError } from "@speechweave/node";
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const client = new SpeechWeave({ api_key: "bad_key" });
|
|
62
|
+
await client.getJob("job_123");
|
|
63
|
+
} catch (e) {
|
|
64
|
+
if (e instanceof SpeechWeaveError) {
|
|
65
|
+
console.log(e.status);
|
|
66
|
+
console.log(e.code);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
- `api_key` — or set `SPEECHWEAVE_API_KEY`
|
|
74
|
+
- `base_url` — defaults to `https://api.speechweave.com/v1`
|
|
75
|
+
- `fetch_func` — optional custom `fetch` implementation
|
|
76
|
+
|
|
77
|
+
## Compatibility & Migration
|
|
42
78
|
|
|
43
|
-
|
|
79
|
+
If you are building a new application, use the native SDK above for full feature support. If you have an existing OpenAI, Deepgram, or AssemblyAI codebase, use the options below to switch with minimal changes.
|
|
44
80
|
|
|
45
|
-
|
|
81
|
+
### Drop-in usage
|
|
46
82
|
|
|
47
83
|
Convenience helpers if you want OpenAI/Deepgram/AssemblyAI response shapes without adding another package. They use presigned uploads like the native API.
|
|
48
84
|
|
|
@@ -58,7 +94,7 @@ Pass `wait: false` to return the created job without polling.
|
|
|
58
94
|
|
|
59
95
|
More examples: [OpenAI](https://speechweave.com/docs/migration/openai) · [Deepgram](https://speechweave.com/docs/migration/deepgram) · [AssemblyAI](https://speechweave.com/docs/migration/assemblyai)
|
|
60
96
|
|
|
61
|
-
|
|
97
|
+
### Migrating from OpenAI
|
|
62
98
|
|
|
63
99
|
You don't need this SDK for a quick swap — use the official `openai` package and point it at SpeechWeave:
|
|
64
100
|
|
|
@@ -80,39 +116,3 @@ console.log(result.text);
|
|
|
80
116
|
```
|
|
81
117
|
|
|
82
118
|
OpenAI model names like `whisper-1` are aliased to `core` on our backend. See the [OpenAI migration guide](https://speechweave.com/docs/migration/openai).
|
|
83
|
-
|
|
84
|
-
## Configuration
|
|
85
|
-
|
|
86
|
-
- `api_key` — or set `SPEECHWEAVE_API_KEY`
|
|
87
|
-
- `base_url` — defaults to `https://api.speechweave.com/v1`
|
|
88
|
-
- `fetch_func` — optional custom `fetch` implementation
|
|
89
|
-
|
|
90
|
-
## Errors
|
|
91
|
-
|
|
92
|
-
```ts
|
|
93
|
-
import { SpeechWeave, SpeechWeaveError } from "@speechweave/node";
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
const client = new SpeechWeave({ api_key: "bad_key" });
|
|
97
|
-
await client.getJob("job_123");
|
|
98
|
-
} catch (e) {
|
|
99
|
-
if (e instanceof SpeechWeaveError) {
|
|
100
|
-
console.log(e.status);
|
|
101
|
-
console.log(e.code);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Webhooks
|
|
107
|
-
|
|
108
|
-
```ts
|
|
109
|
-
import { verifyWebhook } from "@speechweave/node";
|
|
110
|
-
|
|
111
|
-
const result = verifyWebhook(
|
|
112
|
-
WEBHOOK_SECRET,
|
|
113
|
-
rawBody,
|
|
114
|
-
signatureHeader,
|
|
115
|
-
);
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Configure webhooks in the dashboard. Payloads are signed with `SpeechWeave-Signature`.
|