mistralai/client-ts
Typed TypeScript SDK for Mistral inference and managed API resources
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
@mistralai/mistralai is a generated TypeScript API client, not an inference engine. Applications instantiate Mistral, then call resource namespaces such as chat, embeddings, and files with typed request objects. The selected service handles inference or resource operations. The repository separates the main SDK in src/ from the GCP and Azure packages under packages/; integrations should choose their package based on the target service rather than assume identical APIs.
The dependency manifest includes zod, zod-to-json-schema, ws, @modelcontextprotocol/sdk, LiveKit packages, and OpenTelemetry components. That stack matters when auditing dependencies or targeting a constrained runtime, but it does not establish that a basic chat request initializes MCP, WebSocket, or tracing infrastructure. One explicit protocol boundary is audio.transcriptions.stream, which uses SSE.
Key Capabilities & Differentiators
The core surface covers chat completion with an explicit text response format, multi-input embeddings, and agent completions with a streaming option. mistral-large-latest and mistral-embed are concrete example model IDs, not a complete compatibility matrix. The SDK also exposes file uploads with a batch purpose, batch job creation and cancellation, speech generation, transcription, and audio-agent session management.
The Beta namespaces extend the client beyond inference. Managed search indexes support document ingestion, search, and reading or navigating chunks. Conversations expose start, append, and history retrieval. Observability APIs cover evaluation pipelines, scorers, and run statistics. These are calls to managed services, not implementations of a local search engine or evaluation runner. Teams relying on them should test the specific Beta operations they use when upgrading.
Trade-offs & Limitations
Compared with raw HTTP, the typed client is most useful when an application spans several Mistral resources: it reduces request-shaping code and gives call sites named operations to test. For one or two endpoints, a small HTTP wrapper may offer tighter dependency and transport control. A provider-neutral client can reduce switching costs across model vendors, but its common interface may not expose provider-specific features such as managed search-index operations or evaluation pipelines.
The main package is ESM-only, so CommonJS callers need dynamic import. Inference latency and availability depend on the network and remote service; the client does not provide an offline fallback. For production sizing, measure concurrent requests, stream lifetimes, and file or audio buffering rather than budgeting VRAM. Apache-2.0 covers the SDK code, not hosted API access or model-use rights.
Hardware & Deployment Guide
Install @mistralai/mistralai with npm, pnpm, Bun, or Yarn, and check the target JavaScript runtime against RUNTIMES.md. Authenticate from a trusted backend to La Plateforme for the main package. Credential precedence is a per-request Authorization header, then constructor apiKey (which can be an async function), then the Node token file at MISTRAL_SA_TOKEN_PATH, then MISTRAL_API_KEY. An unreadable or empty token file fails the request rather than falling through to the environment key.
No local inference server or GPU is needed for this API integration. On upgrade, v3.5.0 makes SystemV2.kind mandatory on an existing stable model, so review code and fixtures that construct it. Separately, the GCP and Azure v2.1.0 releases expand reasoningEffort and add chat log-probability models. The GCP release also removes the web_search, web_search_premium, and code_interpreter tool types, so review GCP tool configurations independently of the core SDK upgrade.
@mistralai/mistralai is ESM-only; CommonJS callers can use dynamic import().chat.complete supports text response format; embeddings.create accepts multiple inputs in one request.Beta.Context.SearchIndexes supports ingestion, search, and reading or navigating indexed chunks.MISTRAL_SA_TOKEN_PATH on every request; an empty or unreadable file raises UnexpectedClientError.SystemV2.kind required; GCP and Azure v2.1.0 add chat log-probability models and accept reasoningEffort values from none through max.TypeScript backend teams integrating several Mistral capabilities, such as interactive chat, embeddings, and batch jobs, behind one typed client.
You need offline or self-hosted inference, a single interface for switching model vendors, or a synchronous CommonJS import.
Quick Start & Installation
npm add @mistralai/mistralaiComparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| client-ts ★ | 164 | +2 | TypeScript | Apache-2.0 | Typed TypeScript SDK for Mistral inference and managed API resources |
| transformers | 169.6k | +337 | Python | Apache-2.0 | A PyTorch model-definition SDK for unified inference and training across modalit |
| openai-node | 11.3k | +14 | TypeScript | Apache-2.0 | Generated TypeScript SDK for integrating the hosted OpenAI API |
| pytorch | 105.9k | +299 | Python | — | Python-first tensor SDK for GPU-accelerated training and inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/mistralai/client-ts.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about client-ts
How do I wire the client into an existing TypeScript service?
Mistral from @mistralai/mistralai and call the resource method you need, such as chat.complete or embeddings.create. The package is ESM-only; use await import('@mistralai/mistralai') from CommonJS. For mounted service-account tokens on Node, set MISTRAL_SA_TOKEN_PATH; the SDK rereads the file on each request, so rotation does not require a process restart.Do I need a GPU, and what should I size on the client side?
Can I use it commercially, and does the license allow self-hosted inference?
When should I prefer this SDK over raw HTTP or a provider-neutral client?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy