This guide provides a streamlined process for integrating Portkey AI into ToolJet using the ToolJet Marketplace Plugin. Follow this guide to add AI-powered capabilities such as chat completions and automations into your ToolJet apps, helping developers create powerful, low-code applications backed by Portkey’s AI for chat-based interfaces and automated workflows.

Prerequisites

  • Portkey API Key and Virtual Key from your Portkey dashboard.
  • ToolJet Account with access to the Marketplace Plugin feature.
  • Basic familiarity with ToolJet UI components.

Watch Demo

Watch this demo for a quick walkthrough on ToolJet’s UI components.

Before following this guide, ensure that you have completed the setup for using marketplace plugins in ToolJet.

Step-by-Step Onboarding

1

Install the Portkey Plugin from ToolJet Marketplace

  1. Go to ToolJet Dashboard > Plugins > Marketplace.
  2. Search for Portkey Plugin.
  3. Click Install to add the plugin to your project.

If Portkey has already been added to your marketplace, you can skip this step.

2

Configure the Portkey Plugin

  1. Navigate to Data Sources in your ToolJet workspace.
  2. Open Plugins.
  3. Click Add Portkey.
3

Add Portkey as a Datasource

  1. Enter the following details:
  • Authorization: Your Portkey API Key
  • Default Virtual Key: Your Portkey Virtual Key
  1. Test the connection to ensure the keys are configured correctly.
4

Use Portkey in Your ToolJet App

  1. Go to Queries > Add Datasource > Select Portkey Plugin.
  2. From the dropdown, Select an Operation (details in the next section).
  3. Run the query to verify it responds correctly.
5

Link the Query to UI Components (Example)

  1. Add Text Input and Button widgets to your app’s interface.
  2. Configure the Button’s onClick action to Execute Query using the Portkey API.
  3. Use a Text Box widget to display the query results.
6

Test and Deploy

  1. Use Preview Mode to test the interaction between your app’s UI and the Portkey API.
  2. Deploy the app from the ToolJet dashboard.

Supported Operations

Portkey supports the following operations within ToolJet:

Completion

Generates text completions based on a given prompt.

Parameters:

  • Prompt: Input text to generate completions for.
  • Model: The AI model to use.
  • Max Tokens: Maximum number of tokens to generate.
  • Temperature: Controls randomness.
  • Stop Sequences: Sequences where the API stops generating further tokens.
  • Metadata: Additional metadata for the request.
  • Other Parameters: Additional request parameters.

For all operations, you can optionally specify:

  • Config: Configuration options for the request.
  • Virtual Key: Override the default virtual key with a specific one.

Troubleshooting

- Authentication Error

Double-check your API key and configuration.

- Slow Response

Adjust the temperature or max_tokens to optimize performance.

- CORS Issues

Ensure your API settings allow access from ToolJet’s domain.