You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c32efc
Browse filesBrowse the repository at this point in the historyBrowse files
Standard tokens are the simplest option. Pro tokens support workflow-specific verification-key configuration. Enterprise token configuration is available for eligible enterprise accounts or existing enterprise tokens.
59
51
60
52
```python
61
-
# List all tokens
53
+
import os
54
+
55
+
# List all tokens.
62
56
tokens = client.tokens.list()
63
57
64
-
# Get a specific token
58
+
# Get a specific token.
65
59
token = client.tokens.get("token-uuid")
66
60
67
-
# Update a token
61
+
# Create a Pro token when your workflow requires a configurable verification key.
# Update a Pro or eligible Enterprise token verification key.
76
+
token = client.tokens.update(
77
+
token_id="token-uuid",
78
+
public_key=verification_key,
79
+
)
75
80
```
76
81
77
-
### Audio Watermarking
82
+
Token deletion is not available via API. Tokens are consumable resources.
83
+
84
+
## Audio Watermarking
78
85
79
86
```python
80
-
# Encode with custom settings
81
87
result = client.audio.encode(
82
88
audio="input.mp3",
83
89
token_id=token.id,
84
-
strength=1.0, # 0.1-2.0
85
-
normalize=True, # Smooth audio to reduce artifacts
86
-
check_watermark=True, # Check for existing watermark first
87
-
output_path="output.mp3"
90
+
strength=1.0,
91
+
smooth=True,
88
92
)
93
+
result.save("output.mp3")
89
94
90
-
# Decode watermark from audio file
91
95
decode = client.audio.decode("suspect.mp3")
92
96
if decode.watermarked:
93
97
print(f"Token: {decode.token_id}")
94
98
```
95
99
96
-
### Notebook (Notes) Management
100
+
Use `decode(..., public_key=verification_key)` only when your workflow requires an explicit verification key.
101
+
102
+
## Streaming PCM Encode
103
+
104
+
Use `stream_encode_pcm()` when your application already works with raw PCM audio or needs low-latency streaming from a file-processing pipeline, microphone, call, meeting, or live stream.
105
+
106
+
The input must be raw PCM float32 little-endian bytes. 48 kHz mono is recommended. The SDK does not currently decode MP3/WAV/FLAC files, resample audio, or convert containers for this streaming method.
for offset inrange(0, len(pcm_bytes), chunk_size):
115
+
yield pcm_bytes[offset:offset + chunk_size]
116
+
117
+
result = client.audio.stream_encode_pcm(
118
+
pcm_chunks=chunk_pcm(pcm_f32le_bytes),
119
+
token_id=token.id,
120
+
sample_rate=48000,
121
+
channels=1,
122
+
smooth=True,
123
+
)
124
+
125
+
encoded_pcm = result.encoded_pcm
126
+
print(f"Encoded {result.audio_duration:.2f}s of PCM")
127
+
```
128
+
129
+
`encoded_pcm` is raw PCM float32 little-endian, not WAV or MP3. Wrap it in a WAV container or encode it to your desired output format before playback or download.
130
+
131
+
## Notebook Management
132
+
133
+
Attach notes and media files to tokens. Private notebooks require a credential, and limits depend on your account and token configuration.
97
134
98
135
```python
99
-
# Create a public notebook for a token
100
136
notebook = client.notebooks.create(
101
137
token_id=token.id,
102
138
note_name="Release Notes",
103
-
text_content="## Version 1.0\n\nInitial release.",
104
-
is_public=True
139
+
text_content="## Version 1.0\n\nRelease notes.",
140
+
is_public=True,
105
141
)
106
142
107
-
# Create a private notebook (default password: "123")
0 commit comments