Apiary is a large language model (LLM) gateway for handling requests to multiple LLM providers with a unified API. It provides built-in observability, cost tracking, fallbacks, request routing, simple and semantic caching, and output guardrails.
The Apiary CLI tool facilitates easy deployment of its AWS infrastructure. Once deployed, you can start making LLM requests using the Apiary SDK.
Apiary deploys and provisions the following key components in your AWS account:
To get started with Apiary, ensure that you have the following set up:
- An active AWS account with a user or role that has the
AdministratorAccesspolicy attached. This user or role must be configured for use with the AWS CLI. - AWS CLI is installed and configured
- AWS CDK is installed
- AWS Bedrock is configured in your account to allow access to the Titan Text Embeddings V2 model
- Bedrock access must be configured through the Bedrock console. Follow these steps to grant access to the Titan Text Embeddings V2 model.
- Node.js and npm are installed
To install the Apiary CLI tool, run the following command:
npm install -g @apiary-gateway/cliTo verify that the installation was successful, run:
apiary --versionThis will output the installed version number.
To view a list of available commands, run:
apiary --helpRunning apiary create will clone the Apiary CDK infrastructure into a new apiary folder inside your current working directory. Make sure you're in the directory where you want the apiary folder to be created before running the command.
Upon running apiary create, you'll be prompted to provide your LLM provider API
keys as part of the deployment process. These will be securely stored using AWS
Secrets Manager.
Once deployed, the Apiary CLI will output:
- An
AiGatewayRestApiEndpointURL - you can start sending LLM requests to this URL using the Apiary SDK - An API key to use when sending requests to your Apiary instance. Please save this key securely for future reference
- You can manage API keys and usage plans for your Apiary instance using the commands below
- A
FrontendCloudFrontUrlURL - visit this URL to access the Observability and Management Dashboard. Use the dashboard to:- Set custom routing rules for your Apiary instance
- Configure caching and guardrails settings
- Monitor requests and LLM responses flowing through the system
apiary createapiary destroyapiary update-llm-api-keysapiary delete-llm-api-keysapiary create-usage-plan-with-keyapiary get-usage-plansapiary delete-usage-planapiary edit-usage-planapiary help [COMMAND]
Deploy Apiary infrastructure to AWS.
Delete all Apiary resources in your AWS account. This action is irreversible.
Update your stored API keys for LLM providers.
Delete all of your stored API keys for LLM providers. This action is irreversible.
Create a new usage plan for your Apiary instance with an associated API key.
View all usage plans associated with your Apiary instance.
Delete a specific usage plan associated with your Apiary instance. This will also delete the API key(s) associated with the usage plan. You'll be prompted to provide the usage plan ID.
Edit a specific usage plan associated with your Apiary instance. You'll be prompted to provide the usage plan ID.
Display usage and description for an Apiary command.
