{"id":27232882,"url":"https://github.com/beenotung/mistral-client","last_synced_at":"2026-04-29T01:33:00.144Z","repository":{"id":283907934,"uuid":"953167898","full_name":"beenotung/mistral-client","owner":"beenotung","description":"Client SDK for Mistral AI API with rate limit throttling and helper functions to convert stream delta messages to html/markdown/text","archived":false,"fork":false,"pushed_at":"2025-03-22T23:47:16.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-18T12:00:18.173Z","etag":null,"topics":["ai","api","client","html","llm","markdown","mistral","rate-limit","sdk","stream","text","throttling","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beenotung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-22T18:13:16.000Z","updated_at":"2025-03-22T23:47:19.000Z","dependencies_parsed_at":"2025-03-24T05:15:30.837Z","dependency_job_id":null,"html_url":"https://github.com/beenotung/mistral-client","commit_stats":null,"previous_names":["beenotung/mistral-client"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/beenotung/mistral-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fmistral-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fmistral-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fmistral-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fmistral-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beenotung","download_url":"https://codeload.github.com/beenotung/mistral-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fmistral-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32407164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","client","html","llm","markdown","mistral","rate-limit","sdk","stream","text","throttling","typescript"],"created_at":"2025-04-10T14:10:22.966Z","updated_at":"2026-04-29T01:33:00.139Z","avatar_url":"https://github.com/beenotung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mistral-client\n\nClient SDK for Mistral AI API.\n\n[![npm Package Version](https://img.shields.io/npm/v/mistral-client)](https://www.npmjs.com/package/mistral-client)\n\n## Features\n\n- Rate limit throttling\n- Helper functions to convert stream delta messages to html/markdown/text\n- Typescript support\n\n## Installation\n\n```bash\nnpm install mistral-client\n```\n\nYou can also install `mistral-client` with [pnpm](https://pnpm.io/), [yarn](https://yarnpkg.com/), or [slnpm](https://github.com/beenotung/slnpm)\n\n## Usage Example\n\n### Setup Client SDK\n\n```typescript\nimport { MistralClient, completionContentToString } from 'mistral-client'\n\nasync function main() {\n  let client = new MistralClient({ apiKey: 'your-api-key' })\n\n  let prompt = `Introduce ts-liveview in zh-hk`\n  // use async or stream mode, see examples below\n}\n\nmain().catch(e =\u003e console.error(e))\n```\n\n### Chat Completion in Async Mode\n\n```typescript\nlet completion = await client.askAsync({\n  model: 'mistral-large-latest',\n  messages: [{ role: 'user', content: prompt }],\n})\n\nlet content = completionContentToString(completion?.message.content)\nconsole.log(content)\n```\n\n### Chat Completion in Streaming Mode\n\n```typescript\nlet stream = client.askInStream({\n  model: 'mistral-large-latest',\n  messages: [{ role: 'user', content: prompt }],\n})\n\nfor await (let completion of stream) {\n  let content = completionContentToString(completion.delta.content)\n  process.stdout.write(content)\n}\nprocess.stdout.write('\\n[end]\\n')\n```\n\n## Typescript Signature\n\n```typescript\nexport class MistralClient {\n  constructor(options: { apiKey: string })\n\n  askAsync(\n    request: ChatCompletionRequest,\n    options?: RequestOptions,\n  ): Promise\u003cChatCompletionChoice | undefined\u003e\n\n  askInStream(\n    request: ChatCompletionRequest,\n    options?: RequestOptions,\n  ): AsyncGenerator\u003cCompletionResponseStreamChoice, void, unknown\u003e\n}\n\nexport function completionContentToString(\n  content:\n    | ChatCompletionChoice['message']['content']\n    | CompletionResponseStreamChoice['delta']['content'],\n  options?: {\n    /** default 'text' */\n    format?: 'html' | 'markdown' | 'text'\n  },\n): string\n```\n\n## License\n\nThis project is licensed with [BSD-2-Clause](./LICENSE)\n\nThis is free, libre, and open-source software. It comes down to four essential freedoms [[ref]](https://seirdy.one/2021/01/27/whatsapp-and-the-domestication-of-users.html#fnref:2):\n\n- The freedom to run the program as you wish, for any purpose\n- The freedom to study how the program works, and change it so it does your computing as you wish\n- The freedom to redistribute copies so you can help others\n- The freedom to distribute copies of your modified versions to others\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Fmistral-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeenotung%2Fmistral-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Fmistral-client/lists"}