Porcupine Model API
The Porcupine Model API trains a Wake Word model from a phrase.
Send a phrase as a request and receive a trained .ppn model file in response, ready for on-device
inference with Porcupine.
Base URL
All routes are relative to the following base URL:
Authentication
Every request must be authenticated with your AccessKey passed in the x-api-key header. You can obtain a
free AccessKey from the Picovoice Console.
Requests made without a valid AccessKey are rejected with a 403 Forbidden response.
Train a Wake Word Model
Trains a Porcupine wake word model for the given language and target platform from a phrase.
On success, the response body is the binary .ppn model file.
Path Parameters
languagestring — The language of the phrase. Must be one of the supported language values (e.g.en).
Headers
x-api-keystring — Required. YourAccessKeyfrom the Picovoice Console.
Body Parameters
The request body is a JSON object with the following fields:
platformstring — Required. The target platform the model will run on. Must be one of the supported platform values.phrasestring — Required. The wake word phrase to train the model on (e.g.Hey Computer).
Example Request
A successful request returns a 303 See Other redirect pointing to the trained model. The -L flag tells
curl to follow that redirect automatically and download the .ppn file:
Replace the placeholders with your own values:
${ACCESS_KEY}— yourAccessKeyfrom the Picovoice Console.${OUTPUT_PATH}— the local path to write the returned.ppnmodel to (e.g../wake_word.ppn).${PLATFORM}— a supported platform value (e.g.linux).${PHRASE}— the wake word phrase to train the model on (e.g.Hey Computer).${LANGUAGE}— a supported language value (e.g.en).
Responses
200 OK— Returned when the303redirect is followed. The response body is the binary.ppnmodel file.303 See Other— Training succeeded. The response carries aLocationheader with a URL to the trained model. Follow this redirect (e.g. withcurl -L) to download it and receive the200 OKabove.400 Bad Request— The request was malformed, theplatformvalue was invalid, or thephrasewas missing or invalid.403 Forbidden— TheAccessKeyis missing or invalid.
Supported Languages
The language path parameter accepts one of the following values:
| Language | Value |
|---|---|
| English | en |
| French | fr |
| German | de |
| Italian | it |
| Japanese | ja |
| Korean | ko |
| Mandarin Chinese | zh |
| Portuguese | pt |
| Spanish | es |
Supported Platforms
The platform body parameter accepts one of the following values:
| Platform | Value |
|---|---|
| Linux | linux |
| macOS | mac |
| Windows | windows |
| Raspberry Pi | raspberry-pi |
| WebAssembly | wasm |
| Android | android |
| iOS | ios |