Quick Start
Get from zero to a streamed answer in three steps. The Finn SDK ships for Node.js/TypeScript and Python — pick your language with the tabs below (your choice sticks across the docs).
-
Install the SDK
Terminal window npm install @riseanalytics/finn-sdk# or: pnpm add @riseanalytics/finn-sdk# or: yarn add @riseanalytics/finn-sdkTerminal window pip install finn-sdk -
Connect and ask a question
import { FinnClient } from '@riseanalytics/finn-sdk';const finn = new FinnClient({url: process.env.FINN_URL, // e.g. https://finn.example.comapiKey: process.env.FINN_API_KEY, // your static API key});await finn.connect();const turn = finn.sendMessage('How many active members do I have?');// Tokens stream in as Finn answers.for await (const chunk of turn) {process.stdout.write(chunk.text);}const result = await turn.completed;console.log('\nconversationId:', result.conversationId);await finn.disconnect();import asyncio, osfrom finn_sdk import FinnClientasync def main():finn = FinnClient(url=os.environ["FINN_URL"], # e.g. https://finn.example.comapi_key=os.environ["FINN_API_KEY"], # your static API key)await finn.connect()turn = await finn.send_message("How many active members do I have?")# Tokens stream in as Finn answers.async for chunk in turn:print(chunk.text, end="", flush=True)result = await turn.completedprint("\nconversationId:", result.conversation_id)await finn.disconnect()asyncio.run(main()) -
Run it
Terminal window FINN_URL=https://finn.example.com FINN_API_KEY=your-key node index.mjsTerminal window FINN_URL=https://finn.example.com FINN_API_KEY=your-key python main.py
Just want the answer?
Section titled “Just want the answer?”If you don’t need live tokens, use ask() — it does the loop for you and
resolves once with the full answer:
const { text } = await finn.ask('How many active members do I have?');console.log(text);answer = await finn.ask("How many active members do I have?")print(answer.text)See Sending messages & streaming for
the difference between ask() and sendMessage().
What just happened
Section titled “What just happened”- Creating a client (
new FinnClient({ url, apiKey })/FinnClient(url=..., api_key=...)) just holds config — nothing connects yet. connect()opened the WebSocket and authenticated with your API key.sendMessage(...)/send_message(...)returned aMessageTurn— an async-iterable you loop over to read tokens as they arrive.turn.completedresolved with the finalTurnResult, including theconversationIdyou’d reuse for a follow-up.
Next steps
Section titled “Next steps”- Connecting & auth — every connection option, API-key rotation, and lifecycle events.
- Sending messages & streaming — the streaming model in depth, plus interrupting a turn.
- Conversations & follow-ups — keep context across turns.
- Full examples — complete, runnable programs in both languages.