Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.provider-openrouter

OpenRouter static-API-key provider (https://openrouter.ai/api/v1).

OpenRouter is a multi-provider gateway speaking the OpenAI chat wire, so no :api-style override is needed - svar's default OpenAI transport handles it. Model names are vendor/model slugs (anthropic/claude-sonnet-4.5, openai/gpt-5.1, ...).

Auth lifecycle:

  1. vis providers auth openrouter persists the key once under ~/.vis/openrouter-auth.json as canonical snake_case JSON (api_key / saved_at) - every JSON this repo writes uses snake_case string keys.
  2. Later runs resolve the key from config (~/.vis/config.edn, written by the TUI), then OPENROUTER_API_KEY, then the auth file. Config wins so status/limits report the key that model calls actually use; the env var beats the file so CI stays home-directory-free.
  3. vis providers status openrouter shows the source without exposing the key.
  4. vis providers logout openrouter deletes the persisted key.

Limits come from OpenRouter's GET /api/v1/key, which reports the credits consumed by the key and, for capped keys, the credit limit.

OpenRouter static-API-key provider (https://openrouter.ai/api/v1).

OpenRouter is a multi-provider gateway speaking the OpenAI chat wire,
so no `:api-style` override is needed - svar's default OpenAI
transport handles it. Model names are `vendor/model` slugs
(`anthropic/claude-sonnet-4.5`, `openai/gpt-5.1`, ...).

Auth lifecycle:
  1. `vis providers auth openrouter` persists the key once under
     `~/.vis/openrouter-auth.json` as canonical snake_case JSON
     (`api_key` / `saved_at`) - every JSON this repo writes uses
     snake_case string keys.
  2. Later runs resolve the key from config (`~/.vis/config.edn`,
     written by the TUI), then `OPENROUTER_API_KEY`, then the auth
     file. Config wins so status/limits report the key that model
     calls actually use; the env var beats the file so CI stays
     home-directory-free.
  3. `vis providers status openrouter` shows the source without
     exposing the key.
  4. `vis providers logout openrouter` deletes the persisted key.

Limits come from OpenRouter's `GET /api/v1/key`, which reports the
credits consumed by the key and, for capped keys, the credit limit.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close