{"_id":"@aiqlick/inference","name":"@aiqlick/inference","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aiqlick/inference","version":"0.1.0","description":"TypeScript client for the AIQLick inference API","license":"MIT","private":false,"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","test":"node --test dist/__tests__/*.test.js","prepublishOnly":"npm run build"},"peerDependencies":{"openai":">=4.60.0"},"devDependencies":{"@types/node":"^22.0.0","openai":"^7.4.0","typescript":"^5.6.0"},"keywords":["aiqlick","llm","inference","openai","bedrock"],"engines":{"node":">=18"},"_id":"@aiqlick/inference@0.1.0","gitHead":"211a235a40b13f411eaa3f8d0868d32a89814420","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-RlN5DFMBDoNRBkL8XlMemv5BHP54dO5UVhRzTR/TlMTsQoDXN7O7DqOX184h2ZirYwRDePW02IzeRYFUytsqKg==","shasum":"7524fcc080f91a5f8a0f4ab0ac87138dc5f0bce7","tarball":"https://registry.npmjs.org/@aiqlick/inference/-/inference-0.1.0.tgz","fileCount":7,"unpackedSize":17160,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCchiw+A1jmx4JTrO2TJOrfngo11Ujx/jHCBGNf1ZARpAIhAOlr7QrtKasWshvkNuemCHYbtoj4n/XUNJzuc3kc01gV"}]},"_npmUser":{"name":"rzeraat.tur","email":"rzeraat.tur@gmail.com"},"directories":{},"maintainers":[{"name":"rzeraat.tur","email":"rzeraat.tur@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/inference_0.1.0_1785895956886_0.6073382627568815"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-05T02:12:36.745Z","0.1.0":"2026-08-05T02:12:37.042Z","modified":"2026-08-05T02:12:37.250Z"},"maintainers":[{"name":"rzeraat.tur","email":"rzeraat.tur@gmail.com"}],"description":"TypeScript client for the AIQLick inference API","keywords":["aiqlick","llm","inference","openai","bedrock"],"license":"MIT","readme":"# @aiqlick/inference — TypeScript client\n\nA thin wrapper over the official [`openai`](https://www.npmjs.com/package/openai)\npackage for the AIQLick inference API.\n\nDeliberately thin. The whole product claim is that the API is OpenAI-compatible,\nso a client that reimplemented the protocol could drift away from that claim\nwithout anyone noticing. `AIQLick` extends `OpenAI`, so anything the official\nclient does — streaming, tool calling, retries, whatever it adds next — works\nhere unchanged.\n\n## Install\n\n```bash\nnpm install @aiqlick/inference openai\n```\n\n`openai` is a peer dependency, so you control its version and there is never a\nsecond copy of the SDK in your tree.\n\n## Use\n\n```ts\nimport { AIQLick, Models } from \"@aiqlick/inference\";\n\nconst client = new AIQLick({ apiKey: process.env.AIQLICK_API_KEY });\n\nconst reply = await client.chat.completions.create({\n  model: Models.CHAT_DEFAULT,\n  messages: [{ role: \"user\", content: \"hello\" }],\n});\nconsole.log(reply.choices[0]?.message?.content);\n```\n\nStreaming works exactly as it does with the official client:\n\n```ts\nconst stream = await client.chat.completions.create({\n  model: Models.CHAT_DEFAULT,\n  messages: [{ role: \"user\", content: \"hello\" }],\n  stream: true,\n});\nfor await (const chunk of stream) {\n  process.stdout.write(chunk.choices[0]?.delta?.content ?? \"\");\n}\n```\n\n## Models\n\nUse the aliases, not provider model ids:\n\n| Constant | Alias |\n|---|---|\n| `Models.CHAT_PREMIUM` | `aiqlick/chat-premium` |\n| `Models.CHAT_DEFAULT` | `aiqlick/chat-default` |\n| `Models.CHAT_CHEAP` | `aiqlick/chat-cheap` |\n| `Models.EXTRACT_DEFAULT` | `aiqlick/extract-default` |\n| `Models.EXTRACT_FAST` | `aiqlick/extract-fast` |\n| `Models.EMBED_DEFAULT` | `aiqlick/embed-default` |\n\nThe mapping from an alias to a specific provider model is a platform decision\nthat changes without callers changing — that is the entire point of the gateway.\nPinning a provider id in your own code gives that up.\n\nYour key may be scoped to a subset. `client.models.list()` returns only what it\ncan actually call.\n\n## Errors\n\nThe OpenAI SDK gives you a status and a message. `asAIQLickError()` promotes our\n`code` onto a typed error, which is what lets you tell \"out of credits\" from\n\"subscription lapsed\" — the same 402 with entirely different fixes.\n\n```ts\nimport { asAIQLickError, ErrorCodes } from \"@aiqlick/inference\";\n\ntry {\n  await client.chat.completions.create({ /* … */ });\n} catch (err) {\n  const specific = asAIQLickError(err);\n  if (specific?.code === ErrorCodes.INSUFFICIENT_CREDITS) {\n    // top up or upgrade the plan\n  }\n  throw specific ?? err;\n}\n```\n\nIt returns `undefined` for anything it does not recognise rather than guessing,\nso a provider error never gets mislabelled as a platform error.\n\n| `code` | Meaning |\n|---|---|\n| `INSUFFICIENT_CREDITS` | Credit balance exhausted |\n| `SUBSCRIPTION_INACTIVE` | No active subscription for the company |\n| `LLM_MODEL_NOT_ALLOWED` | Key not permitted to use that alias |\n| `LLM_GATEWAY_UNAVAILABLE` | Gateway unreachable — retry with backoff |\n\n## Configuration\n\n| Variable | Default |\n|---|---|\n| `AIQLICK_API_KEY` | — |\n| `AIQLICK_BASE_URL` | `https://api.aiqlick.com/llm/v1` |\n\nReading the base URL from the environment means one build can be pointed at dev\nor a self-hosted deployment without a code change.\n\n## Not using this client\n\nYou do not have to. The API is OpenAI-compatible, so the official client works\ndirectly — this package only saves you the base URL and the constants:\n\n```ts\nimport OpenAI from \"openai\";\nconst client = new OpenAI({\n  apiKey: \"sk-…\",\n  baseURL: \"https://api.aiqlick.com/llm/v1\",\n});\n```\n\nFull documentation: <https://docs.aiqlick.com>\n","readmeFilename":"README.md","_rev":"1-ac2ae568dfc295b36f54320eb6bbf6fd"}