Getting Started
Follow these steps to set up the project and run your first example.
Prerequisites
-
Node.js (v22.x or newer recommended)
-
An active JetBrains AI Platform account and a JSON Web Token (JWT)
Installation
For Your Own Project (Recommended)
Merci SDK is a zero-dependency library. To use it in your own project, simply download the desired file from the /lib directory on GitHub and import it.
merci.2.14.0.mjs
: The full library file, great for development.merci.2.14.0.d.ts
: TypeScript definitions for autocompletion.
To Run the Examples
If you want to run the tutorial lessons locally, clone the entire repository.
git clone https://github.com/mobeetle/merci-sdk.git
cd merci-sdk
Setup
1. Configure Your Authentication Token
Create a new folder named secret
, and inside it, a new file named token.mjs
. Add the following content, replacing `"YOUR_JWT_HERE"` with your actual token.
// File: secret/token.mjs
// This file securely exports your authentication token.
export const token = "YOUR_JWT_HERE";
⚠️ Security Warning: The `secret` directory is already included in the project's `.gitignore` file to prevent you from accidentally committing your token. Never share this file or commit it to a public repository.
⚡ Quick Start: Your First API Call
The examples/lesson_1_basic_usage.mjs
file is the best place to start. It demonstrates the simplest possible interaction: sending a prompt to the model and streaming the response.
Run the example from your terminal:
node examples/lesson_1_basic_usage.mjs
You should see output like this:
--- Merci SDK Tutorial: Lesson 1 - Basic Usage (Model: google-chat-gemini-flash-2.5) ---
[STEP 1] Initializing MerciClient...
[STEP 2] Preparing prompt and input data...
[STEP 3] Configuring the chat session...
[STEP 4] Creating the message payload...
[STEP 5] Sending request and processing stream...
🤖 Assistant > Stardust Brew: Your cosmic cup of inspiration.
[INFO] Stream finished. Response fully received.