{"id":26122954,"url":"https://github.com/clarifai/clarifai-nodejs","last_synced_at":"2025-04-13T13:50:43.628Z","repository":{"id":231128068,"uuid":"748208406","full_name":"Clarifai/clarifai-nodejs","owner":"Clarifai","description":"Experience the power of Clarifai’s AI platform with the nodejs SDK. 🌟 Star to support our work!","archived":false,"fork":false,"pushed_at":"2024-10-10T15:29:15.000Z","size":2926,"stargazers_count":19,"open_issues_count":7,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-10T23:05:29.828Z","etag":null,"topics":["artificial-intelligence","clarifai","clarifai-api","clarifai-javascript","computer-vision","deep-learning","image-classification","language-models","llm","machine-learning","natural-language-processing","nextjs","nodejs","object-detection","pretrained-models","rag","text-classification","text-generation","text-summarization","visual-search"],"latest_commit_sha":null,"homepage":"https://github.com/Clarifai/clarifai-nodejs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clarifai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-01-25T14:00:03.000Z","updated_at":"2025-01-29T19:14:37.000Z","dependencies_parsed_at":"2024-04-02T15:59:39.293Z","dependency_job_id":"127da0b8-0c52-4ddb-a301-07766a5a4587","html_url":"https://github.com/Clarifai/clarifai-nodejs","commit_stats":null,"previous_names":["clarifai/clarifai-nodejs"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clarifai%2Fclarifai-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clarifai%2Fclarifai-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clarifai%2Fclarifai-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clarifai%2Fclarifai-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clarifai","download_url":"https://codeload.github.com/Clarifai/clarifai-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724590,"owners_count":21151559,"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","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":["artificial-intelligence","clarifai","clarifai-api","clarifai-javascript","computer-vision","deep-learning","image-classification","language-models","llm","machine-learning","natural-language-processing","nextjs","nodejs","object-detection","pretrained-models","rag","text-classification","text-generation","text-summarization","visual-search"],"created_at":"2025-03-10T15:13:53.606Z","updated_at":"2025-04-13T13:50:43.606Z","avatar_url":"https://github.com/Clarifai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![image](https://github.com/user-attachments/assets/3721189c-01c0-4936-a73c-13dcbf808542)\n\n\u003ch2 align=\"center\"\u003eClarifai Node.js SDK\u003c/h2\u003e\n\n[![npm](https://img.shields.io/npm/v/clarifai-nodejs)](https://www.npmjs.com/package/clarifai-nodejs)\n[![Build](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml/badge.svg)](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml)\n[![Discord](https://img.shields.io/discord/1145701543228735582)](https://discord.com/invite/26upV8Y4Nd)\n\n\u003e This library is currently in developer preview, any improvements \u0026 feedback welcome!\n\n# Clarifai Node.js SDK\n\nThis is the official Node.js client for interacting with our powerful [API](https://docs.clarifai.com). The Clarifai Node.js SDK offers a comprehensive set of tools to integrate Clarifai's AI platform to leverage computer vision capabilities like classification, detection, segmentation and natural language capabilities like classification, summarisation, generation, Q\u0026A, etc into your applications. With just a few lines of code, you can leverage cutting-edge artificial intelligence to unlock valuable insights from visual and textual content.\n\n[Website](https://www.clarifai.com/) | [Schedule Demo](https://www.clarifai.com/company/schedule-demo) | [Signup for a Free Account](https://clarifai.com/signup) | [API Docs](https://docs.clarifai.com/) | [Clarifai Community](https://clarifai.com/explore) | [Node.js SDK Docs](https://docs.clarifai.com/nodejs-sdk/api-reference) | [Examples](https://github.com/Clarifai/clarifai-nodejs/tree/main/examples) | [Discord](https://discord.gg/XAPE3Vtg)\n\nGive the repo a star ⭐\n\n## Installation\n\n```sh\nnpm install clarifai-nodejs\n```\n\n### Next.js Server Components\n\nTo use Clarifai Node.js in Next.js App Directory with server components, you will need to add [clarifai-nodejs-grpc](https://github.com/Clarifai/clarifai-nodejs-grpc) package (which is one of the primary dependency of Clarifai Node.js SDK) to the [serverComponentsExternalPackages](https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages) config of `next.config.js`\n\n```js\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  experimental: {\n    serverComponentsExternalPackages: ['clarifai-nodejs-grpc'],\n  },\n}\n\nmodule.exports = nextConfig\n```\n\n## Usage\n\nClarifai uses **Personal Access Tokens(PATs)** to validate requests. You can create and manage PATs under your Clarifai account security settings.\n\n* 🔗 [Create PAT:](https://docs.clarifai.com/clarifai-basics/authentication/personal-access-tokens/) ***Log into Portal \u0026rarr; Profile Icon \u0026rarr; Security Settings \u0026rarr; Create Personal Access Token \u0026rarr; Set the scopes \u0026rarr; Confirm***\n\nExport your PAT as an environment variable. Then, import and initialize the API Client.\n\nSet PAT as environment variable through terminal:\n\n```cmd\nexport CLARIFAI_PAT={your personal access token}\n```\n\nor use [dotenv](https://www.npmjs.com/package/dotenv) to load environment variables via a `.env` file\n\n### Using Models\n\nUsing the celebrity face recognition model to predict the celebrity in a given picture. For list of all available models visit [clarifai models page](https://clarifai.com/explore/models).\n\n```ts\nimport { Input, Model } from \"clarifai-nodejs\";\n\nconst input = Input.getInputFromUrl({\n  inputId: \"test-image\",\n  imageUrl:\n    \"https://samples.clarifai.com/celebrity.jpeg\",\n});\n\nconst model = new Model({\n  authConfig: {\n    pat: process.env.CLARIFAI_PAT!,\n    userId: process.env.CLARIFAI_USER_ID!,\n    appId: process.env.CLARIFAI_APP_ID!\n  },\n  modelId: \"celebrity-face-recognition\",\n});\n\nmodel\n  .predict({\n    inputs: [input],\n  })\n  .then((response) =\u003e {\n    const result = response?.[0].data?.conceptsList[0].name ?? \"unrecognized\";\n    console.log(result);\n  })\n  .catch(console.error);\n```\n\n### Using Workflows\n\nUsing a custom workflow built on [clarifai.com](https://docs.clarifai.com/portal-guide/workflows/) to analyze sentiment of a given image. For list of all available workflows visit [clarifai workflows page](https://clarifai.com/explore/workflows)\n\n```ts\nimport { Input, Workflow } from \"clarifai-nodejs\";\n\nconst input = Input.getInputFromUrl({\n  inputId: \"test-image\",\n  imageUrl:\n    \"https://samples.clarifai.com/celebrity.jpeg\",\n});\n\nconst workflow = new Workflow({\n  authConfig: {\n    pat: process.env.CLARIFAI_PAT!,\n    userId: process.env.CLARIFAI_USER_ID!,\n    appId: process.env.CLARIFAI_APP_ID!\n  },\n  workflowId: \"workflow-238a93\",\n});\n\nworkflow\n  .predict({\n    inputs: [input],\n  })\n  .then((response) =\u003e {\n    const result =\n      response.resultsList[0].outputsList[0].data?.regionsList[0].data\n        ?.conceptsList[0].name ?? \"unrecognized\";\n    console.log(result);\n  })\n  .catch(console.error);\n```\n\n### Listing available apps in an user account\n\nOn Clarifai, apps act as a central repository for models, datasets, inputs and other resources and information. Checkout how to create apps on [clarifai portal](https://docs.clarifai.com/clarifai-basics/applications/create-an-application/).\n\n```ts\nimport { User } from \"clarifai-nodejs\";\n\nexport const user = new User({\n  pat: process.env.CLARIFAI_PAT!,\n  userId: process.env.CLARIFAI_USER_ID!,\n  appId: process.env.CLARIFAI_APP_ID!,\n});\n\nconst list = await user\n  .listApps({\n    pageNo: 1,\n    perPage: 20,\n    params: {\n      sortAscending: true,\n    },\n  })\n  .next();\n\nconst apps = list.value;\nconsole.log(apps);\n```\n\nFor full usage details, checkout our [API Reference docs](https://docs.clarifai.com/nodejs-sdk/installation-guide/modules)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarifai%2Fclarifai-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclarifai%2Fclarifai-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarifai%2Fclarifai-nodejs/lists"}