{"id":15184748,"url":"https://github.com/0x6a69616e/node-vercel-llm-api","last_synced_at":"2025-10-15T20:15:10.052Z","repository":{"id":188140902,"uuid":"678047018","full_name":"0x6a69616e/node-vercel-llm-api","owner":"0x6a69616e","description":"JavaScript implementation of ading2210/vercel-llm-api.","archived":false,"fork":false,"pushed_at":"2023-09-02T20:50:35.000Z","size":29,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-30T06:53:23.741Z","etag":null,"topics":["chatgpt","library","node","nodejs","openai","vercel"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vercel-llm-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0x6a69616e.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":"2023-08-13T14:08:44.000Z","updated_at":"2024-06-12T10:15:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"76b78366-95e6-4bb9-b351-617bd9ceb29d","html_url":"https://github.com/0x6a69616e/node-vercel-llm-api","commit_stats":null,"previous_names":["0x6a69616e/node-vercel-llm-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0x6a69616e/node-vercel-llm-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x6a69616e%2Fnode-vercel-llm-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x6a69616e%2Fnode-vercel-llm-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x6a69616e%2Fnode-vercel-llm-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x6a69616e%2Fnode-vercel-llm-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x6a69616e","download_url":"https://codeload.github.com/0x6a69616e/node-vercel-llm-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x6a69616e%2Fnode-vercel-llm-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279110816,"owners_count":26105907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["chatgpt","library","node","nodejs","openai","vercel"],"created_at":"2024-09-27T17:23:05.365Z","updated_at":"2025-10-15T20:15:10.012Z","avatar_url":"https://github.com/0x6a69616e.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Vercel LLM API\n\nThis is a reverse engineered API wrapper for the [Vercel AI Playground](https://play.vercel.ai/), which allows for free access to many LLMs, including OpenAI's ChatGPT, Cohere's Command Nightly, as well as some open source models.\n\nAlso a JavaScript implementation of the ading2210's [vercel-llm-api](https://github.com/ading2210/vercel-llm-api) Python library.\n\n## Table of Contents\n  * [Features](#features)\n  * [Limitations](#limitations)\n  * [Installation](#installation)\n  * [Documentation](#documentation)\n    + [Using the Client](#using-the-client)\n      - [Downloading the Available Models](#downloading-the-available-models)\n      - [Generating Text](#generating-text)\n      - [Generating Chat Messages](#generating-chat-messages)\n    + [Using StreamHandler](#using-streamhandler)\n    + [Miscellaneous](#miscellaneous)\n      - [Listening to Debug Messages](#listening-to-debug-messages)\n\n\u003csmall\u003e\u003ci\u003eTable of contents generated with \u003ca href='http://ecotrust-canada.github.io/markdown-toc/'\u003emarkdown-toc\u003c/a\u003e\u003c/i\u003e\u003c/small\u003e\n\n## Features\n - Download the available models\n - Generate text\n - Generate chat messages\n - Set custom parameters\n - Stream the responses\n\n## Limitations\n - No auth support\n - Can't use \"pro\" or \"hobby\" models\n\n## Installation\nYou can install this library by running the following command:\n```\nnpm install vercel-llm-api\n```\n\n## Documentation\n\u003cins\u003e*Note that the entire library requires the use of async/await.*\u003c/ins\u003e\n\n### Using the Client\nTo use this library, simply `require('vercel-llm-api')` and create a `Client` instance. You can specify custom Axios request configurations as an argument.\n\nSee [here](https://axios-http.com/docs/req_config) for the Axios request config.\n\n```js\nconst { Client } = require('vercel-llm-api'),\n  client = new Client();\n\nclient.on('ready', async () =\u003e {\n  // the client is ready to do whatever\n});\n```\nNote that the following examples assume `client` is the name of your `Client` instance and that it is inside an async function.\n\n#### Downloading the Available Models\nThe client downloads the available models upon initialization, and stores them in `client.models`. \n```js\n\u003e\u003e\u003e console.log(client.models)\n\n{\n  \"anthropic:claude-instant-v1\": { \n    \"id\": \"anthropic:claude-instant-v1\", // the model's id\n    \"provider\": \"anthropic\",             // the model's provider\n    \"providerHumanName\": \"Anthropic\",    // the provider's display name\n    \"makerHumanName\": \"Anthropic\",       // the maker of the model\n    \"minBillingTier\": \"hobby\",           // the minimum billing tier needed to use the model\n    \"parameters\": {                      // an object of optional parameters that can be passed to the generate function\n      \"temperature\": {                   // the name of the parameter\n        \"value\": 1,                      // the default value for the parameter\n        \"range\": [0, 1]                  // a range of possible values for the parameter\n      },\n      ...\n    }\n    ...\n  }\n}\n```\nNote that, since there is no auth yet, if a model has the `\"minBillingTier\"` property present, it can't be used.\n\nA list of model IDs is also available in `client.model_ids`.\n```js\n\u003e\u003e\u003e console.log(client.model_ids)\n[\n  \"anthropic:claude-instant-v1\", // locked to hobby tier; unusable\n  \"anthropic:claude-v1\",         // locked to hobby tier; unusable\n  \"replicate:replicate/alpaca-7b\",\n  \"replicate:stability-ai/stablelm-tuned-alpha-7b\",\n  \"huggingface:bigscience/bloom\",\n  \"huggingface:bigscience/bloomz\",\n  \"huggingface:google/flan-t5-xxl\",\n  \"huggingface:google/flan-ul2\",\n  \"huggingface:EleutherAI/gpt-neox-20b\",\n  \"huggingface:OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5\",\n  \"huggingface:bigcode/santacoder\",\n  \"cohere:command-medium-nightly\",\n  \"cohere:command-xlarge-nightly\",\n  \"openai:gpt-4\",                // locked to pro tier; unusable\n  \"openai:code-cushman-001\",\n  \"openai:code-davinci-002\",\n  \"openai:gpt-3.5-turbo\",\n  \"openai:text-ada-001\",\n  \"openai:text-babbage-001\",\n  \"openai:text-curie-001\",\n  \"openai:text-davinci-002\",\n  \"openai:text-davinci-003\"\n]\n```\n\nAn Object of default parameters for each model can be found at `client.model_params`.\n```js\n\u003e\u003e\u003e console.log(client.model_defaults)\n{\n  \"anthropic:claude-instant-v1\": {\n    \"temperature\": 1,\n    \"maximumLength\": 200,\n    \"topP\": 1,\n    \"topK\": 1,\n    \"presencePenalty\": 1,\n    \"frequencyPenalty\": 1,\n    \"stopSequences\": [\n      \"\\n\\nHuman:\"\n    ]\n  },\n  ...\n}\n```\n\n#### Generating Text\nTo generate some text, use the `client.generate` function, which accepts the following arguments:\n - `model` - The ID of the model you want to use.\n - `prompt` - Your prompt.\n - `params` - An Object of optional parameters. See the previous section for how to find these.\n\nThe function returns the newly generated text as a `ReadableStream`.\n\n```js\nawait client.generate('openai:gpt-3.5-turbo', 'Summarize the GNU GPL v3');\n```\n\n#### Generating Chat Messages\nTo generate chat messages, use the `client.chat` function, which accepts the following arguments:\n - `model` - The ID of the model you want to use.\n - `messages` - A list of messages. The format for this is identical to how you would use the official OpenAI API.\n - `params` - An Object of optional parameters. See the \"Downloading the Available Models\" section for how to find these.\n\nThe function returns the newly generated text as a `ReadableStream`.\n\n```js\nconst messages = [\n  {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n  {\"role\": \"user\", \"content\": \"Who won the world series in 2020?\"},\n  {\"role\": \"assistant\", \"content\": \"The Los Angeles Dodgers won the World Series in 2020.\"},\n  {\"role\": \"user\", \"content\": \"Where was it played?\"}\n];\n\nawait client.chat('openai:gpt-3.5-turbo', messages);\n```\n\n### Using StreamHandler\n\nStreamHandler is a utility function to handle the returned `ReadableStream` of the instantiated `Client`'s `chat` and `generate` functions.\n\nStreamHandler accepts the following arguments:\n - `stream` - The `ReadableStream`.\n - `callback` - An optional callback to process each chunk of the stream.\n\n...and returns an `Array` of `String`s.\n\n```js\nconst { Client, StreamHandler } = require('vercel-llm-api'),\n  client = new Client();\n\nclient.on('ready', async () =\u003e {\n  const messages = [\n    {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n    {\"role\": \"user\", \"content\": \"Who won the world series in 2020?\"},\n    {\"role\": \"assistant\", \"content\": \"The Los Angeles Dodgers won the World Series in 2020.\"},\n    {\"role\": \"user\", \"content\": \"Where was it played?\"}\n  ];\n  \n  const stream = await client.chat('openai:gpt-3.5-turbo', messages),\n    response = await StreamHandler(stream);\n\n  console.log(response); // returns [ \"The\", \" 2020\", \" World\", \" Series\", \" was\", \" played\", ... ]\n});\n```\n\n### Miscellaneous\n\n#### Listening to Debug Messages\nIf you want to show the debug messages, simply listen to the `debug` event of the `Client` instance.\n\n```js\nconst { Client } = require('vercel-llm-api'),\n  client = new Client();\n\nclient.on('debug', console.log);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x6a69616e%2Fnode-vercel-llm-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x6a69616e%2Fnode-vercel-llm-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x6a69616e%2Fnode-vercel-llm-api/lists"}