# Add SolCard Inference to my models

You're a coding agent, and the user asked you to add SolCard Inference to their models. SolCard Inference is a private, OpenAI- and Anthropic-compatible inference API. Follow the steps for the tool you are (Claude Code or Codex), change only the files named here, and keep the user's other settings exactly as they are.

This page is meant to be read in full. If your fetch tool gave you a summary, read the exact text with `curl -fsSL https://api.solcardinference.ai/install` before you change anything.

## 1. The key

SolCard Inference keys start with `sk-si-`. Setting it up means saving the user's key in their agent settings, which they asked for by sending this.

- If the user's message includes a key, use it.
- Otherwise ask, in these words: "Paste your SolCard Inference key (it starts with `sk-si-`) and I'll save it in your settings. You can make one at https://app.solcardinference.ai/keys." Then wait for it.

Save the key only where the steps below say. Don't repeat it back; refer to it by its first 10 characters.

Models:

- `solcard-inference-large`: SolCard Inference Large. Most capable. Built on GLM-5.3.
- `solcard-inference-fast`: SolCard Inference Fast. Fastest. Built on DeepSeek V4.1 Flash.
- `solcard-inference-base`: SolCard Inference Base. Everyday tasks.
- `solcard-inference-large-legacy`: SolCard Inference Large (legacy). The previous Large. Built on GLM-5.2.

## If you are Claude Code

1. Read `~/.claude/settings.json` (`$CLAUDE_CONFIG_DIR/settings.json` if that variable is set); it may not exist yet.
2. With your file-editing tool, never a shell command (the key must not appear in a command), write it back with the following merged in: set the top-level `"model"` and `"modelPicker"`, and add these keys to `"env"`, replacing any with the same names. Keep every other setting and env entry as it is. Replace `<KEY>` with the key. Claude Code sends every request to one provider, so with SolCard as the provider the built-in Claude rows would fail: the picker lists SolCard's models instead, and every Claude tier maps to one of them.

```json
{
  "model": "solcard-inference-large",
  "modelPicker": {
    "replaceBuiltInOptions": true,
    "options": [
      {
        "model": "solcard-inference-large",
        "label": "SolCard Inference Large",
        "description": "Most capable. Built on GLM-5.3"
      },
      {
        "model": "solcard-inference-fast",
        "label": "SolCard Inference Fast",
        "description": "Fastest. Built on DeepSeek V4.1 Flash"
      },
      {
        "model": "solcard-inference-base",
        "label": "SolCard Inference Base",
        "description": "Everyday tasks"
      },
      {
        "model": "solcard-inference-large-legacy",
        "label": "SolCard Inference Large (legacy)",
        "description": "The previous Large. Built on GLM-5.2"
      }
    ]
  },
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.solcardinference.ai",
    "ANTHROPIC_AUTH_TOKEN": "<KEY>",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "solcard-inference-large",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "solcard-inference-large",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "solcard-inference-large",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "solcard-inference-fast",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "256000",
    "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1"
  }
}
```

3. Check the key works, reading it from the file you just wrote:

```sh
curl -s https://api.solcardinference.ai/v1/models -H "Authorization: Bearer $(sed -n 's/.*"ANTHROPIC_AUTH_TOKEN": *"\([^"]*\)".*/\1/p' ~/.claude/settings.json)"
```

A JSON list of models means it works. A `401` means the key is wrong: ask the user to check it.

4. Tell the user: "SolCard Inference is set up. Restart Claude Code (exit, then run `claude` again), and `/model` lists the SolCard Inference models." The change takes effect on the next start, so don't test it from this session.

To undo, the user can ask you to "remove SolCard Inference from my models": delete `"model"`, `"modelPicker"` and the env keys above.

## If you are Codex

1. Write the key, with nothing else on the line, to `~/.codex/solcard-inference.key` (`$CODEX_HOME/solcard-inference.key` if `CODEX_HOME` is set), and make it readable only by the user (`chmod 600`).
2. Open `~/.codex/config.toml` (under `$CODEX_HOME` if set; create it if it doesn't exist).
3. Set these two top-level keys, replacing `model` and `model_provider` if they're already set. Top-level keys must stay above the first `[table]` in the file, so put them at the very top:

```toml
model = "solcard-inference-large"
model_provider = "solcard-inference"
```

4. Add this provider at the end of the file (replace an existing `[model_providers.solcard-inference]` table). Use the absolute path of the key file from step 1 in `args`, for example `/Users/alex/.codex/solcard-inference.key`:

```toml
[model_providers.solcard-inference]
name = "SolCard Inference"
base_url = "https://api.solcardinference.ai/v1"
wire_api = "responses"
model_catalog_url = "https://api.solcardinference.ai/v1/models"

[model_providers.solcard-inference.auth]
command = "cat"
args = ["<HOME>/.codex/solcard-inference.key"]
```

On Windows, use `command = "powershell"` and `args = ["-NoProfile", "-Command", "Get-Content -Raw '<path>'"]` instead.

5. Keep everything else in the file as it is, and check it parses as TOML.
6. Check the key works, reading it from the key file:

```sh
curl -s https://api.solcardinference.ai/v1/models -H "Authorization: Bearer $(cat ~/.codex/solcard-inference.key)"
```

A JSON list of models means it works. A `401` means the key is wrong: ask the user to check it.

7. Tell the user: "SolCard Inference is set up. Quit Codex, run `codex app-server daemon restart`, and start Codex again (in the Codex app, quit and reopen it). The model picker lists the SolCard Inference models." Codex keeps its settings in a background server until it restarts, so don't restart it from this session.

To undo, the user can ask you to "remove SolCard Inference from my models": delete the two top-level keys, both `solcard-inference` tables and the key file.

Requests need credit: the user can top up at https://app.solcardinference.ai/top-up.
