curl
curl https://sharemy.ai/v1/audio/speech \
-H "Authorization: Bearer $SHAREMYAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "kokoro-q8", "voice": "af_heart", "input": "Hello from ShareMyAI."}' \
--output speech.wavimport os
from openai import OpenAI
client = OpenAI(api_key=os.environ["SHAREMYAI_API_KEY"], base_url="https://sharemy.ai/v1")
response = client.audio.speech.create(
model="kokoro-q8",
voice="af_heart",
input="Hello from ShareMyAI.",
response_format="wav",
)
response.write_to_file("speech.wav")import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.SHAREMYAI_API_KEY, baseURL: "https://sharemy.ai/v1" });
const response = await client.audio.speech.create({
model: "kokoro-q8",
voice: "af_heart",
input: "Hello from ShareMyAI.",
response_format: "wav",
});
fs.writeFileSync("speech.wav", Buffer.from(await response.arrayBuffer()));"<string>"{
"error": {
"message": "Choose a temperature from 0 to 2.",
"type": "invalid_request_error",
"param": "temperature",
"code": "invalid_value"
}
}{
"error": {
"message": "Send your API token as Authorization: Bearer smai_…. Create one at https://sharemy.ai, account panel, API tokens.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}{
"error": {
"message": "This costs 8.192 credits and your balance is 3.000 credits. Add credits at https://sharemy.ai.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_quota",
"price_credits": 8.192,
"balance_credits": 3
}
}{
"error": {
"message": "This account is suspended. If you think that is a mistake, contact us.",
"type": "invalid_request_error",
"param": null,
"code": "account_suspended"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "model_not_found",
"price_credits": 123,
"balance_credits": 123
}
}{
"error": {
"message": "At most 4 API calls at once. Wait for one to finish.",
"type": "invalid_request_error",
"param": null,
"code": "rate_limit_exceeded"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "model_not_found",
"price_credits": 123,
"balance_credits": 123
}
}{
"error": {
"message": "The machine running this left the network. (request 69ba81e5-6a67-4cd5-a28b-2e023337b936)",
"type": "api_error",
"param": null,
"code": "network_error"
}
}{
"error": {
"message": "No machine that runs this model is online right now. (request 69ba81e5-6a67-4cd5-a28b-2e023337b936)",
"type": "api_error",
"param": null,
"code": "no_provider"
}
}API reference
Create speech
Read text aloud with Kokoro, Supertonic or OmniVoice. Returns mono 16-bit audio as a WAV file or raw PCM.
POST
/
v1
/
audio
/
speech
curl
curl https://sharemy.ai/v1/audio/speech \
-H "Authorization: Bearer $SHAREMYAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "kokoro-q8", "voice": "af_heart", "input": "Hello from ShareMyAI."}' \
--output speech.wavimport os
from openai import OpenAI
client = OpenAI(api_key=os.environ["SHAREMYAI_API_KEY"], base_url="https://sharemy.ai/v1")
response = client.audio.speech.create(
model="kokoro-q8",
voice="af_heart",
input="Hello from ShareMyAI.",
response_format="wav",
)
response.write_to_file("speech.wav")import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.SHAREMYAI_API_KEY, baseURL: "https://sharemy.ai/v1" });
const response = await client.audio.speech.create({
model: "kokoro-q8",
voice: "af_heart",
input: "Hello from ShareMyAI.",
response_format: "wav",
});
fs.writeFileSync("speech.wav", Buffer.from(await response.arrayBuffer()));"<string>"{
"error": {
"message": "Choose a temperature from 0 to 2.",
"type": "invalid_request_error",
"param": "temperature",
"code": "invalid_value"
}
}{
"error": {
"message": "Send your API token as Authorization: Bearer smai_…. Create one at https://sharemy.ai, account panel, API tokens.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}{
"error": {
"message": "This costs 8.192 credits and your balance is 3.000 credits. Add credits at https://sharemy.ai.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_quota",
"price_credits": 8.192,
"balance_credits": 3
}
}{
"error": {
"message": "This account is suspended. If you think that is a mistake, contact us.",
"type": "invalid_request_error",
"param": null,
"code": "account_suspended"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "model_not_found",
"price_credits": 123,
"balance_credits": 123
}
}{
"error": {
"message": "At most 4 API calls at once. Wait for one to finish.",
"type": "invalid_request_error",
"param": null,
"code": "rate_limit_exceeded"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "model_not_found",
"price_credits": 123,
"balance_credits": 123
}
}{
"error": {
"message": "The machine running this left the network. (request 69ba81e5-6a67-4cd5-a28b-2e023337b936)",
"type": "api_error",
"param": null,
"code": "network_error"
}
}{
"error": {
"message": "No machine that runs this model is online right now. (request 69ba81e5-6a67-4cd5-a28b-2e023337b936)",
"type": "api_error",
"param": null,
"code": "no_provider"
}
}Reads text aloud with one of the speech models. The audio is mono and 16-bit. The model names
Kokoro voices:
OmniVoice can design or clone a voice in the Voices studio on sharemy.ai. The API does not offer that yet.
The sample rate depends on the model. The
tts-1, tts-1-hd and gpt-4o-mini-tts all select kokoro-q8.
Voices
| Model | voice |
|---|---|
kokoro-q8 (default), kokoro-fp32 | A Kokoro voice id or alias. Default af_heart. |
supertonic | F1 to F5 or M1 to M5. Default F1. Reads English. |
omnivoice | Ignores voice. |
af_alloy, af_aoede, af_bella, af_heart, af_jessica, af_kore, af_nicole, af_nova, af_river, af_sarah, af_sky, am_adam, am_echo, am_eric, am_fenrir, am_liam, am_michael, am_onyx, am_puck, am_santa, bf_alice, bf_emma, bf_isabella, bf_lily, bm_daniel, bm_fable, bm_george, bm_lewis.
Both Kokoro models accept these OpenAI voice names.
| Requested voice | Kokoro voice |
|---|---|
alloy | af_alloy |
echo | am_echo |
fable | bm_fable |
onyx | am_onyx |
nova | af_nova |
shimmer, ash, ballad, coral, sage, verse | af_heart |
curl https://sharemy.ai/v1/audio/speech \
-H "Authorization: Bearer $SHAREMYAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "omnivoice", "input": "Hello from ShareMyAI."}' \
--output speech.wav
Formats
response_format | Content-Type | What you get |
|---|---|---|
wav (default) | audio/wav | A WAV file: 16-bit PCM, mono |
pcm | audio/pcm | The same samples with no header: signed 16-bit little-endian, mono |
X-Sample-Rate response header gives it in Hz. You need it to play pcm. Browsers can read this header across origins.
Price
Priced by the length ofinput, per 500 characters. See Credits and pricing.
Differences from OpenAI
response_format: onlywavandpcm.mp3,opus,aacandflacare refused.modeldefaults tokokoro-q8, andvoiceis optional.- Ignored:
instructions,stream_format. - No streaming: the audio comes back whole.
Authorizations
Body
application/json
Top-level null fields are treated as omitted.
Kokoro accepts native ids and OpenAI names. alloy, echo, fable, onyx and nova map to af_alloy, am_echo, bm_fable, am_onyx and af_nova respectively. shimmer, ash, ballad, coral, sage and verse map to the default af_heart. Supertonic takes F1 to F5 or M1 to M5 and defaults to F1. OmniVoice ignores voice.
Example:
"af_heart"
Response
The audio. The X-Sample-Rate header gives its sample rate in Hz.
The response is of type file.