Use this CLI tool to manage your OneContext account.
OneContext is a platform that enables software engineers to compose and deploy custom RAG pipelines on SOTA infrastructure. You define the pipeline in YAML, and OneContext takes care of the rest of the infra (SSL certs, DNS, Kubernetes cluster, GPUs, autoscaling, load balancing, etc).
Check out our docs for a in-depth treatment of how our platform works!
Get it from GitHub
git clone https://github.com/onecontext/cli.git
cd cli
npm run build
npm link
Your API Key
onecli config set-api-key
You can get one here
Or, you can run the below command to open a browser session on the correct page:
onecli config create-user
Your base URL
The default base URL for the serverless platform is https://api.onecontext.ai/v1/
. You'll only need to set a custom base URL if you are on the dedicated plan and have a custom domain. Users on the dedicated plan have a custom GPU cluster set up just for them on their subdomain.
onecli config set-base-url
Now you can do (almost) everything the OneContext platform allows you to do, but from the command line, with a nice TUI.
For a quick overview though, please see below:
Pipelines
onecli pipeline list
This will list your pipelines like so.

Hint: pass a --verbose flag if you want to view the full yaml file for each pipeline.
onecli pipeline create --pipeline-name=index_pipeline --pipeline-yaml=example_yamls/index_pipeline.yaml && \
onecli pipeline create --pipeline-name=retrieve_fast --pipeline-yaml=example_yamls/retriever_pipeline.yaml
This command will create a pipeline according to the specification in the provided yaml file.
onecli pipeline delete --pipeline-name=index_pipeline
This will ask you for confirmation Yes / No before proceeding.
onecli pipeline run sync --pipeline-name=retriever_pipeline
onecli pipeline run sync --pipeline-name=retrieve_fast --override-args='{"query_embedder":{"query": "the difference between ipv4 and ipv6"}, "retriever" : {"top_k": 1}}'
As this is a retriever pipeline, it will return a list of chunks from the vector index. As we've set top_k equal to 1, there will be just one chunk in the list.

Knowledge Bases
onecli knowledge-base list

onecli knowledge-base create --knowledge-base-name=demo_kb
This will create a new knowledge base you can upload files to.
onecli knowledge-base delete --knowledge-base-name=demo_kb
This will ask you for confirmation Yes / No before deleting. Note, all the files, chunks, and embeddings connected to this Knowledge Base will be deleted.
Vector Indices
onecli vector-index list

onecli vector-index create --vector-index-name=demo_vi --model-name=BAAI/bge-base-en-v1.5
Note you must pass both the vector index name, and the model name (because each vector index is tied to a particular embedding model).
onecli vector-index delete --vector-index-name=demo_vi
This will ask you for confirmation Yes / No before deleting. Note all the embeddings in this vector index will be deleted. The source files will remain in the knowledge base.
Files
onecli knowledge-base files list --knowledge-base-name=rm_kb

onecli knowledge-base upload file --knowledge-base-name=rm_kb
A file picker TUI will open, showing all files in the current directory. If you select a file, it will upload the selected file to the knowledge base.

Confirmation will be shown like so:

onecli knowledge-base upload directory --knowledge-base-name=rm_kb
A file picker TUI will open, showing all files in the current directory. If you select a directory, it will upload all PDF, .txt, .docx, and .md within that directory. Confirmation will be shown like so:

onecli knowledge-base files delete select --knowledge-base-name=rm_kb
A file picker TUI will open, showing all files in the current knowledge base (on the server). If you select a file, it will ask you for confirmation Yes / No before deleting. If you delete it, all associated chunks and embeddings will also be deleted.
Runs
onecli pipeline run status

onecli pipeline run status --runid=24b554e89fc64e97955cf06e0e14dfc2

onecli pipeline run status --runid=24b554e89fc64e97955cf06e0e14dfc2 --show-steps

Hint: omit the "runid" selector to show this output for all runs on the account.
onecli pipeline run status --runid=24b554e89fc64e97955cf06e0e14dfc2 --show-config
Hint: omit the "runid" selector to show this output for all runs on the account.
If you have multiple runs, you can also further refine the output by passing flags such as:
skip
and limit
(for pagination).
sort
to sort by a field on the run.
date-created-gte
to only show runs with a date greater than or equal to the provided date.
date-created-lte
to only show runs with a date less than or equal to the provided date.
status
to only show runs with a particular status (e.g. "RUNNING").
For more information execute the below command:
onecli pipeline run status -h
Some troubleshooting tips:
I don't have node installed
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
When that's done, run:
sudo apt-get install -y nodejs=20.13.1-1nodesource1
I don't have permission to make a directory
i.e. instead of:
npm install -g @onecontext/cli
try:
sudo npm install -g @onecontext/cli
I still have an issue
We'll get back to you ASAP, or one of our helpful community will beat us to it.
Always happy to hear from our users! Please feel free to reach out. help
Thanks!