HARPA.AI
LIBRARYUSE CASESGUIDESAI COMMANDSBLOG

Connecting to OpenAI API

CONTENTS
NAVIGATE

Connecting to OpenAI API directly is the most reliable way to use AI features. Please note page-aware commands may consume many tokens. Using OpenAI API Keys could be more expensive than using ChatGPT Plus.

  1. To connect HARPA to OpenAI API, create an account at OpenAI.com.
  2. Create your API Key here. Copy the key. You won't be able to view it again, only revoke it or create a new one.
  3. Open HARPA AI, locate the model toggle on the bottom left corner of the interface. Click on it, and a selection menu will appear, presenting you with various choices.
  4. Change the Connection type to OpenAI API Key and paste your OpenAI API Key.
  5. Enter your preferred Chat Model. For example, “gpt-3.5-turbo”. To check which models are available to you, visit the OpenAI website at the following link: https://platform.openai.com/playground?mode=chat

# Why do I need an OpenAI API Key?

There are Pros and Cons to using OpenAI API keys over Browser Session:

  • Browser Session connection is free, Browser Session Plus is $20 / month and OpenAI API Key connection is paid per use based on the number of tokens (request volume).
  • GPT-4 access is unlimited on OpenAI API key connection. Browser Session is limited to 50 requests per 3 hours. - OpenAI API accounts may have access to GPT models with larger context windows, e.g. gpt-8k and gpt-32k.
  • The OpenAI API key connection never disconnects or logs you out.
  • Browser Session is either free or costs around $20 per month for Plus and GPT-3.5 is actually even faster on the browser session compared to the API.

# How do I get an OpenAI API Key?

# Create an OpenAI account

  • To begin, if you haven’t yet set up an OpenAI account, go to the OpenAI website to get started.

  • Look for the "Log in" or the "Sign Up" button located in the top right-hand corner of the website. Click on it and proceed to enter your details to log in. If you're new, you can register for an account or continue with your existing Google, Microsoft, or Apple account.

  • Verify your account: OpenAI will send an email with a verification link—click it to confirm your identity.

# Log in

Once your account is verified, open the OpenAI website and select the "Log In" button. Then, input the username and password you created during the sign-up process.

After logging in, direct your attention to the menu located on the right side of your screen. Hover your mouse over it and select the "API keys" option.

Alternatively, you can access the API keys directly by following this link: https://platform.openai.com/api-keys.

# Generate a new API key

In the API keys section, you'll find a "Create new secret key" button. Click this to initiate the generation of a new API key.

Upon clicking, a dialog box will appear prompting you to name your secret API key. It's wise to use distinct names for keys associated with various apps and sites for easy identification later on. Choose a name that will remind you of its specific purpose.

Once you've named your key, select the "Create secret key" button to proceed.

# Paste your API key into HARPA AI

Your newly generated secret key will be displayed next.

Ensure that you copy and securely paste this key into HARPA AI:

  1. Open HARPA AI on any website by clicking the HARPA AI icon in the top right corner or by pressing Alt+A (on Windows) or ^+A (on Mac).

  2. The AI Model Selector is situated in the bottom left corner. Open it and look for the 'OpenAI Key' option.

Paste your key there and then select the ChatGPT model.

To check which models are available to you, visit the OpenAI website at the following link: https://platform.openai.com/playground?mode=chat

Remember, it is crucial to copy and save this key in a secure location immediately, as it cannot be retrieved once this window is closed, due to security protocols. This key is necessary for authenticating your applications with OpenAI's services.

# Set up billing

OpenAI operates on a pay-as-you-go model for API usage. Therefore, if you haven't already configured a payment method, you will need to do this to activate your API key, as it will not function without it.

To establish your billing information, navigate to 'Billing' in the menu, and then proceed to 'Payment methods'.

You'll see the payment methods screen. Click Add payment method.

A dialog box will then appear for you to input your credit card and billing information. After entering your details, click 'Add payment method' to finalize the setup.

# Set usage limits

After setting up billing, it's a good idea to control your spending by setting usage limits. Click on 'Usage limits' from the left-side menu, enter your desired maximum usage numbers, and then hit 'Save'.

# F.A.Q.

Q: How do I determine the right temperature setting for my application? A: The temperature parameter affects the variability of the output. For more predictable and consistent results, choose a lower temperature setting. If you desire more novel and varied responses, increase the temperature. The right setting depends on your specific need for coherence versus creativity.

Q: Can I fine-tune the latest OpenAI models? A: Fine-tuning is currently available for gpt-3.5-turbo and the newer base models, such as babbage-002 and davinci-002. See the fine-tuning guide for more details on how to use fine-tuned models.

Q: Does OpenAI store the data input into the API? A: OpenAI now retains data submitted through the API for a duration of 30 days as of March 1st, 2023. OpenAI does not use this data to enhance it's models anymore. Learn more about OpenAI data usage policy. Some endpoints offer zero retention.

Q: How can I enhance the safety of my application when using the Chat API? A: To prevent the display of content that breaches OpenAI’s usage policies, you can add a moderation layer to your Chat API's outputs. OpenAI moderation guide offers step-by-step instructions for setting this up.

Q: Should I choose ChatGPT or the OpenAI API for my project? A: ChatGPT provides a conversational interface, along with extra features like web browsing capabilities, code execution, and plugins. The OpenAI API, in contrast, offers more customization options for developers. Your choice should depend on whether you require the full-featured environment of ChatGPT or the more flexible, developer-focused capabilities of the OpenAI API.

By integrating AI through the OpenAI API, you're not just keeping up with the trends; you're redefining customer interactions and streamlining your business processes to stand out in the ever-evolving digital era.

NEXT POST
Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service