oh-my-pi

oh-my-pi (omp) reads custom providers from models.yml. Use your Foglare API key (sk-fog-…) — inference requires it. Live catalog discovery works too, since Foglare serves GET /v1/models.

Prerequisites

  • oh-my-pi installed (omp on your PATH).
  • A Foglare API key (sk-fog-…) from the dashboard. Export it as FOGLARE_API_KEY; the config below reads that env var. Inference requires a key — anonymous calls are rejected.
  • Model ids from GET /v1/models, or use discovery below to import them all.

Configuration

Create or merge into ~/.omp/agent/models.yml. With explicit models the baseUrl includes /v1; omp appends /chat/completions.

~/.omp/agent/models.yml, explicit models

providers:
  foglare:
    baseUrl: https://api.foglare.com/v1
    api: openai-completions
    apiKey: FOGLARE_API_KEY
    models:
      - id: auto:fast
        name: Foglare Fast
        reasoning: false
        input: [text]
        contextWindow: 128000
        maxTokens: 16384
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
      - id: auto:M
        name: Foglare Medium
        reasoning: false
        input: [text]
        contextWindow: 128000
        maxTokens: 16384
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
      - id: auto:L
        name: Foglare Large
        reasoning: true
        input: [text]
        contextWindow: 128000
        maxTokens: 32768
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
      - id: auto:XL
        name: Foglare XL
        reasoning: true
        input: [text]
        contextWindow: 128000
        maxTokens: 32768
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }

Or let omp discover the full catalog from Foglare's model list. Discovery reads {baseUrl}/v1/models, so here the baseUrl is the root without /v1:

models.yml, live discovery

providers:
  foglare:
    baseUrl: https://api.foglare.com
    api: openai-completions
    apiKey: FOGLARE_API_KEY
    discovery:
      type: openai-models-list

Set the default model in ~/.omp/agent/config.yml, or pick foglare/auto:fast in the model picker:

~/.omp/agent/config.yml

modelRoles:
  default: foglare/auto:fast
Field Value Why
apiKeyFOGLARE_API_KEYEnv var name first, literal fallback: your sk-fog key. Required for inference.
apiopenai-completionsWire protocol.
baseUrlroot or /v1/v1 with explicit models; bare root with openai-models-list discovery, which injects /v1 itself.
contextWindow / maxTokenslocal budgetSample values, not per-model limits; adjust to the model you pin.

Config format verified against the oh-my-pi models documentation. A legacy models.json is migrated to YAML automatically if no models.yml exists.

Verify

Check the endpoint from your shell first: chunk lines ending in data: [DONE]. Then start omp and send a message on foglare/auto:fast.

curl the chat endpoint

curl -N https://api.foglare.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-fog-YOUR_KEY" \
  -d '{"model":"auto:fast","stream":true,"messages":[{"role":"user","content":"Hello"}]}'

Expected stream (trimmed)

data: {"id":"fglr_...","object":"chat.completion.chunk","model":"auto:fast","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"fglr_...","object":"chat.completion.chunk","model":"auto:fast","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop"}]}

data: [DONE]

List accepted model ids (trimmed response)

curl https://api.foglare.com/v1/models

{
  "object": "list",
  "data": [
    { "id": "deepseek-v4.1-flash", "object": "model", "created": 1763769600, "owned_by": "foglare" },
    { "id": "qwen4-max", "object": "model", "created": 1763769600, "owned_by": "foglare" },
    { "id": "auto:fast", "object": "model", "created": 1763769600, "owned_by": "foglare" }
  ]
}

Troubleshooting

Symptom Fix
404, model not found The model id is not in the catalog. List accepted ids with GET /v1/models. Tier ids are auto:fast, auto:S, auto:M, auto:L, auto:XL; direct ids carry no suffix.
404 on the endpoint path The base URL is wrong for this tool. Check whether it expects the root (https://api.foglare.com) or the versioned root (https://api.foglare.com/v1); the configuration table above says which.
503, capacity exhausted All upstream routes are busy or rate-limited. The error message says when to retry. Retry after that window, or switch to a routing tier so the gateway picks healthy capacity.
Output arrives all at once, or the stream hangs Something between you and the gateway is buffering SSE. Use curl -N, disable proxy buffering (nginx: proxy_buffering off), and read the response as a stream instead of waiting for the full body.
Foglare models missing from the picker Check the YAML indentation and that api is set. With apiKey: FOGLARE_API_KEY the env var must be set to your sk-fog key from the dashboard.
Discovery returns nothing or 404 For openai-models-list the baseUrl must be the bare root https://api.foglare.com; discovery appends /v1/models itself. A baseUrl already ending in /v1 doubles the path.
Wrong model answered Model references are provider/id, e.g. foglare/auto:fast. A bare auto:fast can fuzzy-match another provider; set modelRoles.default or use the full reference.