@withmateza/sdk
v0.1.2
Published
Core Node client for the Mateza public API.
Readme
@withmateza/sdk
Core Node client for the Mateza public API.
Use this package when you want the raw, framework-agnostic API client and typed response schemas for translation, speech, multimodal jobs, usage, request logs, glossary, language catalog, and feedback.
Install
npm install @withmateza/sdk
pnpm add @withmateza/sdkThese packages are published to the public npm registry. If you are consuming them from this monorepo, use the workspace package references already defined in pnpm-workspace.yaml.
Quick Start
import { createClient } from "@withmateza/sdk";
const mateza = createClient({
baseUrl: "https://api.mateza.rw",
apiKey: process.env.MATEZA_API_KEY,
});
const result = await mateza.translate({
text: "Hello world",
source_lang: "en",
target_lang: "rw",
});
console.log(result.data.translation);If you are calling the API from a browser or native client, use createPublicClient and a client key instead of a server API key.
API Overview
Exported entry points:
createClientandcreatePublicClientApiError,request,ClientOptions, andFetchFnlanguage-catalog,model-exposure, andschemasexports
Main methods on the client:
translatetranslateBatchstartSpeechTranslateprocessMultimodalgetSpeechJobwaitForSpeechJobcreateTranslationFeedbacklistTranslationFeedbackgetUsagelistRequestslistGlossarylistLanguagesguideuploadMediagetUploadedMedia
Auth and Config
- Set
baseUrlto the Mateza API host, for examplehttps://api.mateza.rw. - Use
apiKeyfor server-side requests. - Use
clientKeyfor browser-safe requests. - You can override credentials per call with
api_keyorclient_key. createPublicClientis an alias ofcreateClient.
Common Mistakes
- Passing a server API key into browser code.
- Forgetting to set
baseUrl. - Importing from internal source files instead of the package entry point.
- Assuming the response is untyped JSON. The client parses responses through the published schemas.
See the shared getting-started guide in docs/package-getting-started.md for end-to-end examples.
API docs: https://api.mateza.rw/docs
API endpoint: https://api.mateza.rw
