Factory Droid

Factory Droid is a terminal coding agent. It reads custom models from ~/.factory/settings.json and does not get the model list itself. The block in step 1 reads the live model list and adds each text model as a custom model.

Start with the Liquid CLI

The Liquid CLI can start Droid with your key. Droid keeps its settings in a file, so set it up one time first.

  1. Run liquid connect factory-droid. It prints the setup below with your model filled in.
  2. Start Droid with liquid factory-droid.
curl -fsSL https://inference.ai.exchange/cli/install.sh | bash
liquid login
liquid connect factory-droid
liquid factory-droid

Before you start

# installer
curl -fsSL https://app.factory.ai/cli | sh

# or with npm
npm install -g droid

1. Write the custom models

This block:

apiKey is the literal ${LIQUID_API_KEY}, which Droid expands at run time. The block sends the key on the models request, so the list includes your presets.

export LIQUID_API_KEY=sk-liquid-...
mkdir -p ~/.factory && touch ~/.factory/settings.json
curl -fsSL "https://router.inference.ai.exchange/v1/models?kind=text" -H "Authorization: Bearer $LIQUID_API_KEY" | jq --slurpfile cur ~/.factory/settings.json '
  .data as $book | ($cur[0] // {}) | .customModels = (
    [(.customModels // [])[] | select((.displayName // "") | startswith("Liquid: ") | not)] +
    [$book[] | {
      model: .id,
      displayName: ("Liquid: " + .id),
      baseUrl: "https://router.inference.ai.exchange/v1",
      apiKey: "${LIQUID_API_KEY}",
      provider: "generic-chat-completion-api",
      maxOutputTokens: ([.max_tokens // 16384, 32768] | min),
      noImageSupport: ((.liquid_supported_parameters // []) | index("input.image") == null),
      extraHeaders: { "X-Title": "Factory Droid", "x-liquid-cap-usd": "1.00" }
    }]
  )' > ~/.factory/settings.json.new && mv ~/.factory/settings.json.new ~/.factory/settings.json

Run the block again when the book changes.

2. Run it

droid

In a session, run /model and choose a model whose name starts with Liquid: . To get the current names, see the Market page or use GET /v1/models. See Market data. The exchange refuses a name that is not on the book. It never uses another model.

Control the cost

Each model sends x-liquid-cap-usd in extraHeaders. To change it, edit the header in ~/.factory/settings.json.

To limit the total spend, set a spending limit on the key. See API keys and Purchasing rules.

Troubleshooting

Symptom Cause and fix
Droid shows "Please login with your Factory account". Droid needs a Factory sign-in before it starts. Choose Login, finish the sign-in, then run /model. Liquid cannot skip this step.
The model is not listed. The book changed after the file was written. Run the block again.
401 The key variable is not set in the shell that starts Droid. Export LIQUID_API_KEY and start Droid again.
output_bound_unsupported maxOutputTokens is higher than the offer allows. Run the block again so each model takes its limit from the book.
jq reports a parse error settings.json contains comments, which JSON does not allow. Edit the customModels entries by hand, or remove them.

Next steps