OpenAI API
Using the OpenAI API in your bots
The lil’bots platform comes with OpenAI access built in. You can use the OpenAI API to build bots that can generate text, answer questions, generate images and more.
Using the OpenAI API
To use OpenAI, you can make requests to the OpenAI API without including an API key. The requests will be recognized and authroized by the lil’bots platform.
The following endpoints are supported (including any nexted routes):
- /v1/models - list the models available for use docs
- /v1/chat - chat with a model / generate text docs
- /v1/audio - generate audio from text (text to speech) and transcribe text docs
- /v1/images - generate images from text docs
To read the full OpenAI API documentation, visit the OpenAI API Reference.
Using the OpenAI SDK - JavaScript Runtime
You can use the OpenAI SDK in your bots to make requests to the OpenAI API. The SDK is available in the JavaScript runtime by installing it from deno.land:
You can then use the SDK to make requests to the OpenAI API. Here’s an example of a simple bot that uses the OpenAI API to answer a question:
Generating Speech with OpenAI
You can use the OpenAI API to generate speech from text. Here’s an example of a bot that uses the OpenAI API to generate speech from text:
Generating Images with OpenAI
You can use the OpenAI API to generate images from text. Here’s an example of a bot that uses the OpenAI API to generate an image from text: