Skip to content

Use an official SDK

Libraries for TypeScript, Python and PHP that cover the whole API, with retries, typed errors and streaming built in.

Install

TypeScript SDK
npm install @naiuz/sdk

Node 20 or newer. With Bun, bun add @naiuz/sdk. With Deno, import npm:@naiuz/sdk. It runs on Cloudflare Workers too.

Set your key

Create a key on the dashboard's API keys page, then put it in NEURONAI_API_KEY.

Bash
export NEURONAI_API_KEY="<your-api-key>"

Every SDK reads the key from there.

Keep the key on your server, and call the API from your backend, never from a page in the browser.

Generate speech

Each tab holds a whole program to save and run. It writes salom.wav and prints how many characters were voiced and what they cost in credits.

TypeScript SDK
import {NeuronAI} from "@naiuz/sdk";

const client = new NeuronAI();

const speech = await client.tts.synthesize({
    text: "Assalomu alaykum!",
    voice_id: "kamron",
    language: "uz",
});
await speech.save("salom.wav");
console.log(`${speech.character_count} characters, ${speech.cost} credits`);

Save it as salom.mjs and run node salom.mjs.

Packages and source

Each folder holds its SDK's README and api.md, which lists every method.

Next steps