npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-mistral

v0.1.1

Published

Node-RED nodes for the Mistral AI API: chat (text + vision + streaming), embeddings, and OCR.

Readme

node-red-contrib-mistral

npm version npm downloads license

Node-RED nodes for the Mistral AI API — chat completions (with vision and streaming), embeddings, and OCR.

Table of contents


Install

From the Node-RED editor:

  1. Open the palette manager (hamburger menu → Manage palette).
  2. Switch to the Install tab.
  3. Search for node-red-contrib-mistral and click Install.

Or from the command line in your Node-RED user directory (typically ~/.node-red):

npm install node-red-contrib-mistral

Then restart Node-RED. Requires Node.js ≥ 18 and Node-RED ≥ 3.0.

Quick start

  1. Drag a mistral chat node onto your flow.
  2. Double-click it. In the Server field, click the pencil to create a new mistral-config entry.
  3. Paste your Mistral API key (get one at console.mistral.ai) and save.
  4. Wire an inject node (string payload) → mistral chatdebug.
  5. Deploy, click inject, watch the response in the debug sidebar.

The config node is shared across all Mistral nodes — set it up once, reuse it everywhere.


Nodes

mistral-config

Holds the API key (stored encrypted in Node-RED's credentials store) and base URL. Not visible in the palette — it's only accessible from the editor panel of action nodes via the Server dropdown.

| Field | Default | Notes | |---|---|---| | API Key | — | Required. Stored encrypted. | | Base URL | https://api.mistral.ai/v1 | Override for proxies or self-hosted gateways. |

mistral-chat

Calls POST /chat/completions. Supports text, vision (image inputs), and streaming.

Inputs

| Property | Type | Description | |---|---|---| | msg.payload | string | ChatMessage[] | User prompt as string, or full conversation array. | | msg.image | string | string[] | Optional. Image URL(s) or data: base64. Requires a vision model (e.g. pixtral-large-latest). | | msg.model | string | Optional. Override the configured model. | | msg.temperature | number | Optional. | | msg.max_tokens | number | Optional. | | msg.stream | boolean | Optional. Force streaming on/off for this call. |

Outputs (non-streaming)

| Property | Type | |---|---| | msg.payload | string — assistant reply | | msg.mistral | full API response (id, model, choices, usage) | | msg.complete | true |

Outputs (streaming) — one msg per chunk plus a final summary:

| Property | Chunks | Final | |---|---|---| | msg.payload | delta text | full accumulated text | | msg.complete | false | true | | msg.mistral | — | last SSE event with usage |

mistral-embeddings

Calls POST /embeddings to vectorize text. Default model: mistral-embed (1024 dims).

Inputs

| Property | Type | |---|---| | msg.payload | string | string[] | | msg.model | optional string override |

Outputs

| Property | Type | |---|---| | msg.payload | number[] if single input, number[][] if array input — aligned to input order | | msg.mistral | full API response |

mistral-ocr

Calls POST /ocr to extract markdown from PDFs and images. Default model: mistral-ocr-latest.

Inputs

| Property | Value | |---|---| | msg.payload | URL string (https or data:), OR an object { document_url } / { image_url } / { url } |

The node auto-detects document vs image from the URL extension by default. You can force a type in the editor.

Outputs

| Property | Type | |---|---| | msg.payload | concatenated markdown across all pages | | msg.pages | per-page array { index, markdown, images?, dimensions? } | | msg.mistral | full API response |


Example flows

Importable JSON flows are in examples/:

Import in Node-RED: hamburger menu → Importselect a file to import (or paste the JSON content).

⚠️ The mistral-config ID in each example may collide with an existing config in your flow. Node-RED will prompt to Replace or Copy. Choose Replace to reuse your existing config (with your saved API key), or Copy and re-attach manually.


Recipes

RAG with embeddings

The rag-flow.json example shows the canonical pattern in 6 steps:

  1. Index — inject array of documents → mistral-embeddings → function node stores {text, vec} pairs in flow.context.
  2. Query — inject question → mistral-embeddings (single string → single vector).
  3. Retrieve — function node computes cosine similarity vs the stored vectors and keeps the top-K.
  4. Build prompt — same function node concatenates retrieved chunks into a context block.
  5. Generatemistral-chat answers from the context with a system prompt enforcing context-grounding.
  6. Debug — final answer + the retrieved chunks for traceability.

For production, replace the in-memory flow.context store with a proper vector database (Qdrant, pgvector, Pinecone, Chroma) — the only nodes you need from this package are mistral-embeddings and mistral-chat.

Streaming to a dashboard

For a live-typing UI:

inject → mistral-chat (stream=true) → function (route by msg.complete) → ui-template (append chunk)
                                                                       → ui-template (mark complete)

Filter chunks (msg.complete === false) to your "append" UI handler, and the final message (msg.complete === true) to a "done" handler that displays usage stats.


Contributing

Issues and pull requests welcome on the project repository.

License

MIT © Damien Lachambre