OpenAI Compatibility
Friendli Serverless Endpoints is compatible with the OpenAI API standard through the Python API Libraries and the Node API Libraries. Friendli Dedicated Endpoints and Friendli Container are also OpenAI API compatible.
Friendli Serverless Endpoints is compatible with the OpenAI API standard through the Python API Libraries and the Node API Libraries.
Friendli Dedicated Endpoints and Friendli Container are also OpenAI API compatible.
Through this guide, you will learn how to:
- Send inference requests to Friendli Serverless Endpoints in Python and Node.js.
- Use chat models supported by Friendli Endpoint.
- Generate streaming chat responses.
Model Supports
meta-llama-3.1-70b-instruct
meta-llama-3.1-8b-instruct
mixtral-8x7b-instruct-v0-1
- and more!
You can find more information about each text generation model here. Log in to the Friendli Suite to create your Friendli Token for this quick tutorial. We will use the Llama 3.1 70B Instruct model as an example in this tutorial.
Quick Guide
If you want to integrate Friendli Serverless Endpoints to your application that had been using OpenAI, you can simply switch the following components: API key, model, and the base url. The API key is equivalent to your Friendli Token, which you can create here. After choosing your generative text model, you can find the model id by pressing the ‘More info’ icon, or by using the ids listed in the Model Supports section above. Last but not least, change the base url to https://api.friendli.ai/serverless/v1 and you are all set!
Python
This example demonstrates how you can use the OpenAI Python SDK to generate a response.
Default Example Code
Streaming Example Code
Node.js
This example demonstrates how you can use the OpenAI Node.js SDK to generate a response.
Default Example Code
Streaming Example Code
Results
Was this page helpful?