API Keys in Chatmode are used to securely store the credentials for external Artificial Intelligence (AI) providers, such as OpenAI. These keys allow your configured Agents and other features within Chatmode to access the necessary AI models (like GPT-4) to function.

Understanding API Keys

When you configure an Agent in Chatmode, you select an AI model (e.g., gpt-4-turbo). To use this model, Chatmode needs the corresponding API key from the provider (e.g., OpenAI). You add these external provider keys to Chatmode, and they are securely stored. Chatmode uses these stored keys internally to make requests to the respective AI provider on your behalf whenever an interaction requires the AI model. Key points:
  • API Keys in Chatmode represent your keys from external providers (OpenAI, etc.).
  • They are not keys used to access Chatmode itself via an external API.
  • Chatmode encrypts these keys at rest for security.

Obtaining Keys from Providers

Before adding a key to Chatmode, you need to obtain it from the respective AI provider. Here’s a general guide for common providers:

OpenAI

  1. Account: You need an OpenAI account with billing set up. Go to platform.openai.com.
  2. API Key Section: Navigate to the API Keys section in your account settings (often found under your profile or organization settings).
  3. Create New Key: Click “Create new secret key”. Give it a descriptive name (e.g., “Chatmode Project Key”).
  4. Copy Key: Immediately copy the generated key. It will only be shown once. Store it securely.
  5. Permissions: Ensure the key has the necessary permissions to use the models you intend to use in Chatmode (e.g., GPT-4, GPT-3.5-turbo).
  6. Cost: Usage is billed by OpenAI based on token consumption for the models used. Set usage limits in your OpenAI account to manage costs.
Always refer to the official documentation of OpenAI for the most up-to-date instructions on obtaining API keys and understanding their billing models. Keep your keys confidential.

Adding API Keys to Chatmode

To add a new external provider API key:
  1. Navigate to the Settings -> API Keys section in the Chatmode sidebar.
  2. Click the Add API Key button.
  3. Select the Provider (e.g., OPENAI) from the dropdown list.
  4. Paste the API key you obtained and copied from the provider into the API Key field.
  5. Click Save.
Treat your original API keys from providers like passwords. Securely manage them and only add them to trusted applications like Chatmode. Ensure you copy the key correctly from the provider.

Managing API Keys

The API Keys page lists all the provider keys you have added:

API Key List

Each key entry displays:
  • Provider: The AI provider (e.g., OPENAI).
  • Key: An obfuscated version of the key (e.g., sk-**...*123). The full key is never shown after saving.
  • Status: Whether the key is Active or Inactive. Inactive keys cannot be used by agents.
  • Created Date: When the key was added to Chatmode.

Activating/Deactivating Keys

You can toggle the status of a key between Active and Inactive. Deactivating a key is useful if you suspect it might be compromised or if you want to temporarily disable its use without deleting it. Agents using an inactive key will not function correctly.

Deleting Keys

You can delete a stored API key if it’s no longer needed or if it has been revoked by the original provider.
API Keys currently linked to active Agents cannot be deleted directly. You must first update the agents to use a different API key or delete the agents.

API Key Security

  • Secure Origin: Obtain your keys only from the official provider websites.
  • Storage: Chatmode encrypts your keys when storing them in the database.
  • Activation Control: Use the Active/Inactive status in Chatmode to control which keys are usable.
  • Rotation: If you rotate your keys with the provider (get a new key and delete the old one on the provider’s site), remember to add the new key to Chatmode and delete the old one. Update any agents using the old key.

Troubleshooting

  • Agent Errors: If an agent stops working, check if the API Key it uses is still Active in Chatmode and is valid with the external provider.
  • Invalid Key: Ensure the key pasted into Chatmode matches the one provided by OpenAI, etc., and corresponds to the selected provider type.

Next Steps

  • Ensure you have added the necessary API Keys for the models you intend to use.
  • Configure your Agents to use the appropriate stored API Key.