Skip to main content

Using the CLI

ahnlich-cli is an interactive shell for talking to Ahnlich without writing any code. It's the fastest way to explore your data, run admin tasks, and sanity-check queries.

When to use what
  • Building an app? Use a client SDK — see the Quickstart.
  • Need to install or run the servers? See Installation.
  • Exploring or administering? You're in the right place.

Open the CLI

Make sure a server is running first (see Installation), then connect the CLI to it. The --agent flag picks which service you're talking to:

Talk directly to the vector store — you provide raw vectors yourself.

ahnlich-cli ahnlich --agent db --host 127.0.0.1 --port 1369

The command language

Ahnlich uses a declarative, SQL-like command style. Most commands follow this shape:

<COMMAND> <ARGS> IN <STORE> [WHERE (<predicate>)]

Commands are case-insensitive and can be chained with ;. Both agents share the same grammar — the only difference is that the DB engine takes raw vectors while the AI proxy takes raw text, images, or audio. Pick an agent below; the tabs stay in sync with the connection command above.

Create a store

CREATESTORE test_store DIMENSION 2 PREDICATES (author, country)

Insert data

SET (([1.0, 2.1], {name: Haks, category: dev}), ([3.1, 4.8], {name: Deven, category: dev})) IN test_store

Retrieve by key

GETKEY ([1.0, 2.0], [3.0, 4.0]) IN test_store

Search by similarity

GETSIMN 2 WITH [1.0, 2.0] USING cosinesimilarity IN test_store WHERE (category = dev)

Chain commands

GETKEY ([1.0, 2.0]) IN test_store; CREATEPREDINDEX (name, category) IN test_store

Command reference

CommandDescription
PINGCheck if the server is responsive
LISTCLIENTSList active connections
LISTSTORES [SCHEMA <schema>]List stores in a schema (defaults to public)
INFOSERVERGet server metadata / version
CREATESTORE <name> DIMENSION <n> ...Create a vector store
CREATEPREDINDEX (k1, k2) IN <store>Create a predicate (metadata) index
SET (...) IN <store>Insert one or more vectors
UPSERT NEWKEY [<vector>] NEWVALUE {k:v} WHERE (<predicate>) IN <store>Update a single entry matching predicate
GETKEY (<vector>) IN <store>Retrieve entries by exact key
GETSIMN <n> WITH [<vector>] USING <metric> IN <store> WHERE (<predicate>)Query nearest neighbors
DROPSTORE <name> IF EXISTSDelete a store

Supported metrics for GETSIMN: cosinesimilarity, euclideandistance, and dotproductsimilarity.