Working session in 15 minutes
Step-by-step Tashi SDK setup: install, init, netcode, and anti-cheat.
Step 1: Install the SDK
Install @tashi/sdk from npm.
npm install @tashi/sdk
Requires Node.js 18+, npm 8+.
Step 2: Initialize Tashi
Call Tashi.init() when your server starts. Pass your Game ID and API key.
import { Tashi } from '@tashi/sdk';
await Tashi.init({
gameId: process.env.GAME_ID,
apiKey: process.env.TASHI_API_KEY
});
console.log('Tashi initialized');
If initialization fails, Tashi.init() throws with a descriptive error message including the HTTP status from the Tashi API.
Step 3: Start a session
Call Tashi.session.start() at match start. Each session tracks netcode and anti-cheat signals.
const session = await Tashi.session.start({
players: ['player-1-id', 'player-2-id'],
mode: 'deathmatch'
});
console.log(`Session started: ${session.id}`);
// end the session when the match finishes
await Tashi.session.end(session.id);
Step 4: Configure netcode
Configure netcode before sessions start. The default mode is 'adaptive'. Override it for specific game needs.
Tashi.netcode.configure({
mode: 'adaptive',
tickRate: 30,
jitterBuffer: { enabled: true }
});
See the netcode API reference for all available options.
Step 5: Enable anti-cheat
Anti-cheat is off by default. Call Tashi.anticheat.enable() to enable it.
Tashi.anticheat.enable();
// optional: configure thresholds per signal
Tashi.anticheat.configure({
signals: {
velocityAnomaly: { threshold: 0.90 },
positionTeleport: { threshold: 0.99 }
}
});
Step 6: Handle events
Subscribe to Tashi events for anti-cheat flags and session updates.
Tashi.anticheat.on('flag', (event) => {
console.log(
`Player ${event.playerId} flagged`,
`Signal: ${event.signal}`,
`Confidence: ${event.confidence}`
);
// route to your review queue or auto-remove
});
Tashi.session.on('end', (event) => {
console.log(`Session ${event.sessionId} ended`);
});
Next steps
Your Tashi integration is ready. Next steps:
- Full API reference for all SDK methods and options
- Netcode guide for adaptive compensation tuning
- Anti-cheat guide for signal configuration and review queues
- Pricing when you are ready to move beyond the Dev tier