This is Fujii. In this article, I will explain how to use your own API key in Afforai.
I got a question on YouTube.
It says "Bring Your Own Key via OpenRouter (GPT4, Claude, Sonnet, Gemini, etc)" but I don't know how to set it up. I would appreciate it if you could explain it to me.
Normal use of Afforai does not require BYOK settings. If you wish to set up your own, please continue reading below.
This article first explains BYOK. Then,
- Secure Setup Method
- How to manage costs to avoid going broke from overuse of APIs
- How to Customize AI Models in Afforai
in turn.
What is Bring Your Own Key (BYOK)?
First, the acronym for Bring Your Own Key.BYOKIt is.
Afforai's chat function is unlimited.
*There is a fair use policy, though, so you may be banned if you use the service in a way that breaks the service.
But what if you want to use an AI model that is not supported by Afforai?
That is BYOK. Use your own API key,That's what I mean.
You can use the encrypted OpenRouter API key (rest assured that the API key is not viewed by Afforai's management).
Explanation of OpenRouter from registration to fee payment
first (of all)OpenRouterFirst, we will use OpenRouter. Simply put, it is a platform where you can use various AI models. Think of it as a place where you can access and run a variety of free and paid AI models.
To use BYOK in Afforai, use this OpenRouter.
If you do not have an OpenRouter account, please continue reading below. If you already know that, please skip to the bottom of the page.
How to create an OpenRouter account [How to register].
First.Official SiteGo to the "Create an account" page. Although it is in English, you can easily create an account for free by following these steps▼.
First, press the "SIgn In" button from the top page.
A login form will appear. There is a Sign up link at the bottom. Please press it.
Here you will find the form below.
- Email address (Enter your email address)
- Password (you can choose your own password)
Set these two freely. After setting, press the button.
You will then receive a confirmation email.
Check your email inbox and you will find a confirmation email from OpenRouter.
If you did not receive it, it is in your spam folder. Most likely, this will not happen, but please check just in case.
Please press the button in the e-mail you receive. This completes your registration.
How to pay for OpenRouter [Stripe can be used].
The following OpenRouter payment methods.
Press "Credits" from the menu in the upper right corner.
Go to the Credits page. Press "Manage Credits.
If you would like to receive a receipt, check the "Send me invoices" box that opens here.
Press "Use checkout page" to settle your payment on the payment page.
You will need to enter your personal information. This area can be entered in Japanese, so the explanation is omitted.
If you have a credit card stored in Stripe, you will immediately see the payment options as shown below.
If you check the "Use checkout page" checkbox, you will be able to pay on the Stripe payment page.
You can pay by Stripe as follows. If you are worried about using a credit card on an overseas site, don't worry.
Manage OpenRouter Keys
To manage API keys, press "Keys" from the top right corner of the OpenRouter dashboard.
You can manage each setting of the key and set billing limits. Be sure to check the settings carefully to prevent overuse.
Press Manege to set the Credit limit as shown in the image below. This is optional, but recommended.
If set here, once the amount of credits ($USD) consumed by this API key reaches this amount, it cannot be used any more.
For unlimited use, you do not need to enter anything.
API usage can also be monitored from Activity.
You have complete control over key usage.
In the OpenRouter setup, you can freely choose the AI model.
Again, there is no need to configure any OpenRouter settings for normal use with Afforai; there is no need to configure BYOK.
This option is for those who are not satisfied with Afforai's default AI model.
How to set up BYOK in Afforai
First, open an Afforai chat.
Press the "Custom" AI model setting in the menu.
Now press the "Connect to OpenRouter" button.
You will be redirected to the OpenRouter page. Press Authorize here.
It will then automatically return to Afforai.
Notes on using BYOK in Afforai
- Using BYOK with Afforai will incur API fees from your OpenRouter account.
- It is recommended that spending limits be set in order to control spending.important
Needless to say, using BYOK incurs API costs. You can avoid overuse by limiting it.
However, OpenRouter is not my service. Therefore, I am not responsible for its configuration and usage. Please do so at your own risk.
How to Customize BYOK in Afforai
When you connect the OpenRouter key, you will see the settings to customize OpenRouter in Afforai.
BYOK mode
Option to configure the usage of the OpenRouter key. The following options are provided
- Disabled: The key remains connected to Afforai but is not used.
- Afforai Pick: Uses the same model as the Afforai system.
- Custom: Users can choose their own model.
- OpenRouter's Default: The model is selected through the OpenRouter UI. This option is not recommended as different models cannot be selected for different operations.
Multimodal Model
This model answers the question with an image (used for file annotation).
Query Model
This model is responsible for answering questions (used at query time).
JSON Model
This model is responsible for generating JSON objects for use in intermediate processing.
Tips for setting up BYOK in Afforai
Afforai can use its own API key. This option is not necessary for normal users, but by connecting the API key with BYOK, you can use AI models that are not normally available in Afforai.
Here is some advice before you set it up. The following advice from Afforai is pasted below.
- Initially, start with the Afforai selection to understand how to use the keys.
- If you want to choose your own model, we recommend that you change only the Query Model and leave the others as GPT-3.5.
- If you want to customize the model significantly, choose the cheapest option possible for each model, and gradually increase the performance of the model to find the cosmetics that are best suited to your needs.
Note: It is strongly recommended to select a model with at least 16,000 tokens in the context window. This will help maintain AI performance.
Selecting a model with less than 16,000 tokens will degrade the quality of the AI output and may not generate citations.
We hope this will be helpful to those who use BYOK in Afforai.
Latest Comments