You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Model Predict |[Predict](models/model_predict/README.md)| Call predict of any model in a [Python native way](models/model_predict/clarifai_llm.py) with our SDK. See many more examples [here](models/model_predict/)|[Docs for Python/Javascript](https://docs.clarifai.com/compute/models/inference/api)|
43
43
||[Using OpenAI Client](models/model_predict/openai_llm.py)| Use the openAI client to call openAI-compatible models in Clarifai. See many more examples [here](models/model_predict/). |[Docs for Pyhon/Typescript](https://docs.clarifai.com/compute/models/inference/open-ai)|
44
+
||[Using OpenAI Client on Node.js](nodejs/openai/getTextResponse.js)| Use the OpenAI node client to call OpenAI-compatible models in Clarifai. See many more examples [here](nodejs/openai/)|[Docs for Typescript](https://docs.clarifai.com/compute/models/inference/open-ai/)|
45
+
||[Using Vercel AI SDK on Node.js](nodejs/vercel-ai-sdk/getTextResponse.js)| Use the Vercel AI SDK with OpenAI provider to call OpenAI-compatible models in Clarifai. See many more examples [here](nodejs/vercel-ai-sdk/)|[Docs for Typescript](https://docs.clarifai.com/compute/models/inference/open-ai/)|
44
46
||[Using LiteLLM](models/model_predict/openai_llm.py)| Use Litellm to call openAI-compatible models in Clarifai. See many more examples [here](models/model_predict/)||
45
47
||[Legacy Models](http://docs.clarifai.com/compute/models/inference/api-legacy/)| Call predict of any model not uploaded to compute orchestration with our SDK |[Docs](http://docs.clarifai.com/compute/models/inference/api-legacy/)|
46
48
| Model Upload |[Model Upload](https://github.com/clarifai/runners-examples)| Upload custom models, MCP tools, or any python function you want. See our new runner examples repo for compute orchestration with many examples covered! ||
Clarifai provides an OpenAI-compatible API endpoint, which allows you to leverage your existing OpenAI API code and workflows to make inferences with Clarifai models, including those that integrate or wrap OpenAI models.
4
+
5
+
The built-in compatibility layer converts your OpenAI calls directly into Clarifai API requests, letting you harness Clarifai's diverse models as custom tools in your OpenAI projects.
6
+
7
+
This simplifies the integration process, as you don't need to rewrite your code specifically for Clarifai's native API structure if you're already familiar with OpenAI's.
8
+
9
+
## Prerequisites
10
+
11
+
- A Clarifai account with API access
12
+
- A Clarifai Personal Access Token (PAT)
13
+
14
+
## Setup
15
+
16
+
Clone this directory to your local machine using [degit](https://github.com/Rich-Harris/degit)
17
+
18
+
```bash
19
+
degit clarifai/examples/nodejs/openai
20
+
```
21
+
22
+
Install the required packages:
23
+
24
+
```bash
25
+
npm install
26
+
```
27
+
28
+
Add your Clarifai PAT to the environment variable `CLARIFAI_PAT`
29
+
30
+
```bash
31
+
export CLARIFAI_PAT=your_pat_here
32
+
```
33
+
34
+
or use a `.env` file to setup your environment variables.
35
+
36
+
## Notes
37
+
38
+
- The example uses Clarifai's GPT-4o model by default, but you can easily switch to other models
39
+
- Make sure your Clarifai PAT has the necessary permissions
Clarifai provides an OpenAI-compatible API endpoint, which allows you to leverage your existing OpenAI API code and workflows to make inferences with Clarifai models, including those that integrate or wrap OpenAI models.
4
+
5
+
The built-in compatibility layer converts your OpenAI calls directly into Clarifai API requests, letting you harness Clarifai's diverse models as custom tools in your OpenAI projects.
6
+
7
+
This simplifies the integration process, as you don't need to rewrite your code specifically for Clarifai's native API structure if you're already familiar with OpenAI's.
8
+
9
+
The [Vercel AI SDK](https://ai-sdk.dev/) provides a convenient way to interact with Clarifai's OpenAI-compatible API. You can leverage the [OpenAI provider](https://ai-sdk.dev/providers/ai-sdk-providers/openai) to interact with Clarifai models.
10
+
11
+
## Prerequisites
12
+
13
+
- A Clarifai account with API access
14
+
- A Clarifai Personal Access Token (PAT)
15
+
16
+
## Setup
17
+
18
+
Clone this directory to your local machine using [degit](https://github.com/Rich-Harris/degit)
19
+
20
+
```bash
21
+
degit clarifai/examples/nodejs/vercel-ai-sdk
22
+
```
23
+
24
+
Install the required packages:
25
+
26
+
```bash
27
+
npm install
28
+
```
29
+
30
+
Add your Clarifai PAT to the environment variable `CLARIFAI_PAT`
31
+
32
+
```bash
33
+
export CLARIFAI_PAT=your_pat_here
34
+
```
35
+
36
+
or use a `.env` file to setup your environment variables.
37
+
38
+
## Notes
39
+
40
+
- The example uses Clarifai's GPT-4o model by default, but you can easily switch to other models
41
+
- Make sure your Clarifai PAT has the necessary permissions
0 commit comments