JavaScript / TypeScript SDK
Official @emini-ai/sdk client — one class per category, same field names as the API.
Installation
bash
npm install @emini-ai/sdkUsage
typescript
import { EminiAI } from "@emini-ai/sdk";
const client = new EminiAI({ apiKey: process.env.EMINI_API_KEY! });
const result = await client.chat.completions.create({
messages: [{ role: "user", content: "Bonjour" }],
model: "claude-opus-5",
});
console.log(result.content);Streaming
typescript
for await (const chunk of client.chat.completions.stream({
messages: [{ role: "user", content: "Compte jusqu'a 10" }],
})) {
process.stdout.write(chunk.delta);
}Async jobs (video)
typescript
const generation = await client.video.generate({ prompt: "un chat qui code" });
const job = await generation.wait(); // sonde /v1/jobs/{id} jusqu'a completion
console.log(job.result_url);Typed errors
One subclass per HTTP status range, to avoid parsing codes by hand:
typescript
import { InsufficientCreditsError } from "@emini-ai/sdk";
try {
await client.chat.completions.create({ messages: [/* ... */] });
} catch (err) {
if (err instanceof InsufficientCreditsError) {
// credits insuffisants sur le compte (402)
}
}See Error reference for the full list of classes and the HTTP code associated with each.
Covered resources
chat, images, vision, embeddings, translation, audio, video, jobs, uploads, agents — one class per Gateway category.
Source code
sdks/js in the monorepo.