Blog6 min read

Use SolCard Inference in Factory Droid (BYOK)

Add SolCard Inference to Factory Droid as BYOK custom models in settings.json: the customModels block, which provider to pick, compaction on Base, and fixes.

Contents

To use SolCard Inference in Factory Droid, add an entry to the customModels array in ~/.factory/settings.json with provider: "generic-chat-completion-api", baseUrl: "https://api.solcardinference.ai/v1", your sk-si- key and a model id such as solcard-inference-fast. Droid calls this BYOK, short for bring your own key. Everything about Droid below comes from Factory’s custom models page and settings reference. We haven’t run Droid ourselves. If you’d rather use a different agent, Crush and OpenCode can use the same API.

What you need

  • A SolCard Inference API key. Make one on the dashboard’s API keys page. Keys start with sk-si- and are shown once.
  • Some balance or a plan. One prepaid USD balance pays for every key and model; see how billing works.
  • Droid, the CLI or the desktop app. Factory’s quickstart has the installers. Its pricing docs describe the Free plan as “bring your own inference.”

The customModels block

Droid creates ~/.factory/settings.json (%USERPROFILE%\.factory\settings.json on Windows) the first time it runs, and custom models go in its customModels array. Add one entry per model:

{
  "customModels": [
    {
      "model": "solcard-inference-fast",
      "displayName": "SolCard Inference Fast",
      "baseUrl": "https://api.solcardinference.ai/v1",
      "apiKey": "${SOLCARD_INFERENCE_API_KEY}",
      "provider": "generic-chat-completion-api",
      "maxOutputTokens": 32768,
      "maxContextLimit": 1048576
    },
    {
      "model": "solcard-inference-large",
      "displayName": "SolCard Inference Large",
      "baseUrl": "https://api.solcardinference.ai/v1",
      "apiKey": "${SOLCARD_INFERENCE_API_KEY}",
      "provider": "generic-chat-completion-api",
      "maxOutputTokens": 32768,
      "maxContextLimit": 1000000
    },
    {
      "model": "solcard-inference-base",
      "displayName": "SolCard Inference Base",
      "baseUrl": "https://api.solcardinference.ai/v1",
      "apiKey": "${SOLCARD_INFERENCE_API_KEY}",
      "provider": "generic-chat-completion-api",
      "maxOutputTokens": 32768,
      "maxContextLimit": 262144
    }
  ]
}

Then export the key in the shell you start droid from:

export SOLCARD_INFERENCE_API_KEY=sk-si-...

If you’d rather not edit JSON, the docs give a form: run /settings and open Custom models, or run /model and choose Manage custom models, then Add model. In the desktop app it’s Settings > Custom Models > Add Model.

What each field does, per Factory’s custom models page:

FieldWhat it’s for
modelThe id sent to the API. It must match ours exactly.
displayNameThe label in Droid’s model selector.
baseUrlThe API base URL. Ours ends in /v1.
apiKeyYour key. ${VAR_NAME} reads it from an environment variable.
providerWhich API format Droid speaks. generic-chat-completion-api is OpenAI Chat Completions.
maxOutputTokensThe most a response may write. Ours stops at 32,768 tokens per request.
maxContextLimitThe context window in input tokens, from our models page.

We left out noImageSupport. The docs say it defaults to true for generic-chat-completion-api, which suits models that take text only. For keys from a password manager, the page also documents apiKeyHelper, a shell command whose output becomes the key. Droid honors it only in personal and org-managed settings, not in a project’s settings, so a cloned repo can’t run a command that way.

Base and the 250,000-token compaction

Droid compacts a session at 250,000 tokens by default, which leaves too little room on Base’s 262k window. Per the custom models page, a bigger maxContextLimit doesn’t make Droid compact later: compaction starts at your compaction token limit, and the page says to keep that limit below maxContextLimit. On Fast and Large, 250,000 is far below the window, so nothing needs changing.

On Base, a 250,000-token conversation plus a 32,768-token answer comes to more than 262,144. Lower the threshold with compactionTokenLimit, which the settings reference describes as the “Token threshold that triggers automatic compaction”:

{
  "compactionTokenLimit": 200000
}

That setting applies to every model. The reference also lists compactionTokenLimitPerModel, a { "<modelId>": number } map, but doesn’t say which id a custom model uses there. So if you only use Base now and then, the global setting is the safe choice.

Pick it in /model

Saved custom models appear under Custom Models in /model, labeled by displayName. Start on Fast and switch to Large when a change needs planning or a bug won’t budge. Large always reasons, and it costs three times as much per input token. The docs add that personal custom models show up only in the CLI and desktop app, not in Factory’s hosted web or mobile apps, because they’re read from your local file. Fast, Large or Base compares the three.

Check it works

Check the key and URL from a terminal first:

curl https://api.solcardinference.ai/v1/models \
  -H "Authorization: Bearer $SOLCARD_INFERENCE_API_KEY"

You should see solcard-inference-fast, -large and -base. Then cd into a project, run droid, open /model, pick SolCard Inference Fast and ask for something small, such as “Explain what this file does.”

What a long turn costs

Compaction also limits cost, because the conversation Droid resends each turn never grows past the threshold. A turn on Fast just under the 250,000 default, resending 240,000 tokens with 230,000 of them cached and writing 3,000 tokens, is about $0.049. The same turn on Large is about $0.14 plus its reasoning. Early turns in a session cost far less. How billing works has the plans and what a request is charged for.

Troubleshooting

If a model doesn’t show up or an edit seems ignored, check for an old ~/.factory/config.json. The docs say Droid copies custom models from that legacy file, with snake_case fields like custom_models and base_url, into settings.json on startup. After that, it ignores edits to models it has already copied. Guides written for the old format still show config.json; make your changes in settings.json.

Our API’s codes, from the errors page; Droid may word them differently:

  • 401 invalid_api_key: the key is missing, revoked or unknown. Check that SOLCARD_INFERENCE_API_KEY is set in the shell that started droid.
  • 400 model_not_found: the model field doesn’t match. Use solcard-inference-fast, -large or -base.
  • 400 unsupported_content: an image or file reached the model. Keep noImageSupport at its default for this provider.
  • 402 insufficient_balance: top up, then retry.
  • 429 rate_limited: too many requests a minute for your plan.

FAQ

Can I use the anthropic or openai provider instead? Droid’s anthropic provider speaks Anthropic Messages and openai speaks OpenAI Responses, and our API speaks both. The docs say noImageSupport defaults to false for those two, so set it to true if you try them. This guide covers the Chat Completions route.

Does my API key go to Factory? Factory’s docs say “Your API keys remain local and are not uploaded to Factory servers.” They don’t say whether the requests themselves pass through Factory, so check Factory’s own terms for that side. On our side, prompts and responses are never logged or stored; keeps nothing follows one request through.

Can I keep Factory’s built-in models too? Yes. Custom models sit in their own group in /model, next to the built-in ones.

Bring the prompt that got refused.

Private. No refusals. In the app, or in the tools you already use.

Pay in crypto. No KYC.