{"_id":"@astracollab/ai","name":"@astracollab/ai","dist-tags":{"beta":"0.0.1-beta","latest":"0.0.1-beta"},"versions":{"0.0.1-beta":{"name":"@astracollab/ai","version":"0.0.1-beta","private":false,"description":"AstraCollab AI provider SDKs — OpenAI-compatible Cursor Composer 2.5 inference and Vercel AI SDK integration.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./cursor":{"types":"./dist/cursor/index.d.ts","import":"./dist/cursor/index.js","require":"./dist/cursor/index.cjs"},"./workflows":{"types":"./dist/workflows/index.d.ts","import":"./dist/workflows/index.js","require":"./dist/workflows/index.cjs"},"./workflows/mastra":{"types":"./dist/workflows/mastra/index.d.ts","import":"./dist/workflows/mastra/index.js","require":"./dist/workflows/mastra/index.cjs"},"./package.json":"./package.json"},"sideEffects":false,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"license":"MIT","author":{"name":"AstraCollab"},"repository":{"type":"git","url":"git+https://github.com/astracollab/astracollab.git","directory":"packages/ai"},"keywords":["astracollab","cursor","composer","ai-sdk","openai-compatible","inference"],"scripts":{"build":"node scripts/build-entries.mjs","dev":"vite build --watch","test":"vitest run","test:watch":"vitest","lint":"tsc --noEmit","type-check":"tsc --noEmit"},"peerDependencies":{"@ai-sdk/openai-compatible":"^0.2.0 || ^1.0.0","@mastra/core":">=1.35.0","ai":"^4.0.0 || ^5.0.0","zod":"^3.25.0 || ^4.0.0"},"peerDependenciesMeta":{"@ai-sdk/openai-compatible":{"optional":true},"@mastra/core":{"optional":true},"ai":{"optional":true},"zod":{"optional":true}},"dependencies":{"ofetch":"^1.4.0","zod":"^4.3.6"},"devDependencies":{"@ai-sdk/openai-compatible":"^1.0.39","@mastra/core":"1.35.0","@types/node":"^20.11.30","ai":"^5.0.0","typescript":"^5.8.2","vite":"^5.4.10","vite-plugin-dts":"^4.3.0","vitest":"^3.0.9","zod":"^4.3.6"},"engines":{"node":">=20"},"gitHead":"59d839351f8a22cd78743ed2161047f8f993ded2","_id":"@astracollab/ai@0.0.1-beta","bugs":{"url":"https://github.com/astracollab/astracollab/issues"},"homepage":"https://github.com/astracollab/astracollab#readme","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-6SbFlHGDi1rnkXY3u4tzo5sJrfOVEwgaV2xTXzLkLEbbiepoo4p7tnR9NOV1lXvDyGLLRpYvjlKIV7pYZ3dK8w==","shasum":"05fe6ea1dfdc19478c12dd06fb40e005d7a305dd","tarball":"https://registry.npmjs.org/@astracollab/ai/-/ai-0.0.1-beta.tgz","fileCount":73,"unpackedSize":351529,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHQ+8OLUDy9UJ8JysKzek7UZ4Tsk+4+KjueKxFfjAt3rAiA6cfbUPJf6j83pjGhJCroRQNpjRuOCnXTdQr7iw3Urvw=="}]},"_npmUser":{"name":"dailyhelix","email":"e.wambugu192@gmail.com"},"directories":{},"maintainers":[{"name":"dailyhelix","email":"e.wambugu192@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai_0.0.1-beta_1779736158568_0.02877144641371787"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T19:09:18.435Z","0.0.1-beta":"2026-05-25T19:09:18.727Z","modified":"2026-05-25T19:09:18.920Z"},"maintainers":[{"name":"dailyhelix","email":"e.wambugu192@gmail.com"}],"description":"AstraCollab AI provider SDKs — OpenAI-compatible Cursor Composer 2.5 inference and Vercel AI SDK integration.","homepage":"https://github.com/astracollab/astracollab#readme","keywords":["astracollab","cursor","composer","ai-sdk","openai-compatible","inference"],"repository":{"type":"git","url":"git+https://github.com/astracollab/astracollab.git","directory":"packages/ai"},"author":{"name":"AstraCollab"},"bugs":{"url":"https://github.com/astracollab/astracollab/issues"},"license":"MIT","readme":"# @astracollab/ai\n\nAstraCollab AI provider SDKs. Use `@astracollab/ai/cursor` for OpenAI-compatible **Cursor Composer 2.5** inference with the [Vercel AI SDK](https://sdk.vercel.ai/).\n\n> **Not affiliated with Cursor.** This package is a typed HTTP + AI SDK client. It does not implement Cursor's internal protocol.\n\n## Prerequisites\n\n1. A [Cursor](https://cursor.com) subscription (plans from $20/month include API quota).\n2. A Cursor API key from [Dashboard → Integrations → API Keys](https://cursor.com/dashboard/integrations) (`crsr_...`).\n3. An **OpenAI-compatible inference base URL** you explicitly configure. Cursor does not publish a standard chat-completions API; community proxies (e.g. [Standard Agents](https://cursor-api.standardagents.ai/)) translate `/v1/chat/completions` requests. **You must opt in** by setting `baseURL` — this package never defaults to a third-party endpoint.\n\nInstall:\n\n```bash\nnpm install @astracollab/ai @ai-sdk/openai-compatible ai\n# peer deps for AI SDK provider helpers\n```\n\n## Quick start (Vercel AI SDK)\n\n```ts\nimport { streamText } from \"ai\";\nimport {\n  COMPOSER_25,\n  CURSOR_STANDARD_AGENTS_V1_BASE_URL,\n  createCursorProvider,\n} from \"@astracollab/ai/cursor\";\n\nconst cursor = createCursorProvider({\n  apiKey: process.env.CURSOR_API_KEY!,\n  baseURL: process.env.CURSOR_API_BASE_URL ?? CURSOR_STANDARD_AGENTS_V1_BASE_URL,\n});\n\nconst result = streamText({\n  model: cursor.chatModel(COMPOSER_25),\n  prompt: \"Explain async iterators in TypeScript.\",\n});\n\nfor await (const delta of result.textStream) {\n  process.stdout.write(delta);\n}\n```\n\nOr use the convenience helper:\n\n```ts\nimport { streamText } from \"ai\";\nimport { createComposerModel, resolveCursorConfigFromEnvOrThrow } from \"@astracollab/ai/cursor\";\n\nconst result = streamText({\n  model: createComposerModel(resolveCursorConfigFromEnvOrThrow()),\n  prompt: \"Hello, Composer.\",\n});\n```\n\n## Environment variables\n\n| Variable | Required | Description |\n|---|---|---|\n| `CURSOR_API_KEY` | Yes | Cursor API key (`crsr_...`) |\n| `CURSOR_API_BASE_URL` | Yes | OpenAI-compatible base URL (no silent default) |\n\nExample shell setup:\n\n```bash\nexport CURSOR_API_KEY=\"crsr_...\"\nexport CURSOR_API_BASE_URL=\"https://cursor-api.standardagents.ai/v1\"\n```\n\n## Base URL configuration\n\nThis package exports documented constants for known community proxies — **examples only**:\n\n```ts\nimport {\n  CURSOR_STANDARD_AGENTS_V1_BASE_URL,       // generic chat completions\n  CURSOR_STANDARD_AGENTS_OPENCODE_BASE_URL, // OpenCode tool-loop route\n} from \"@astracollab/ai/cursor\";\n```\n\n| Route | Use when |\n|---|---|\n| `/v1` | Simple chat completions, OpenAI SDK, Vercel AI SDK |\n| `/opencode/v1` | OpenCode-style local tool loops (proxy maps tool calls to OpenAI shape) |\n\nAlways set `baseURL` explicitly in code or via `CURSOR_API_BASE_URL`.\n\n## Low-level HTTP client\n\n```ts\nimport { createCursorClient, COMPOSER_25 } from \"@astracollab/ai/cursor\";\n\nconst client = createCursorClient({\n  apiKey: process.env.CURSOR_API_KEY!,\n  baseURL: process.env.CURSOR_API_BASE_URL!,\n});\n\nconst completion = await client.chat.create({\n  model: COMPOSER_25,\n  messages: [{ role: \"user\", content: \"hello world\" }],\n});\n\nconst models = await client.models.list();\n\nconst response = await client.responses.create({\n  model: COMPOSER_25,\n  input: \"Explain async iterators.\",\n});\n```\n\nErrors throw `CursorApiError` with helpers: `isAuthError()`, `isRateLimitError()`, `isRetryable()`.\n\n## Model reference (informational)\n\n| Model | Input $/M | Output $/M | Context | Max output |\n|---|---|---|---|---|\n| `composer-2.5` | $0.50 | $2.50 | 200k | 65,536 |\n\nBilling and quota apply to your Cursor account. See [Cursor model pricing](https://cursor.com/docs/models).\n\n## OpenCode compatibility\n\nEquivalent to the community OpenCode provider config, using this package's constants:\n\n```json\n{\n  \"model\": \"cursor/composer-2.5\",\n  \"provider\": {\n    \"cursor\": {\n      \"npm\": \"@ai-sdk/openai-compatible\",\n      \"name\": \"Cursor API via Standard Agents\",\n      \"options\": {\n        \"baseURL\": \"https://cursor-api.standardagents.ai/opencode/v1\",\n        \"apiKey\": \"{env:CURSOR_API_KEY}\"\n      },\n      \"models\": {\n        \"composer-2.5\": {\n          \"name\": \"Composer 2.5\",\n          \"cost\": { \"input\": 0.5, \"output\": 2.5 },\n          \"limit\": { \"context\": 200000, \"output\": 65536 }\n        }\n      }\n    }\n  }\n}\n```\n\nIn TypeScript apps, prefer `createCursorProvider()` from `@astracollab/ai/cursor` instead of duplicating config.\n\n## Legal and Terms of Service\n\nRead [Cursor Terms of Service](https://cursor.com/terms-of-service) before using inference outside the Cursor IDE.\n\n**Important considerations:**\n\n- **§1.5 Use restrictions** — Cursor prohibits reverse engineering and unauthorized extraction from the Service. Third-party inference proxies operate in a **gray area**; this package does **not** ship proxy or reverse-engineering logic, only a client for **user-supplied** OpenAI-compatible endpoints.\n- **§6 Third-Party Services** — Proxies like Standard Agents are third-party. You are responsible for their terms in addition to Cursor's.\n- **§4.5 Usage billing** — Requests consume your Cursor subscription quota and any usage-based fees.\n- **§1.5(v)** — Do not use outputs to train competitive models.\n\nMonitor [Cursor API documentation](https://cursor.com/docs/api) for an official inference API. When Cursor publishes one, point `baseURL` at the official endpoint.\n\n**Production use:** Community proxies may not be production-ready. [Standard Agents](https://cursor-api.standardagents.ai/) recommends contacting them for production deployments.\n\n## Security\n\n- Never commit `CURSOR_API_KEY` to source control.\n- Use shell profiles, `.env` (gitignored), or your deployment provider's secret manager.\n- Enable `debug: true` only in local development — it logs request URLs, not keys.\n\n## Package exports\n\n| Import | Description |\n|---|---|\n| `@astracollab/ai` | Shared types; future provider umbrella |\n| `@astracollab/ai/cursor` | Cursor inference client + AI SDK provider |\n\n## License\n\nMIT — see [LICENSE.md](./LICENSE.md).\n","readmeFilename":"README.md","_rev":"1-73dbed18c0dc099e802f68b2f27f545c"}