GoodMemGoodMem
Get Started

Get Started with the CLI

Use the GoodMem CLI on a self-hosted server to create an embedder, a space, and an LLM, add a PDF, and run a search.

This guide uses the GoodMem CLI. You will create an embedder, a space, and an LLM, add a PDF, and run a search. To do the same steps in your browser, see Getting Started.

The CLI uses gRPC. It works with a self-hosted server. GoodMem Cloud instances do not expose the gRPC port, so use the Console, an SDK, or REST for Cloud.

Before you start

You need the CLI and a running server. Use one of these options:

  • Self-hosted installation. Install GoodMem. The installer saves your root API key in the active CLI profile, so CLI commands work immediately.

  • Codespace. Open a Codespace from the GoodMem template repository. It includes the server and the CLI:

    Open Codespace

    The Codespace can also install optional tools, such as Jupyter Notebook, the SDK playground, and other languages. In the Codespace terminal, run:

    source .devcontainer/optional-feature-installer.sh

    The template's optional features instructions list the tools and versions.

To show your GoodMem API key, use this command:

goodmem profile current --show-api-key

The command shows the active CLI profile only. For a local installation, it also shows the Console URL.

The SDKs and the REST API also need this key. The Security Model page explains how API keys and permissions work.

If you operate a hosted or shared server, also read these guides before you accept traffic:

The default install uses a self-signed certificate. TLS is enabled out of the box, but clients cannot verify the ephemeral certificate. For local development, mkcert creates certificates trusted by your system. Clients with a separate CA bundle, including the Python SDK, also need that CA configured; see Python TLS configuration. The mkcert guide also covers migrating an existing install. See TLS Configuration for all options.

Set up models and a space

  1. Get an OpenAI API key from the OpenAI dashboard.

    To keep the key out of your shell history, export it as GOODMEM_CRED_API_KEY. Then omit --cred-api-key in the commands below. The CLI reads the environment variable when the flag is absent.

  2. Create an embedder. You must create the embedder before the space:

    goodmem embedder create \
      --display-name "OpenAI Small Embedder" \
      --provider-type OPENAI \
      --endpoint-url "https://api.openai.com/v1" \
      --model-identifier "text-embedding-3-small" \
      --dimensionality 1536 \
      --cred-api-key YOUR_OPENAI_API_KEY_FROM_STEP_1

    The command should output:

    Embedder created successfully!
    
    ID:               xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Display Name:     OpenAI Small Embedder
    Owner:            xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Provider Type:    OPENAI
    Distribution:     DENSE
    Endpoint URL:     https://api.openai.com/v1
    API Path:         /embeddings
    Model:            text-embedding-3-small
    Dimensionality:   1536
    Modalities:       TEXT
    Created by:       xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Created at:       2026-08-20T21:09:00Z

    SAVE THE ID

    For help with endpoint_url or api_path for other providers, see the Endpoint registration guide.

  3. Create a space that uses that embedder:

    goodmem space create \
      --name "My OpenAI Small Space" \
      --embedder-id YOUR_EMBEDDER_ID_FROM_STEP_2

    The command should output:

    Space created successfully!
    
    ID:         xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Name:       My OpenAI Small Space
    Owner:      xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Created by: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Created at: 2026-08-20T21:08:20Z
    Embedder:   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (weight: 1.0)

    SAVE THE ID

  4. Create an LLM to write answers:

    goodmem llm create \
      --display-name "My GPT-4o" \
      --provider-type OPENAI \
      --endpoint-url "https://api.openai.com/v1" \
      --model-identifier "gpt-4o" \
      --cred-api-key YOUR_OPENAI_API_KEY_FROM_STEP_1

    The command should output:

    LLM created successfully!
    
    ID:               xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Display Name:     My GPT-4o
    Owner:            xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Provider Type:    OPENAI
    Endpoint URL:     https://api.openai.com/v1
    API Path:         /chat/completions
    Model:            gpt-4o
    Modalities:       TEXT
    Capabilities:     Chat, Completion, Functions, System Messages, Streaming, Sampling Parameters
    Created by:       xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Created at:       2026-03-17T23:06:04Z
    
    Capability Inference:
    ✓ Chat Support: true (detected from model family 'gpt-4o')
    ✓ Completion Support: true (detected from model family 'gpt-4o')
    ✓ Function Calling: true (detected from model family 'gpt-4o')
    ✓ System Messages: true (detected from model family 'gpt-4o')
    ✓ Streaming: true (detected from model family 'gpt-4o')
    ✓ Sampling Parameters: true (detected from model family 'gpt-4o')

    SAVE THE ID

  1. Create a memory. This guide uses this sample PDF:

    An Excellent Study of Social Media and Its Positive and Negative Effects on Human Being’s Mental Health

    Download it, then run this command:

    goodmem memory create \
      --content-type "application/pdf" \
      --file "PATH_TO_WHERE_YOU_DOWNLOADED_THE_PDF" \
      --space-id YOUR_SPACE_ID_FROM_STEP_3

    It should output:

    Memory created successfully!
    
    ID:            xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Space ID:      xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Content Type:  application/pdf
    Page images:   enabled
    Status:        PENDING
    Created by:    xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Created at:    2026-03-17T23:18:33Z
    Metadata:
    filename: social_media_study.pdf

    SAVE THE ID (not the space ID, because you already have that)

  2. Wait for processing to complete. The memory starts as PENDING. GoodMem then extracts the text, divides it into chunks, and embeds them. Search finds the content only after this work completes. To see the status, list the memories in the space:

    goodmem memory list --space-id YOUR_SPACE_ID_FROM_STEP_3

    Find the row whose MEMORY ID is the ID from step 1. Run the command again until that row's STATUS is COMPLETED. Other rows can be older memories in the same space, so do not use their status. If the status is FAILED, make sure that the embedder's provider key is correct.

  3. Run a search. You can use non-interactive mode or interactive mode.

    Non-interactive mode returns the matching chunks:

    goodmem memory retrieve \
       "what are the top three negative effects of social media?" \
       --space-id YOUR_SPACE_ID_FROM_STEP_3

    Interactive mode opens a screen where you select the LLM from step 4 of the model setup. The LLM then writes an answer from the chunks:

    goodmem memory retrieve \
      --post-processor-interactive "what are the top three negative effects of social media?" \
      --space-id YOUR_SPACE_ID_FROM_STEP_3

Next steps

On this page