Prerequisites
Before you begin, you will need:- An approved App in Tyk AI Studio: You should have already created an App and had it approved by a Studio Administrator. If you haven’t, please follow the guide on App Management for Consumers.
- Your App’s Secret: You will need these to authenticate your application.
- Node.js and npm installed: This tutorial uses NodeJS. You can download it from nodejs.org.
- An LLM configured in AI Studio: Your App must be configured to use at least one LLM. This tutorial will use OpenAI LLM models.
Instructions
Step 1: Set up your NodeJS project
First, create a new folder for your project and initialize a new NodeJS project within it.Step 2: Create the CLI application file
Create a new file namedindex.js in your project folder. This is where you will write the code for your CLI application.
Step 3: Write the application code
Openindex.js in your favorite code editor and add the following code. Be sure to replace the placeholder values with your actual App credentials and AI Gateway endpoint.
Expandable
Step 4: Run your CLI App
Now you can run your application from your terminal.Frequently Asked Questions
I'm getting a 401 Unauthorized error. What's wrong?
I'm getting a 401 Unauthorized error. What's wrong?
Can I use a different LLM?
Can I use a different LLM?
Yes, you can use any LLM that you have configured in your App.