{"_id":"@balonai/archimedes-sdk","_rev":"4-27c3ad00d8667fc970157c4c45c9a093","name":"@balonai/archimedes-sdk","dist-tags":{"latest":"1.4.0"},"versions":{"1.1.0":{"name":"@balonai/archimedes-sdk","version":"1.1.0","keywords":["balon","archimedes","ai","llm","sdk"],"author":{"name":"Balon AI"},"license":"SEE LICENSE IN LICENSE","_id":"@balonai/archimedes-sdk@1.1.0","maintainers":[{"name":"balonai","email":"admin@balon.ai"}],"homepage":"https://balon.ai","bugs":{"url":"https://github.com/balonai/archimedes-sdk/issues"},"dist":{"shasum":"3b97b3e203757193332e0d38c3d28438556561e8","tarball":"https://registry.npmjs.org/@balonai/archimedes-sdk/-/archimedes-sdk-1.1.0.tgz","fileCount":9,"integrity":"sha512-z+u6EL59+Pjp+wLNbtuEGfikR2vzHDaMD6fg9rixljlJVmYkyBH4+n7Nn+vZEIIi32dij4JU8RJAtYfIHerMow==","signatures":[{"sig":"MEQCIEb5Ty/7DV67sa7b/tX9XkpSWeJqKMQDx1r1R+wt7iHDAiBcLJ3ussmgS3o60XoedRXMxbo72Rho38GyB1L0ndOJcQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":456585},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"5477d475ef90f694cee98ff4fdb7eb038c3ee5c9","scripts":{"dev":"tsup --watch","lint":"eslint src test","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"balonai","email":"admin@balon.ai"},"repository":{"url":"git+https://github.com/balonai/archimedes-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"TypeScript/JavaScript client for the Balon AI API (https://api.balon.ai)","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","eslint":"^9.9.0","vitest":"^2.0.5","@eslint/js":"^9.39.5","typescript":"^5.5.4","@types/node":"^20.14.0","typescript-eslint":"^8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/archimedes-sdk_1.1.0_1785906933874_0.7981067143899749","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@balonai/archimedes-sdk","version":"1.2.0","keywords":["balon","archimedes","ai","llm","sdk"],"author":{"name":"Balon AI"},"license":"SEE LICENSE IN LICENSE","_id":"@balonai/archimedes-sdk@1.2.0","maintainers":[{"name":"balonai","email":"admin@balon.ai"}],"homepage":"https://balon.ai","bugs":{"url":"https://github.com/balonai/archimedes-sdk/issues"},"dist":{"shasum":"29cbdeea4e1a4feec81858852e654da93dcd4e41","tarball":"https://registry.npmjs.org/@balonai/archimedes-sdk/-/archimedes-sdk-1.2.0.tgz","fileCount":9,"integrity":"sha512-rO42UCGs2BsD/iNTqj8JCw7mk8mCWLI9e3eBaXmD943MPhb9mU6ccnaxZ8y2sGpjktPa5WrisIjcnsHBcnLV2w==","signatures":[{"sig":"MEUCIHTgQWL6+LtymKzFP4ucsd4aYERwl4zm9eBohH34RCwtAiEAq+xhRXHEc1/+DACJMM2znRnDvuEnUBxGl/EFIQjNXDI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":472945},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"ea32187738d5afc01dcd0f00ce2d44ef1ace3c2c","scripts":{"dev":"tsup --watch","lint":"eslint src test","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"balonai","email":"admin@balon.ai"},"repository":{"url":"git+https://github.com/balonai/archimedes-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"TypeScript/JavaScript client for the Balon AI API (https://api.balon.ai)","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","eslint":"^9.9.0","vitest":"^2.0.5","@eslint/js":"^9.39.5","typescript":"^5.5.4","@types/node":"^20.14.0","typescript-eslint":"^8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/archimedes-sdk_1.2.0_1785984327407_0.09892325627572296","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@balonai/archimedes-sdk","version":"1.3.0","keywords":["balon","archimedes","ai","llm","sdk"],"author":{"name":"Balon AI"},"license":"SEE LICENSE IN LICENSE","_id":"@balonai/archimedes-sdk@1.3.0","maintainers":[{"name":"balonai","email":"admin@balon.ai"}],"homepage":"https://balon.ai","bugs":{"url":"https://github.com/balonai/archimedes-sdk/issues"},"dist":{"shasum":"9a462e9d5ea1286212a089ed67f2e9e828654f32","tarball":"https://registry.npmjs.org/@balonai/archimedes-sdk/-/archimedes-sdk-1.3.0.tgz","fileCount":9,"integrity":"sha512-cQHoYIAnH/0RK6UUIsgmDsNAlPX7JlhytEbtmDIkJndZ25izyhQ1n3GzzjyGSnlJ3SHBwWqPFJfGjAlo2K4WYg==","signatures":[{"sig":"MEUCIBjws22ivy6OT3YyZV8t9Lo+YBz37FRLuoUunBjSeYKtAiEAn5Dn3bEFJbXQi7HtBuIDr/y9KJ/kAOlmu8XeqaoK4aA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDVZM0MOg6cVaXEETXKwuVLWWVcA5E3nkui8wBimJwACgIgVWS3w48rK5gSi9D+FuNd+8eJrwGzHRSbuhl5ci1ZJ3s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":477071},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"d3f7f777027a450d57a90e88e99ff32ea484b3ec","scripts":{"dev":"tsup --watch","lint":"eslint src test","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"balonai","email":"admin@balon.ai"},"repository":{"url":"git+https://github.com/balonai/archimedes-sdk.git","type":"git"},"_npmVersion":"11.13.0","description":"TypeScript/JavaScript client for the Balon AI API (https://api.balon.ai)","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","eslint":"^9.9.0","vitest":"^2.0.5","@eslint/js":"^9.39.5","typescript":"^5.5.4","@types/node":"^20.14.0","typescript-eslint":"^8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/archimedes-sdk_1.3.0_1790528902271_0.06516217647336497","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"_id":"@balonai/archimedes-sdk@1.4.0","bugs":{"url":"https://github.com/balonai/archimedes-sdk/issues"},"dist":{"shasum":"a00e42648a370d5edc41d108c32563b064628a99","tarball":"https://registry.npmjs.org/@balonai/archimedes-sdk/-/archimedes-sdk-1.4.0.tgz","fileCount":9,"integrity":"sha512-j6rWEkRE+zhAtauLvj/Qcalo9Foj/WOSEWNw+9Eb1GR1cT2eFGDrRTvC3mBhjRwANoXKisf+34u/b72EJasVbA==","signatures":[{"sig":"MEUCIQD2uENG6F/Gpz4LgDdERjHuaoF+hE3chMglel3doqajpQIgbN0e9Zb43L0cQNvWpDgw5m7laYranErQrxYO6qOCN98=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDd1iqjpr30wW+WvLDSxW9vJzNKlsKycJ/St7qwEPMvyAIhAKn/v3vUDM5d5vtuahsmNGio26nLTgkK3vbtEo2FLrgW"}],"unpackedSize":481379},"main":"./dist/index.cjs","name":"@balonai/archimedes-sdk","type":"module","types":"./dist/index.d.ts","author":{"name":"Balon AI"},"module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"e75e0c513a7611fb7a3bf72928d23f80cbbfb360","license":"SEE LICENSE IN LICENSE","scripts":{"dev":"tsup --watch","lint":"eslint src test","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"version":"1.4.0","_npmUser":{"name":"balonai","email":"admin@balon.ai"},"homepage":"https://balon.ai","keywords":["balon","archimedes","ai","llm","sdk"],"repository":{"url":"git+https://github.com/balonai/archimedes-sdk.git","type":"git"},"_npmVersion":"11.13.0","description":"TypeScript/JavaScript client for the Balon AI API (https://api.balon.ai)","directories":{},"maintainers":[{"name":"balonai","email":"admin@balon.ai"}],"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","eslint":"^9.9.0","vitest":"^2.0.5","@eslint/js":"^9.39.5","typescript":"^5.5.4","@types/node":"^20.14.0","typescript-eslint":"^8.3.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/archimedes-sdk_1.4.0_1790717963887_0.4829239087545296"}}},"time":{"created":"2026-08-05T05:15:33.719Z","modified":"2026-09-29T21:39:24.198Z","1.1.0":"2026-08-05T05:15:34.068Z","1.2.0":"2026-08-06T02:45:27.543Z","1.3.0":"2026-09-27T17:08:22.389Z","1.4.0":"2026-09-29T21:39:24.013Z"},"bugs":{"url":"https://github.com/balonai/archimedes-sdk/issues"},"author":{"name":"Balon AI"},"license":"SEE LICENSE IN LICENSE","homepage":"https://balon.ai","keywords":["balon","archimedes","ai","llm","sdk"],"repository":{"url":"git+https://github.com/balonai/archimedes-sdk.git","type":"git"},"description":"TypeScript/JavaScript client for the Balon AI API (https://api.balon.ai)","maintainers":[{"name":"balonai","email":"admin@balon.ai"}],"readme":"# @balonai/archimedes-sdk\n\nTypeScript/JavaScript client for the [Balon AI API](https://api.balon.ai).\n\nArchimedes is a **concurrent multi-model consensus engine** - it runs your\nprompt through a configurable set of AI models simultaneously, reconciles their\noutputs via a consensus strategy (majority vote, confidence-weighted fusion, or\ncascade), and returns a single high-quality response. Every call to\n`client.fusion.create()` is a deep fusion inference run, not a single-model\ncall.\n\n**Requires:** Node.js 18+ · browser · Bun · Deno · zero runtime dependencies\n\n## Installation\n\n```bash\nnpm install @balonai/archimedes-sdk\n```\n\n## Quick Start\n\n```ts\nimport { BalonClient } from \"@balonai/archimedes-sdk\";\n\nconst client = new BalonClient({ apiKey: \"your-api-key\" });\n// or: new BalonClient()  - reads BALON_API_KEY from the environment\n\n// Deep fusion inference - use client.fusion or client.completions\nconst response = await client.fusion.create({\n  messages: [{ role: \"user\", content: \"What is the capital of France?\" }],\n  model: \"your-preset-id\", // preset ID encapsulates the fusion configuration\n});\n\nconsole.log(response.choices[0].message.content);\n\n// See which models participated\nif (response.fusion_model_ids) {\n  console.log(\"Models used:\", response.fusion_model_ids);\n}\n```\n\n## Deep Fusion Parameters\n\nControl the consensus pipeline directly on any request:\n\n```ts\nimport { BalonClient } from \"@balonai/archimedes-sdk\";\n\nconst client = new BalonClient({ apiKey: \"your-api-key\" });\n\nconst response = await client.fusion.create({\n  messages: [{ role: \"user\", content: \"Analyse this contract clause...\" }],\n  model: \"your-preset-id\",\n  // Override which models participate\n  fusionModels: [\"gpt-4o\", \"claude-3-5-sonnet\", \"gemini-1.5-pro\"],\n  // Override the consensus strategy\n  consensusStrategy: \"confidence_weighted\",\n  // Return each model's raw draft alongside the consensus output\n  returnModelDrafts: true,\n});\n\nconsole.log(response.choices[0].message.content); // consensus output\nfor (const draft of response.model_drafts ?? []) {\n  console.log(`  ${draft.modelId}: ${draft.confidenceScore?.toFixed(2)}  ${draft.content?.slice(0, 80)}`);\n}\n```\n\n## Client Configuration\n\n```ts\nconst client = new BalonClient({\n  apiKey: \"your-api-key\",          // or BALON_API_KEY env var\n  baseUrl: \"https://api.balon.ai\", // optional override\n  timeout: 1_200_000,              // ms - default 20 minutes\n  maxRetries: 3,\n  organizationId: \"your-org-id\",   // optional, sent as X-Organization-ID\n});\n```\n\n## RAG\n\n```ts\n// Upload a document\nconst file = await client.files.upload(\"report.pdf\", \"documents\");\n\n// Fusion completion with RAG\nconst response = await client.fusion.create({\n  messages: [{ role: \"user\", content: \"Summarise the key risks\" }],\n  model: \"your-preset-id\",\n  useRag: true,\n  documentIds: [file.id],\n});\n```\n\n## Tool Routing\n\nRoute specific tools to specific models in the fusion pipeline:\n\n```ts\nconst response = await client.fusion.create({\n  messages: [{ role: \"user\", content: \"Search for AI news and write code to parse it\" }],\n  model: \"your-preset-id\",\n  tools: [\"search_web\", \"code_interpreter\"],\n  toolRouting: {\n    search_web: { preferred_model: \"gpt-4o\" },\n    code_interpreter: { preferred_model: \"claude-3-5-sonnet\" },\n  },\n});\n```\n\n## Streaming\n\n> **Note:** `stream()` currently fetches the full response and yields it in\n> 50-character chunks client-side for a consistent interface. Native SSE\n> streaming is on the roadmap.\n\n```ts\nfor await (const chunk of client.fusion.stream({\n  messages: [{ role: \"user\", content: \"Write a long story\" }],\n  model: \"your-preset-id\",\n})) {\n  process.stdout.write(chunk.content);\n}\n```\n\n## Threads & Assistants\n\n```ts\nconst assistant = await client.assistants.create({\n  model: \"your-preset-id\",\n  name: \"Research Assistant\",\n  instructions: \"You are a concise research assistant.\",\n});\n\nconst thread = await client.threads.create({\n  messages: [{ role: \"user\", content: \"What is deep fusion?\" }],\n});\n\nconst run = await client.runs.createAndPoll({\n  threadId: thread.id,\n  assistantId: assistant.id,\n});\n\nconst messages = await client.messages.list({ threadId: thread.id });\nconsole.log(messages[0].content);\n```\n\n## Billing\n\n```ts\nconst balance = await client.billing.balance();\nconsole.log(`$${balance.usd_equivalent.toFixed(4)} remaining`);\n\nconst txns = await client.billing.transactions({ limit: 20 });\nfor (const tx of txns.data) {\n  console.log(tx.created_at, tx.amount, tx.type);\n}\n\nconst summary = await client.billing.usageSummary();\nconsole.log(`$${summary.total_usd.toFixed(4)} spent in period`);\n```\n\n## Async Task Queue\n\nFor long-running operations (document ingestion, engine completions):\n\n```ts\nconst op = await client.tasks.create({\n  operation: \"rag\",\n  parameters: { query: \"Summarise Q3 results\", file_ids: [file.id] },\n});\nconst result = await client.tasks.wait(op.task_id);\nconsole.log(result.result);\n```\n\n## Error Handling\n\n```ts\nimport {\n  BalonError,\n  AuthenticationError,\n  InsufficientCreditsError,\n  RateLimitError,\n  BalonAPIError,\n} from \"@balonai/archimedes-sdk\";\n\ntry {\n  const response = await client.fusion.create({ ... });\n} catch (err) {\n  if (err instanceof AuthenticationError) {\n    console.error(\"Invalid API key\");\n  } else if (err instanceof InsufficientCreditsError) {\n    console.error(\"Insufficient credits\");\n  } else if (err instanceof RateLimitError) {\n    console.error(`Rate limited - retry after ${err.retryAfter}s`);\n  } else if (err instanceof BalonAPIError) {\n    console.error(`API error ${err.status}: ${err.message}`);\n  } else if (err instanceof BalonError) {\n    console.error(`SDK error: ${err.message}`);\n  }\n}\n```\n\n## Environment Variables\n\n| Variable | Description |\n|---|---|\n| `BALON_API_KEY` | API key (required if not passed to constructor) |\n| `BALON_API_BASE_URL` | Override API base URL |\n| `BALON_TIMEOUT_MS` | Request timeout in **milliseconds** (default `1200000`) |\n| `BALON_MAX_RETRIES` | Max retry attempts (default `3`) |\n| `BALON_ORGANIZATION_ID` | Organisation ID sent as `X-Organization-ID` |\n\n## Resources\n\n| Resource | Access | Key methods |\n|---|---|---|\n| Deep Fusion / Completions | `client.fusion` · `client.completions` | `create()`, `stream()` |\n| Files | `client.files` | `upload()`, `list()`, `get()`, `download()`, `delete()` |\n| Presets | `client.presets` | `list()`, `get()` |\n| Models | `client.models` | `list()`, `get()` |\n| Assistants | `client.assistants` | `create()`, `list()`, `retrieve()`, `modify()`, `delete()` |\n| Threads | `client.threads` | `create()`, `retrieve()`, `modify()`, `delete()`, messages & runs |\n| Messages | `client.messages` | `create()`, `list()`, `get()`, `update()`, `delete()` |\n| Runs | `client.runs` | `create()`, `createAndPoll()`, `list()`, `get()`, `cancel()`, `submitToolOutputs()` |\n| Compress | `client.compress` | `create()` · `compress()` |\n| Billing | `client.billing` | `balance()`, `transactions()`, `usageSummary()`, `costs()` |\n| Tasks | `client.tasks` | `create()`, `get()`, `cancel()`, `wait()` |\n| Videos | `client.videos` | `get()`, `wait()` |\n| User | `client.user` | `info()` |\n| Chats | `client.chats` | `list()`, `create()`, `getMessages()`, `saveMessages()` |\n\n## Development\n\n```bash\nnpm install\nnpx tsc --noEmit --strict\nnpx vitest run\n```\n\n## License\n\nSee [LICENSE](./LICENSE).\n","readmeFilename":"README.md"}