CLI for managing the Apiary LLM Gateway
npm install @apiary-gateway/cliApiary 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.
* Infrastructure Overview
* Getting Started
* Commands
Apiary deploys and provisions the following key components in your AWS account:
src="./diagrams/full-architecture.png"
alt="apiary_infrastructure"
>
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 AdministratorAccess policy 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:
``bash`
npm install -g @apiary-gateway/cli
To verify that the installation was successful, run:
`bash`
apiary --version
This will output the installed version number.
To view a list of available commands, run:
`bash`
apiary --help
Running 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 AiGatewayRestApiEndpoint URL - you can start sending LLM requests to this URL using the Apiary SDKFrontendBucketUrl
- 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 URL - 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 create
- apiary destroy
- apiary update-llm-api-keys
- apiary delete-llm-api-keys
- apiary create-usage-plan-with-key
- apiary get-usage-plans
- apiary delete-usage-plan
- apiary edit-usage-plan
- [apiary help [COMMAND]`](#apiary-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.