Encode words into dense embeddings using Sawtone v4, a remote-code multilingual word encoder that exposes phonetic, orthographic, and semantic word channels through a stable API.
POST https://api.sawalni.com/v1/language/encode
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | sawtone-v4 |
input | string or array | Yes | Word(s) or phrase(s) to encode |
channel | string | No | composite (544d, default), phonetic (192d), ortho (192d), or semantic (128d) |
| Channel | Dimensions | Description |
|---|---|---|
composite | 544 | Sawtone v4 composite word embedding |
phonetic | 192 | CNN-based sound-pattern channel |
ortho | 192 | Orthographic byte-structure channel |
semantic | 128 | Base semantic channel inferred from form |
When input contains multiple words (separated by whitespace), each word is encoded individually and the results are max-pooled into a single vector.
curl https://api.sawalni.com/v1/language/encode \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "sawtone-v4", "input": ["hello", "café", "München"], "channel": "composite" }'
import requests response = requests.post( "https://api.sawalni.com/v1/language/encode", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "sawtone-v4", "input": ["hello", "café", "مرحبا"], "channel": "phonetic" } ) result = response.json() for item in result["data"]: print(f"{item['input']} → {len(item['embedding'])}d embedding")
const response = await fetch('https://api.sawalni.com/v1/language/encode', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'sawtone-v4', input: ['hello', 'café', 'مرحبا'], channel: 'composite' }) }); const result = await response.json(); result.data.forEach(item => { console.log(item.input, '→', item.embedding.length + 'd'); });
{ "data": [ { "input": "hello", "embedding": [0.023, -0.009, 0.015, ...] } ], "model": "sawtone-v4", "channel": "composite", "dimensions": 544, "usage": { "input_bytes": 5, "input_count": 1, "total_words": 1, "processing_ms": 3.2 } }
Pass an array of strings to encode multiple texts in one request (max 128):
response = requests.post( "https://api.sawalni.com/v1/language/encode", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "sawtone-v4", "input": ["word1", "word2", "word3"], "channel": "composite" } )
| Property | Value |
|---|---|
| Model ID | sawtone-v4 |
| Composite Dimension | 544 |
| Sentence Embeddings | 768 |
| Max Batch Size | 128 |
Word encoding is metered by input bytes (UTF-8 encoded size).
| Metric | Rate |
|---|---|
| Input bytes | 0.10 credits per 1M bytes |