import Image from 'next/image'; import Video from '../../components/video/index.jsx'; import { Callout } from 'nextra/components'; import { Steps } from 'nextra/components'; import byokOg from '/public/tutorial/byok-og.png'; import byok1 from '/public/tutorial/byok1.png';
This tutorial demonstates how you can implement "Bring Your Own Key" (BYOK) feature in BuildShip. BYOK allows individual users or businesses to let their end-users integrate their own API keys within workflows.
This ensures greater flexibility and cost management, particularly in scenarios where multiple users or clients require separate API access.
Let's dig deeper into how you can implement BYOK in your BuildShip workflows.
- A system within your front-end application where users can input and securely store their respective API keys.
Pass the user's API key as an Authorization header in the request made to your BuildShip's API. This header will serve as a means to authenticate and authorize the user's access to specific functionalities within your workflow.
You can easily access the user's API key from the Request's Authorization Headers:
- Click on the Edit icon (✎) for the input field where you want to access the API key.
- Access the "Request" variable from the dropdown menu and select "Headers".
- Then, select the "Authorization" header from the list of headers.
Let's take a look at how you can implement BYOK in your BuildShip workflow using the OpenAI Text Generator model within BuildShip:
This workflow showcases the use of the OpenAI Text Generator node, ensuring that each user can utilize their individual API keys and prompts received from request parameters.
### "Get Authorization Header" Node Validates the presence of the `Authorization` Header in the incoming request, ensuring the user's API key is included.Validates the existence of the prompt
query parameter in the incoming request, which provides the prompt for Text
Generation.
- **API Key Input:** Retrieves the `Authorization` Header from the incoming request containing the user's unique API
key.
- **User Prompt Input:** Fetches the Query Parameters from the incoming request, acquiring the specific prompt for Text Generation.