Back to Lobehub

Using OpenRouter API Key in LobeHub

docs/usage/providers/openrouter.mdx

2.1.562.8 KB
Original Source

Using OpenRouter in LobeHub

<Image alt={'Using OpenRouter in LobeHub'} cover src={'/blog/assets34400653/40520a43-ac03-4954-8a4d-282fbb946066.webp'} />

OpenRouter is a platform that provides access to a wide range of high-quality large language model APIs. It supports models from OpenAI (including GPT-3.5/4), Anthropic (Claude2, Instant), LLaMA 2, PaLM Bison, and more.

This guide will walk you through how to use OpenRouter in LobeHub:

<Steps> ### Step 1: Register and Log In to OpenRouter
  • Visit OpenRouter.ai and create an account.
  • You can log in using your Google account or MetaMask wallet.

<Image alt={'Register on OpenRouter'} height={457} inStep src={'/blog/assets34400653/a024af40-e1d9-4df0-b998-0e6e87cebe5b.webp'} />

Step 2: Create an API Key

  • Go to the Keys section or visit OpenRouter Keys directly.
  • Click Create Key to begin.
  • In the pop-up dialog, give your API key a name, such as "LobeHub Key".
  • Leave the Credit limit field blank if you don’t want to set a spending cap.

<Image alt={'Create OpenRouter Key'} height={460} inStep src={'/blog/assets34400653/094d701f-ce80-464a-bbbc-0a5ecc8d08e3.webp'} />

  • Copy the API key from the dialog and store it securely.

<Image alt={'Retrieve OpenRouter Key'} height={519} inStep src={'/blog/assets34400653/7a012a11-87bd-4366-a567-0ebf6d12ae10.webp'} />

<Callout type={'warning'}> Make sure to store your API key securely, as it will only be shown once. If you lose it, you’ll need to generate a new one. </Callout>

Step 3: Add Credit to Your Account

  • Go to the Credit section or visit OpenRouter Credit.
  • Click Manage Credits to add funds. You can view model pricing at https://openrouter.ai/models.
  • OpenRouter also offers some free models that can be used without adding credit.

<Image alt={'Add Credit to OpenRouter'} height={385} inStep src={'/blog/assets34400653/50b73232-01fc-4ef0-939a-3e06354d1b5a.webp'} />

Step 4: Configure OpenRouter in LobeHub

  • Open the Settings panel in LobeHub.
  • Under AI Providers, find the OpenRouter section.
  • Enable OpenRouter and paste in your API key.

<Image alt={'Configure OpenRouter in LobeHub'} height={518} inStep src={'/blog/assets34400653/5c3898ab-23d7-44c2-bbd9-b255e25e400c.webp'} />

  • Choose an OpenRouter model for your assistant to start chatting.

<Image alt={'Using OpenRouter Models'} height={518} inStep src={'/blog/assets34400653/77b5feee-3f46-486d-9a36-31ff60efa5e9.webp'} />

<Callout type={'warning'}> You may incur charges when using API services. Please refer to OpenRouter’s pricing policy for more details. </Callout> </Steps>

You’re now ready to start using OpenRouter’s models in LobeHub for conversations.