sference-cli 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sference-cli
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: sference command-line interface
5
5
  Project-URL: Homepage, https://sference.com
6
6
  Project-URL: Repository, https://github.com/s-ference/sference
@@ -27,7 +27,9 @@ Description-Content-Type: text/markdown
27
27
 
28
28
  # sference CLI
29
29
 
30
- Command-line interface for the sference batch API (`sference`). It uses the Python SDK (`sference-sdk`) and is published on PyPI as `sference-cli`.
30
+ Command-line interface for the sference API (`sference`): batches, streams, responses, decisions, and launchers that point coding agents (Claude Code, Codex, opencode, Pi, Cursor) at sference. It uses the Python SDK (`sference-sdk`) and is published on PyPI as `sference-cli`.
31
+
32
+ **Default model:** `deepseek-ai/DeepSeek-V4.1-Flash-1017` (DeepSeek V4.1 Flash). Every command that takes `--model` falls back to `SFERENCE_MODEL`, then to this default. Run `sference models` for the live catalog.
31
33
 
32
34
  ## Installation
33
35
 
@@ -67,9 +69,9 @@ sference --help
67
69
 
68
70
  1. **Interactive (browser):** `sference auth login` signs in with the OAuth 2.0 device flow (RFC 8628). The CLI opens the console approval page and shows a short code; confirm it matches, approve the device, and the CLI finishes on its own. No API key is involved. Pass `--no-browser` on a remote or headless machine to print the URL and code instead.
69
71
  2. **Non-interactive / CI:** `sference auth login --api-key 'sk_...'` saves an API key from **Console → API keys** without opening a browser.
70
- 3. **Environment variable:** `SFERENCE_API_KEY` overrides the saved credential file.
72
+ 3. **Environment variable:** `SFERENCE_API_KEY` is used when this device is **not** signed in with the device flow. A device login wins over the variable (the CLI says so once); if the device grant is revoked, the CLI falls back to `SFERENCE_API_KEY`.
71
73
 
72
- Credentials are stored in `~/.sference/credentials.json` unless `SFERENCE_API_KEY` is set. A device login stores a 24 h access token and a 30 d rotating refresh token; the CLI refreshes the access token automatically when you run a command, and `sference launch claude` also refreshes it mid-session through its proxy. Codex, opencode, and Pi sessions run on the token issued at launch. Signed-in devices are listed, and can be revoked, under **Profile → Signed-in devices** in the console.
74
+ Credentials are stored in `~/.sference/credentials.json` (owner-only permissions). A device login stores a 24 h access token and a 30 d rotating refresh token; the CLI refreshes the access token automatically when you run a command, and `sference launch claude` refreshes it at launch so a session starts on a fresh 24 h token. Launched tools (Claude Code, Codex, opencode, Pi) run on the token issued at launch. Signed-in devices are listed, and can be revoked, under **Profile → Signed-in devices** in the console.
73
75
 
74
76
  For local development, `--base-url` (or `SFERENCE_BASE_URL`) points the device flow at another API and `--console-url` (or `SFERENCE_CONSOLE_URL`) overrides the approval page the browser opens.
75
77
 
@@ -80,20 +82,35 @@ sference auth me
80
82
  sference auth me --json
81
83
  ```
82
84
 
83
- ## Quick examples (batches and streams)
85
+ ## Quick examples
86
+
87
+ `--model` is optional everywhere below; it defaults to `deepseek-ai/DeepSeek-V4.1-Flash-1017`.
88
+
89
+ **Models**
90
+
91
+ ```bash
92
+ sference models # table: id, context, capabilities, alias/retirement notes
93
+ sference models --json # raw GET /v1/models
94
+ ```
84
95
 
85
- Use a `model` string supported by your sference deployment.
96
+ **Responses**
97
+
98
+ ```bash
99
+ sference responses create --content "Summarize RFC 8628 in one line"
100
+ sference responses create --content "Long task" --background # returns immediately
101
+ sference responses result --id <response_id>
102
+ ```
86
103
 
87
104
  **Batches**
88
105
 
89
106
  ```bash
90
- sference batch submit --input-file ./workload.jsonl --model Qwen/Qwen3.6-35B-A3B --window 24h
107
+ sference batch submit --input-file ./workload.jsonl --window 24h
91
108
  sference batch status --batch-id <batch_id>
92
109
  sference batch wait --batch-id <batch_id>
93
110
  sference batch results --batch-id <batch_id>
94
111
  sference batch download-results --batch-id <batch_id> --out ./out.jsonl
95
112
  # Submit, wait, print JSONL results on stdout (stderr: progress; resumable cache)
96
- sference batch stream --input-file ./workload.jsonl --model Qwen/Qwen3.6-35B-A3B --window 24h
113
+ sference batch stream --input-file ./workload.jsonl --window 24h
97
114
  ```
98
115
 
99
116
  **Streams**
@@ -101,7 +118,7 @@ sference batch stream --input-file ./workload.jsonl --model Qwen/Qwen3.6-35B-A3B
101
118
  ```bash
102
119
  sference stream create --name "my-stream" --window 24h
103
120
  sference stream list
104
- sference stream submit --stream-id <stream_id> --input-file ./lines.jsonl --model Qwen/Qwen3.6-35B-A3B
121
+ sference stream submit --stream-id <stream_id> --input-file ./lines.jsonl
105
122
  sference stream status --stream-id <stream_id>
106
123
  sference responses tail --stream-id <stream_id>
107
124
  ```
@@ -110,9 +127,10 @@ sference responses tail --stream-id <stream_id>
110
127
 
111
128
  | Variable | Purpose |
112
129
  |----------|---------|
113
- | `SFERENCE_API_KEY` | API key (or access token); overrides `~/.sference/credentials.json` |
130
+ | `SFERENCE_API_KEY` | API key (or access token); used when the device is not signed in via `sference auth login` |
131
+ | `SFERENCE_BASE_URL` | API base URL for every command (default `https://api.sference.com`; same as `--base-url`) |
114
132
  | `SFERENCE_CONSOLE_URL` | Console URL the device-flow approval page opens on (default: server-provided) |
115
- | `SFERENCE_MODEL` | Default catalog model for `sference launch` (overrides built-in default) |
133
+ | `SFERENCE_MODEL` | Default model for every command and launcher (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
116
134
  | `SFERENCE_STREAM_CACHE` | Optional path to the stream resumable-cache file (default `~/.sference/stream_cache.json`) |
117
135
  | `SFERENCE_STREAM_CHECKPOINTS` | Optional path for **`responses tail`** event checkpoints (default `~/.sference/stream_checkpoints.json`) |
118
136
 
@@ -135,12 +153,14 @@ sference responses tail --stream-id <stream_id>
135
153
  | --- | --- |
136
154
  | `sference launch claude` | Launch Claude Code against Sference; catalog primed into `/model` |
137
155
  | `sference launch claude --dry-run` | Print the env config + command without launching |
138
- | `sference launch claude --model zai-org/GLM-5.2` | Pin a different default model |
156
+ | `sference launch claude --model zai-org/GLM-5.3` | Pin a different model (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
139
157
  | `sference launch claude --models a,b` | Override the primed picker set (default: live `GET /v1/models`) |
140
158
  | `sference launch claude --enable-tool-search` | Set `ENABLE_TOOL_SEARCH=true` |
141
- | `sference launch claude -- --model zai-org/GLM-5.2 -p "hi"` | Forward Claude Code flags/args after `--` |
159
+ | `sference launch claude -- -p "hi"` | Forward Claude Code flags/args after `--` |
142
160
 
143
- Requires only the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code). Device-flow credentials are refreshed at launch so long sessions start on a fresh 24 h token. `--no-anthropic` and `--proxy-port` are accepted as deprecated no-ops for older scripts.
161
+ Requires only the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code). Every Claude Code model alias (opus/sonnet/haiku/fable, sub-agents) is pinned to the chosen model so no request goes out with a `claude-*` id. The default model accepts Claude Code's thinking-disabled request shape; the GLM-5.3 family does not (it always reasons), so pick it only for clients that send thinking. Device-flow credentials are refreshed at launch so long sessions start on a fresh 24 h token. `--no-anthropic` and `--proxy-port` are still accepted (hidden) as no-ops for older scripts.
162
+
163
+ All launchers fill their model picker from the live `GET /v1/models` catalog (text-generation models only); aliases past their `retires_on` date are left out, since the API asks callers to migrate to the `alias_of` target.
144
164
 
145
165
  #### `sference launch pi`
146
166
 
@@ -148,10 +168,10 @@ Requires only the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-co
148
168
  |---------|-------------|
149
169
  | `sference launch pi` | Launch Pi with Sference API routing (writes `~/.pi/agent/models.json`) |
150
170
  | `sference launch pi --dry-run` | Print provider config and command without launching Pi |
151
- | `sference launch pi --model moonshotai/Kimi-K2.7-Code` | Override catalog model |
171
+ | `sference launch pi --model zai-org/GLM-5.3` | Override catalog model |
152
172
  | `sference launch pi -- /path/to/project` | Forward Pi args after `sference launch pi` |
153
173
 
154
- Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` using pi's `openai-responses` API (the Sference `/v1/responses` endpoint) with `baseUrl`, `apiKey`, and the full list of Sference-provided models (fetched live from `GET /v1/models`), then execs `pi --provider sference --model <id> --models sference/**`. The `--models sference/**` flag scopes pi's `/model` picker (and Ctrl+P cycling) to Sference models only, so other configured providers are hidden by default (`**` is required because Sference model ids contain a slash and `*` would match nothing). All catalog models appear in the picker; `--model` selects the active one. Reasoning is driven by pi's native `reasoning.effort` (no per-model thinking-format config needed). If the catalog fetch fails (offline), only the chosen model is registered. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.7-Code` (override with `--model` or `SFERENCE_MODEL`).
174
+ Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` using pi's `openai-responses` API (the Sference `/v1/responses` endpoint) with `baseUrl`, `apiKey`, and the full list of Sference-provided models (fetched live from `GET /v1/models`), then execs `pi --provider sference --model <id> --models sference/**`. The `--models sference/**` flag scopes pi's `/model` picker (and Ctrl+P cycling) to Sference models only, so other configured providers are hidden by default (`**` is required because Sference model ids contain a slash and `*` would match nothing). All catalog models appear in the picker; `--model` selects the active one. Reasoning is driven by pi's native `reasoning.effort` (no per-model thinking-format config needed). If the catalog fetch fails (offline), only the chosen model is registered. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `deepseek-ai/DeepSeek-V4.1-Flash-1017` (override with `--model` or `SFERENCE_MODEL`).
155
175
 
156
176
  #### `sference launch codex`
157
177
 
@@ -159,7 +179,7 @@ Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provid
159
179
  |---------|-------------|
160
180
  | `sference launch codex` | Launch the [Codex CLI](https://developers.openai.com/codex/cli) against Sference's `/v1/responses` |
161
181
  | `sference launch codex --dry-run` | Print provider config and command without launching Codex |
162
- | `sference launch codex --model moonshotai/Kimi-K3` | Override catalog model |
182
+ | `sference launch codex --model zai-org/GLM-5.3` | Override catalog model (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
163
183
  | `sference launch codex -- exec "fix the bug"` | Forward Codex args (here: non-interactive `codex exec`) |
164
184
  | `sference launch codex -- -c model_reasoning_effort=high` | Override the reasoning effort (default `medium`) |
165
185
 
@@ -167,15 +187,34 @@ Requires `codex` on `PATH`. The `sference` model provider is passed as `codex -c
167
187
 
168
188
  **Sub-agents and MCP servers** work: the Sference provider applies to the whole session, so agents Codex spawns run on Sference too. The launcher also writes `~/.sference/codex/models.json`, a Codex model catalog listing only the Sference models, and passes it as `model_catalog_json`. Without it Codex offers `spawn_agent` its own OpenAI models, and a sub-agent started on one of them fails. Each entry is built at launch from the catalog bundled with your Codex (`codex debug models --bundled`), so it always matches your Codex version; if that command is unavailable the launcher warns and starts without the catalog. An `agents.default_subagent_model` in your Codex config still pins sub-agents to an OpenAI model, which Sference cannot serve (the launcher warns about it).
169
189
 
190
+ #### `sference launch cursor`
191
+
192
+ | Command | Description |
193
+ |---------|-------------|
194
+ | `sference launch cursor` | Turn Sference routing on for Cursor |
195
+ | `sference launch cursor --dry-run` | Print what would change without writing anything |
196
+ | `sference launch cursor --model zai-org/GLM-5.3` | Override the default model for new chats (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
197
+ | `sference launch cursor --sference-only` | Disable all Cursor-provided models, leaving only Sference models |
198
+ | `sference launch cursor --api-key sk_...` | Store this API key in Cursor (default: your credential, or a newly created one) |
199
+ | `sference launch cursor status` | Show whether Cursor chats on Sference right now |
200
+ | `sference launch cursor off` | Restore Cursor's settings from before `launch cursor` |
201
+ | `sference launch cursor off --revoke-key` | Also revoke the API key that was created for Cursor |
202
+
203
+ Configures [Cursor](https://cursor.com) to run its chat on Sference through Cursor's own-API-key (BYOK) mode: the launcher writes the Sference base URL (`/v1`), your key, and the live model catalog into Cursor's settings database, and sets the default model for new chats (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`). Cursor's own models stay available side by side unless `--sference-only` is passed. Requires a **signed-in paid Cursor plan** (Pro/Business/Enterprise) — BYOK is not available on the free plan.
204
+
205
+ Key handling: with an `sk_...` credential (or `--api-key`) that key is stored directly; with a device login the launcher creates a dedicated API key (tagged `sference-cli-cursor`, visible in Console → API Keys) so the 24 h device token never lands in another app. If Cursor already has an OpenAI key saved, the launcher refuses unless `--replace-existing-key` is passed (the old key cannot be restored; on macOS you will be asked to confirm the Keychain change).
206
+
207
+ Safety: quit Cursor first — it rewrites its settings from memory on exit and would discard the change (the launcher refuses while Cursor is running; `--force` overrides, and you must then fully restart Cursor). Everything is written in one transaction, the prior settings are backed up to `~/.sference/cursor/backup.json`, and `off` restores them. **Scope:** this covers Cursor chat and the model picker — Tab completions, chat titles, Agent Review (Bugbot), and cloud agents keep running on Cursor's own models, same as any BYOK setup.
208
+
170
209
  ### Batch
171
210
 
172
211
  | Command | Description |
173
212
  |---------|-------------|
174
213
  | `sference batch list` | List batches (table; `--json` for raw payload) |
175
- | `sference batch submit` | Submit a JSONL file (`--input-file`, optional `--model` for content-only lines, `--window` `24h`) |
214
+ | `sference batch submit` | Submit a JSONL file (`--input-file`; `--model` applies to content-only lines and defaults to `SFERENCE_MODEL` / DeepSeek V4.1 Flash; `--window` `24h`) |
176
215
  | `sference batch stream` | Submit, wait, print **JSONL results on stdout** (see below) |
177
216
  | `sference batch status` | Get one batch (`--batch-id`, `--json`) |
178
- | `sference batch wait` | Poll until terminal state (`--batch-id`, `--poll-interval`, `--timeout`, `--json`) |
217
+ | `sference batch wait` | Poll until terminal state (`--batch-id`, `--poll-interval`, `--timeout` (default 30 s), `--json`) |
179
218
  | `sference batch results` | JSON results payload (`--batch-id`, `--json`) |
180
219
  | `sference batch cancel` | Cancel a batch (`--batch-id`, `--json`) |
181
220
  | `sference batch download-results` | Download results JSONL to a file (`--batch-id`, `--out`, `--format jsonl`) |
@@ -184,9 +223,9 @@ Requires `codex` on `PATH`. The `sference` model provider is passed as `codex -c
184
223
 
185
224
  | Command | Description |
186
225
  |---------|-------------|
187
- | `sference responses create` | Create one response (`--model`, `--content`; `--background` submits async and returns immediately). The sync default blocks; if the server-side wait times out, the request is **cancelled** and the command fails — use `--background` + `sference responses result` for long requests |
188
- | `sference responses result` | Poll until terminal state (`--id`, `--poll-ms`) |
189
- | `sference responses tail` | Print completion events as JSONL via `GET /v1/responses/events` (optional `--stream-id` to scope to a stream; omit for non-stream completions). Flags: `--consumer`, `--from-latest`, `--no-checkpoint`, `--poll-ms` |
226
+ | `sference responses create` | Create one response (`--content`; optional `--model`, `--instructions`, `--max-output-tokens`, `--enable-thinking/--disable-thinking`; `--background` submits async and returns immediately). The sync default blocks; if the server-side wait times out, the request is **cancelled** and the command fails — use `--background` + `sference responses result` for long requests |
227
+ | `sference responses result` | Poll until terminal state (`--id`, `--poll-interval` seconds) |
228
+ | `sference responses tail` | Print completion events as JSONL via `GET /v1/responses/events` (optional `--stream-id` to scope to a stream; omit for non-stream completions). Flags: `--consumer`, `--from-latest`, `--no-checkpoint`, `--poll-interval` |
190
229
 
191
230
  ### Decisions (`/v1/decisions`)
192
231
 
@@ -210,20 +249,20 @@ Long-lived **streams** are separate from **batches**: you create a stream, submi
210
249
  | `sference stream create` | Create a stream (`--name`, `--window` `24h`, `--json`) |
211
250
  | `sference stream list` | List streams (`--json`) |
212
251
  | `sference stream status` | Full detail + counters (`--stream-id`, `--json`) |
213
- | `sference stream submit` | Create responses from JSONL via `POST /v1/responses` per line (`metadata.stream_id` set automatically; `--stream-id`, `--input-file`, `--model` required for content-only lines) — per line: OpenAI batch-style `{custom_id?, method, url, body}` or content-only `{content}` |
252
+ | `sference stream submit` | Queue one **background** response per JSONL line via `POST /v1/responses` (`metadata.stream_id` and `completion_window: "24h"` set automatically; `--stream-id`, `--input-file`, optional `--model` for lines without one). The whole file is validated before anything is sent |
214
253
  | `sference stream cancel` | Stop accepting new items and stop enqueueing pending work; does not auto-cancel in-flight requests (`--stream-id`, `--json`) |
215
254
  | `sference stream archive` | Finalize the stream (optional after cancel); no new items (`--stream-id`, `--json`) |
216
255
 
217
- Example JSONL lines for `stream submit` (both accepted):
218
-
219
- ```json
220
- {"custom_id":"req-1","method":"POST","url":"/v1/chat/completions","body":{"model":"Qwen/Qwen3.6-35B-A3B","messages":[{"role":"user","content":"hi"}]}}
221
- ```
256
+ Accepted JSONL lines for `stream submit`:
222
257
 
223
258
  ```json
224
259
  {"content":"hi"}
260
+ {"input":[{"role":"user","content":"hi"}],"instructions":"Be brief.","max_output_tokens":256}
261
+ {"custom_id":"req-1","method":"POST","url":"/v1/chat/completions","body":{"model":"zai-org/GLM-5.3","messages":[{"role":"user","content":"hi"}],"max_tokens":256}}
225
262
  ```
226
263
 
264
+ Chat-shaped bodies are mapped onto the Responses API (`messages` → `input`, `max_tokens` → `max_output_tokens`); `custom_id` lands in `metadata.custom_id`. Forwarded fields: `model`, `input`, `instructions`, `max_output_tokens`, `temperature`, `top_p`, `include_reasoning`, `enable_thinking`, `metadata`; any other field is rejected rather than silently dropped.
265
+
227
266
  ---
228
267
 
229
268
  ## Streaming batches (`batch stream`)
@@ -241,10 +280,10 @@ Example:
241
280
  sference batch stream --input-file workload.jsonl > results.jsonl
242
281
  ```
243
282
 
244
- Content-only JSONL (model supplied globally):
283
+ Content-only JSONL (model supplied globally; omit `--model` for the default):
245
284
 
246
285
  ```bash
247
- sference batch stream --input-file prompts.jsonl --model Qwen/Qwen3.6-35B-A3B > results.jsonl
286
+ sference batch stream --input-file prompts.jsonl --model zai-org/GLM-5.3 > results.jsonl
248
287
  ```
249
288
 
250
289
  ### Resumable cache
@@ -253,7 +292,7 @@ Batches can take a long time. If you **interrupt** the command (e.g. Ctrl+C) and
253
292
 
254
293
  - Cache file: **`~/.sference/stream_cache.json`** (override with **`SFERENCE_STREAM_CACHE`**).
255
294
  - Key: **SHA-256** of the raw input file bytes (same bytes ⇒ same key, regardless of path).
256
- - Stored fields: `batch_id`, `created_at`.
295
+ - Stored fields: `batch_id`, `base_url`, `created_at` (an entry is only reused against the same API base URL).
257
296
  - After results are written to stdout, the entry for that input is **removed** so the cache does not grow forever.
258
297
  - If the cached batch no longer exists on the server (404), the cache entry is dropped and a **new** batch is submitted.
259
298
 
@@ -288,14 +327,14 @@ The SDK and CLI accept two line shapes (see also [`fixtures/example_batch.jsonl`
288
327
  1. **OpenAI-compatible envelope:** each line has `custom_id`, `method`, `url`, and `body`. The API receives only `custom_id` + inner `body` (`method`/`url` are ignored). Inner `body` may use:
289
328
  - **Chat completions:** `messages` (non-empty array), plus optional `temperature`, `max_tokens`, `tools`, …
290
329
  - **Responses API:** `input` (string or message array), optional `instructions`, `max_output_tokens`, … — normalized to chat format at batch create.
291
- 2. **Content-only:** each line is `{"content": "..."}`. Then **`--model` is required** on submit/stream.
330
+ 2. **Content-only:** each line is `{"content": "..."}`. The model comes from `--model`, else `SFERENCE_MODEL`, else `deepseek-ai/DeepSeek-V4.1-Flash-1017`.
292
331
 
293
332
  Invalid row bodies return **HTTP 400** at create with `requests[i]` and `custom_id` in the error message (nothing is enqueued). Do not set `background: true` inside batch row bodies.
294
333
 
295
334
  Example Responses-shaped JSONL line:
296
335
 
297
336
  ```json
298
- {"custom_id":"r2","method":"POST","url":"/v1/responses","body":{"model":"Qwen/Qwen3.6-35B-A3B","input":[{"role":"user","content":"hi"}],"max_output_tokens":256}}
337
+ {"custom_id":"r2","method":"POST","url":"/v1/responses","body":{"model":"deepseek-ai/DeepSeek-V4.1-Flash-1017","input":[{"role":"user","content":"hi"}],"max_output_tokens":256}}
299
338
  ```
300
339
 
301
340
  ---
@@ -1,6 +1,8 @@
1
1
  # sference CLI
2
2
 
3
- Command-line interface for the sference batch API (`sference`). It uses the Python SDK (`sference-sdk`) and is published on PyPI as `sference-cli`.
3
+ Command-line interface for the sference API (`sference`): batches, streams, responses, decisions, and launchers that point coding agents (Claude Code, Codex, opencode, Pi, Cursor) at sference. It uses the Python SDK (`sference-sdk`) and is published on PyPI as `sference-cli`.
4
+
5
+ **Default model:** `deepseek-ai/DeepSeek-V4.1-Flash-1017` (DeepSeek V4.1 Flash). Every command that takes `--model` falls back to `SFERENCE_MODEL`, then to this default. Run `sference models` for the live catalog.
4
6
 
5
7
  ## Installation
6
8
 
@@ -40,9 +42,9 @@ sference --help
40
42
 
41
43
  1. **Interactive (browser):** `sference auth login` signs in with the OAuth 2.0 device flow (RFC 8628). The CLI opens the console approval page and shows a short code; confirm it matches, approve the device, and the CLI finishes on its own. No API key is involved. Pass `--no-browser` on a remote or headless machine to print the URL and code instead.
42
44
  2. **Non-interactive / CI:** `sference auth login --api-key 'sk_...'` saves an API key from **Console → API keys** without opening a browser.
43
- 3. **Environment variable:** `SFERENCE_API_KEY` overrides the saved credential file.
45
+ 3. **Environment variable:** `SFERENCE_API_KEY` is used when this device is **not** signed in with the device flow. A device login wins over the variable (the CLI says so once); if the device grant is revoked, the CLI falls back to `SFERENCE_API_KEY`.
44
46
 
45
- Credentials are stored in `~/.sference/credentials.json` unless `SFERENCE_API_KEY` is set. A device login stores a 24 h access token and a 30 d rotating refresh token; the CLI refreshes the access token automatically when you run a command, and `sference launch claude` also refreshes it mid-session through its proxy. Codex, opencode, and Pi sessions run on the token issued at launch. Signed-in devices are listed, and can be revoked, under **Profile → Signed-in devices** in the console.
47
+ Credentials are stored in `~/.sference/credentials.json` (owner-only permissions). A device login stores a 24 h access token and a 30 d rotating refresh token; the CLI refreshes the access token automatically when you run a command, and `sference launch claude` refreshes it at launch so a session starts on a fresh 24 h token. Launched tools (Claude Code, Codex, opencode, Pi) run on the token issued at launch. Signed-in devices are listed, and can be revoked, under **Profile → Signed-in devices** in the console.
46
48
 
47
49
  For local development, `--base-url` (or `SFERENCE_BASE_URL`) points the device flow at another API and `--console-url` (or `SFERENCE_CONSOLE_URL`) overrides the approval page the browser opens.
48
50
 
@@ -53,20 +55,35 @@ sference auth me
53
55
  sference auth me --json
54
56
  ```
55
57
 
56
- ## Quick examples (batches and streams)
58
+ ## Quick examples
59
+
60
+ `--model` is optional everywhere below; it defaults to `deepseek-ai/DeepSeek-V4.1-Flash-1017`.
61
+
62
+ **Models**
63
+
64
+ ```bash
65
+ sference models # table: id, context, capabilities, alias/retirement notes
66
+ sference models --json # raw GET /v1/models
67
+ ```
57
68
 
58
- Use a `model` string supported by your sference deployment.
69
+ **Responses**
70
+
71
+ ```bash
72
+ sference responses create --content "Summarize RFC 8628 in one line"
73
+ sference responses create --content "Long task" --background # returns immediately
74
+ sference responses result --id <response_id>
75
+ ```
59
76
 
60
77
  **Batches**
61
78
 
62
79
  ```bash
63
- sference batch submit --input-file ./workload.jsonl --model Qwen/Qwen3.6-35B-A3B --window 24h
80
+ sference batch submit --input-file ./workload.jsonl --window 24h
64
81
  sference batch status --batch-id <batch_id>
65
82
  sference batch wait --batch-id <batch_id>
66
83
  sference batch results --batch-id <batch_id>
67
84
  sference batch download-results --batch-id <batch_id> --out ./out.jsonl
68
85
  # Submit, wait, print JSONL results on stdout (stderr: progress; resumable cache)
69
- sference batch stream --input-file ./workload.jsonl --model Qwen/Qwen3.6-35B-A3B --window 24h
86
+ sference batch stream --input-file ./workload.jsonl --window 24h
70
87
  ```
71
88
 
72
89
  **Streams**
@@ -74,7 +91,7 @@ sference batch stream --input-file ./workload.jsonl --model Qwen/Qwen3.6-35B-A3B
74
91
  ```bash
75
92
  sference stream create --name "my-stream" --window 24h
76
93
  sference stream list
77
- sference stream submit --stream-id <stream_id> --input-file ./lines.jsonl --model Qwen/Qwen3.6-35B-A3B
94
+ sference stream submit --stream-id <stream_id> --input-file ./lines.jsonl
78
95
  sference stream status --stream-id <stream_id>
79
96
  sference responses tail --stream-id <stream_id>
80
97
  ```
@@ -83,9 +100,10 @@ sference responses tail --stream-id <stream_id>
83
100
 
84
101
  | Variable | Purpose |
85
102
  |----------|---------|
86
- | `SFERENCE_API_KEY` | API key (or access token); overrides `~/.sference/credentials.json` |
103
+ | `SFERENCE_API_KEY` | API key (or access token); used when the device is not signed in via `sference auth login` |
104
+ | `SFERENCE_BASE_URL` | API base URL for every command (default `https://api.sference.com`; same as `--base-url`) |
87
105
  | `SFERENCE_CONSOLE_URL` | Console URL the device-flow approval page opens on (default: server-provided) |
88
- | `SFERENCE_MODEL` | Default catalog model for `sference launch` (overrides built-in default) |
106
+ | `SFERENCE_MODEL` | Default model for every command and launcher (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
89
107
  | `SFERENCE_STREAM_CACHE` | Optional path to the stream resumable-cache file (default `~/.sference/stream_cache.json`) |
90
108
  | `SFERENCE_STREAM_CHECKPOINTS` | Optional path for **`responses tail`** event checkpoints (default `~/.sference/stream_checkpoints.json`) |
91
109
 
@@ -108,12 +126,14 @@ sference responses tail --stream-id <stream_id>
108
126
  | --- | --- |
109
127
  | `sference launch claude` | Launch Claude Code against Sference; catalog primed into `/model` |
110
128
  | `sference launch claude --dry-run` | Print the env config + command without launching |
111
- | `sference launch claude --model zai-org/GLM-5.2` | Pin a different default model |
129
+ | `sference launch claude --model zai-org/GLM-5.3` | Pin a different model (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
112
130
  | `sference launch claude --models a,b` | Override the primed picker set (default: live `GET /v1/models`) |
113
131
  | `sference launch claude --enable-tool-search` | Set `ENABLE_TOOL_SEARCH=true` |
114
- | `sference launch claude -- --model zai-org/GLM-5.2 -p "hi"` | Forward Claude Code flags/args after `--` |
132
+ | `sference launch claude -- -p "hi"` | Forward Claude Code flags/args after `--` |
115
133
 
116
- Requires only the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code). Device-flow credentials are refreshed at launch so long sessions start on a fresh 24 h token. `--no-anthropic` and `--proxy-port` are accepted as deprecated no-ops for older scripts.
134
+ Requires only the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code). Every Claude Code model alias (opus/sonnet/haiku/fable, sub-agents) is pinned to the chosen model so no request goes out with a `claude-*` id. The default model accepts Claude Code's thinking-disabled request shape; the GLM-5.3 family does not (it always reasons), so pick it only for clients that send thinking. Device-flow credentials are refreshed at launch so long sessions start on a fresh 24 h token. `--no-anthropic` and `--proxy-port` are still accepted (hidden) as no-ops for older scripts.
135
+
136
+ All launchers fill their model picker from the live `GET /v1/models` catalog (text-generation models only); aliases past their `retires_on` date are left out, since the API asks callers to migrate to the `alias_of` target.
117
137
 
118
138
  #### `sference launch pi`
119
139
 
@@ -121,10 +141,10 @@ Requires only the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-co
121
141
  |---------|-------------|
122
142
  | `sference launch pi` | Launch Pi with Sference API routing (writes `~/.pi/agent/models.json`) |
123
143
  | `sference launch pi --dry-run` | Print provider config and command without launching Pi |
124
- | `sference launch pi --model moonshotai/Kimi-K2.7-Code` | Override catalog model |
144
+ | `sference launch pi --model zai-org/GLM-5.3` | Override catalog model |
125
145
  | `sference launch pi -- /path/to/project` | Forward Pi args after `sference launch pi` |
126
146
 
127
- Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` using pi's `openai-responses` API (the Sference `/v1/responses` endpoint) with `baseUrl`, `apiKey`, and the full list of Sference-provided models (fetched live from `GET /v1/models`), then execs `pi --provider sference --model <id> --models sference/**`. The `--models sference/**` flag scopes pi's `/model` picker (and Ctrl+P cycling) to Sference models only, so other configured providers are hidden by default (`**` is required because Sference model ids contain a slash and `*` would match nothing). All catalog models appear in the picker; `--model` selects the active one. Reasoning is driven by pi's native `reasoning.effort` (no per-model thinking-format config needed). If the catalog fetch fails (offline), only the chosen model is registered. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.7-Code` (override with `--model` or `SFERENCE_MODEL`).
147
+ Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` using pi's `openai-responses` API (the Sference `/v1/responses` endpoint) with `baseUrl`, `apiKey`, and the full list of Sference-provided models (fetched live from `GET /v1/models`), then execs `pi --provider sference --model <id> --models sference/**`. The `--models sference/**` flag scopes pi's `/model` picker (and Ctrl+P cycling) to Sference models only, so other configured providers are hidden by default (`**` is required because Sference model ids contain a slash and `*` would match nothing). All catalog models appear in the picker; `--model` selects the active one. Reasoning is driven by pi's native `reasoning.effort` (no per-model thinking-format config needed). If the catalog fetch fails (offline), only the chosen model is registered. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `deepseek-ai/DeepSeek-V4.1-Flash-1017` (override with `--model` or `SFERENCE_MODEL`).
128
148
 
129
149
  #### `sference launch codex`
130
150
 
@@ -132,7 +152,7 @@ Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provid
132
152
  |---------|-------------|
133
153
  | `sference launch codex` | Launch the [Codex CLI](https://developers.openai.com/codex/cli) against Sference's `/v1/responses` |
134
154
  | `sference launch codex --dry-run` | Print provider config and command without launching Codex |
135
- | `sference launch codex --model moonshotai/Kimi-K3` | Override catalog model |
155
+ | `sference launch codex --model zai-org/GLM-5.3` | Override catalog model (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
136
156
  | `sference launch codex -- exec "fix the bug"` | Forward Codex args (here: non-interactive `codex exec`) |
137
157
  | `sference launch codex -- -c model_reasoning_effort=high` | Override the reasoning effort (default `medium`) |
138
158
 
@@ -140,15 +160,34 @@ Requires `codex` on `PATH`. The `sference` model provider is passed as `codex -c
140
160
 
141
161
  **Sub-agents and MCP servers** work: the Sference provider applies to the whole session, so agents Codex spawns run on Sference too. The launcher also writes `~/.sference/codex/models.json`, a Codex model catalog listing only the Sference models, and passes it as `model_catalog_json`. Without it Codex offers `spawn_agent` its own OpenAI models, and a sub-agent started on one of them fails. Each entry is built at launch from the catalog bundled with your Codex (`codex debug models --bundled`), so it always matches your Codex version; if that command is unavailable the launcher warns and starts without the catalog. An `agents.default_subagent_model` in your Codex config still pins sub-agents to an OpenAI model, which Sference cannot serve (the launcher warns about it).
142
162
 
163
+ #### `sference launch cursor`
164
+
165
+ | Command | Description |
166
+ |---------|-------------|
167
+ | `sference launch cursor` | Turn Sference routing on for Cursor |
168
+ | `sference launch cursor --dry-run` | Print what would change without writing anything |
169
+ | `sference launch cursor --model zai-org/GLM-5.3` | Override the default model for new chats (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`) |
170
+ | `sference launch cursor --sference-only` | Disable all Cursor-provided models, leaving only Sference models |
171
+ | `sference launch cursor --api-key sk_...` | Store this API key in Cursor (default: your credential, or a newly created one) |
172
+ | `sference launch cursor status` | Show whether Cursor chats on Sference right now |
173
+ | `sference launch cursor off` | Restore Cursor's settings from before `launch cursor` |
174
+ | `sference launch cursor off --revoke-key` | Also revoke the API key that was created for Cursor |
175
+
176
+ Configures [Cursor](https://cursor.com) to run its chat on Sference through Cursor's own-API-key (BYOK) mode: the launcher writes the Sference base URL (`/v1`), your key, and the live model catalog into Cursor's settings database, and sets the default model for new chats (default `deepseek-ai/DeepSeek-V4.1-Flash-1017`). Cursor's own models stay available side by side unless `--sference-only` is passed. Requires a **signed-in paid Cursor plan** (Pro/Business/Enterprise) — BYOK is not available on the free plan.
177
+
178
+ Key handling: with an `sk_...` credential (or `--api-key`) that key is stored directly; with a device login the launcher creates a dedicated API key (tagged `sference-cli-cursor`, visible in Console → API Keys) so the 24 h device token never lands in another app. If Cursor already has an OpenAI key saved, the launcher refuses unless `--replace-existing-key` is passed (the old key cannot be restored; on macOS you will be asked to confirm the Keychain change).
179
+
180
+ Safety: quit Cursor first — it rewrites its settings from memory on exit and would discard the change (the launcher refuses while Cursor is running; `--force` overrides, and you must then fully restart Cursor). Everything is written in one transaction, the prior settings are backed up to `~/.sference/cursor/backup.json`, and `off` restores them. **Scope:** this covers Cursor chat and the model picker — Tab completions, chat titles, Agent Review (Bugbot), and cloud agents keep running on Cursor's own models, same as any BYOK setup.
181
+
143
182
  ### Batch
144
183
 
145
184
  | Command | Description |
146
185
  |---------|-------------|
147
186
  | `sference batch list` | List batches (table; `--json` for raw payload) |
148
- | `sference batch submit` | Submit a JSONL file (`--input-file`, optional `--model` for content-only lines, `--window` `24h`) |
187
+ | `sference batch submit` | Submit a JSONL file (`--input-file`; `--model` applies to content-only lines and defaults to `SFERENCE_MODEL` / DeepSeek V4.1 Flash; `--window` `24h`) |
149
188
  | `sference batch stream` | Submit, wait, print **JSONL results on stdout** (see below) |
150
189
  | `sference batch status` | Get one batch (`--batch-id`, `--json`) |
151
- | `sference batch wait` | Poll until terminal state (`--batch-id`, `--poll-interval`, `--timeout`, `--json`) |
190
+ | `sference batch wait` | Poll until terminal state (`--batch-id`, `--poll-interval`, `--timeout` (default 30 s), `--json`) |
152
191
  | `sference batch results` | JSON results payload (`--batch-id`, `--json`) |
153
192
  | `sference batch cancel` | Cancel a batch (`--batch-id`, `--json`) |
154
193
  | `sference batch download-results` | Download results JSONL to a file (`--batch-id`, `--out`, `--format jsonl`) |
@@ -157,9 +196,9 @@ Requires `codex` on `PATH`. The `sference` model provider is passed as `codex -c
157
196
 
158
197
  | Command | Description |
159
198
  |---------|-------------|
160
- | `sference responses create` | Create one response (`--model`, `--content`; `--background` submits async and returns immediately). The sync default blocks; if the server-side wait times out, the request is **cancelled** and the command fails — use `--background` + `sference responses result` for long requests |
161
- | `sference responses result` | Poll until terminal state (`--id`, `--poll-ms`) |
162
- | `sference responses tail` | Print completion events as JSONL via `GET /v1/responses/events` (optional `--stream-id` to scope to a stream; omit for non-stream completions). Flags: `--consumer`, `--from-latest`, `--no-checkpoint`, `--poll-ms` |
199
+ | `sference responses create` | Create one response (`--content`; optional `--model`, `--instructions`, `--max-output-tokens`, `--enable-thinking/--disable-thinking`; `--background` submits async and returns immediately). The sync default blocks; if the server-side wait times out, the request is **cancelled** and the command fails — use `--background` + `sference responses result` for long requests |
200
+ | `sference responses result` | Poll until terminal state (`--id`, `--poll-interval` seconds) |
201
+ | `sference responses tail` | Print completion events as JSONL via `GET /v1/responses/events` (optional `--stream-id` to scope to a stream; omit for non-stream completions). Flags: `--consumer`, `--from-latest`, `--no-checkpoint`, `--poll-interval` |
163
202
 
164
203
  ### Decisions (`/v1/decisions`)
165
204
 
@@ -183,20 +222,20 @@ Long-lived **streams** are separate from **batches**: you create a stream, submi
183
222
  | `sference stream create` | Create a stream (`--name`, `--window` `24h`, `--json`) |
184
223
  | `sference stream list` | List streams (`--json`) |
185
224
  | `sference stream status` | Full detail + counters (`--stream-id`, `--json`) |
186
- | `sference stream submit` | Create responses from JSONL via `POST /v1/responses` per line (`metadata.stream_id` set automatically; `--stream-id`, `--input-file`, `--model` required for content-only lines) — per line: OpenAI batch-style `{custom_id?, method, url, body}` or content-only `{content}` |
225
+ | `sference stream submit` | Queue one **background** response per JSONL line via `POST /v1/responses` (`metadata.stream_id` and `completion_window: "24h"` set automatically; `--stream-id`, `--input-file`, optional `--model` for lines without one). The whole file is validated before anything is sent |
187
226
  | `sference stream cancel` | Stop accepting new items and stop enqueueing pending work; does not auto-cancel in-flight requests (`--stream-id`, `--json`) |
188
227
  | `sference stream archive` | Finalize the stream (optional after cancel); no new items (`--stream-id`, `--json`) |
189
228
 
190
- Example JSONL lines for `stream submit` (both accepted):
191
-
192
- ```json
193
- {"custom_id":"req-1","method":"POST","url":"/v1/chat/completions","body":{"model":"Qwen/Qwen3.6-35B-A3B","messages":[{"role":"user","content":"hi"}]}}
194
- ```
229
+ Accepted JSONL lines for `stream submit`:
195
230
 
196
231
  ```json
197
232
  {"content":"hi"}
233
+ {"input":[{"role":"user","content":"hi"}],"instructions":"Be brief.","max_output_tokens":256}
234
+ {"custom_id":"req-1","method":"POST","url":"/v1/chat/completions","body":{"model":"zai-org/GLM-5.3","messages":[{"role":"user","content":"hi"}],"max_tokens":256}}
198
235
  ```
199
236
 
237
+ Chat-shaped bodies are mapped onto the Responses API (`messages` → `input`, `max_tokens` → `max_output_tokens`); `custom_id` lands in `metadata.custom_id`. Forwarded fields: `model`, `input`, `instructions`, `max_output_tokens`, `temperature`, `top_p`, `include_reasoning`, `enable_thinking`, `metadata`; any other field is rejected rather than silently dropped.
238
+
200
239
  ---
201
240
 
202
241
  ## Streaming batches (`batch stream`)
@@ -214,10 +253,10 @@ Example:
214
253
  sference batch stream --input-file workload.jsonl > results.jsonl
215
254
  ```
216
255
 
217
- Content-only JSONL (model supplied globally):
256
+ Content-only JSONL (model supplied globally; omit `--model` for the default):
218
257
 
219
258
  ```bash
220
- sference batch stream --input-file prompts.jsonl --model Qwen/Qwen3.6-35B-A3B > results.jsonl
259
+ sference batch stream --input-file prompts.jsonl --model zai-org/GLM-5.3 > results.jsonl
221
260
  ```
222
261
 
223
262
  ### Resumable cache
@@ -226,7 +265,7 @@ Batches can take a long time. If you **interrupt** the command (e.g. Ctrl+C) and
226
265
 
227
266
  - Cache file: **`~/.sference/stream_cache.json`** (override with **`SFERENCE_STREAM_CACHE`**).
228
267
  - Key: **SHA-256** of the raw input file bytes (same bytes ⇒ same key, regardless of path).
229
- - Stored fields: `batch_id`, `created_at`.
268
+ - Stored fields: `batch_id`, `base_url`, `created_at` (an entry is only reused against the same API base URL).
230
269
  - After results are written to stdout, the entry for that input is **removed** so the cache does not grow forever.
231
270
  - If the cached batch no longer exists on the server (404), the cache entry is dropped and a **new** batch is submitted.
232
271
 
@@ -261,14 +300,14 @@ The SDK and CLI accept two line shapes (see also [`fixtures/example_batch.jsonl`
261
300
  1. **OpenAI-compatible envelope:** each line has `custom_id`, `method`, `url`, and `body`. The API receives only `custom_id` + inner `body` (`method`/`url` are ignored). Inner `body` may use:
262
301
  - **Chat completions:** `messages` (non-empty array), plus optional `temperature`, `max_tokens`, `tools`, …
263
302
  - **Responses API:** `input` (string or message array), optional `instructions`, `max_output_tokens`, … — normalized to chat format at batch create.
264
- 2. **Content-only:** each line is `{"content": "..."}`. Then **`--model` is required** on submit/stream.
303
+ 2. **Content-only:** each line is `{"content": "..."}`. The model comes from `--model`, else `SFERENCE_MODEL`, else `deepseek-ai/DeepSeek-V4.1-Flash-1017`.
265
304
 
266
305
  Invalid row bodies return **HTTP 400** at create with `requests[i]` and `custom_id` in the error message (nothing is enqueued). Do not set `background: true` inside batch row bodies.
267
306
 
268
307
  Example Responses-shaped JSONL line:
269
308
 
270
309
  ```json
271
- {"custom_id":"r2","method":"POST","url":"/v1/responses","body":{"model":"Qwen/Qwen3.6-35B-A3B","input":[{"role":"user","content":"hi"}],"max_output_tokens":256}}
310
+ {"custom_id":"r2","method":"POST","url":"/v1/responses","body":{"model":"deepseek-ai/DeepSeek-V4.1-Flash-1017","input":[{"role":"user","content":"hi"}],"max_output_tokens":256}}
272
311
  ```
273
312
 
274
313
  ---
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sference-cli"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "sference command-line interface"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -23,6 +23,7 @@ import os
23
23
  import tempfile
24
24
  import time
25
25
  import urllib.request
26
+ from datetime import date
26
27
  from pathlib import Path
27
28
  from typing import Any
28
29
 
@@ -36,9 +37,32 @@ AUTO_COMPACT_WINDOW_ENV_KEY = "CLAUDE_CODE_AUTO_COMPACT_WINDOW"
36
37
  DEFAULT_AUTO_COMPACT_WINDOW = "950000"
37
38
 
38
39
 
40
+ def is_retired(item: dict[str, Any], today: date | None = None) -> bool:
41
+ """Whether ``retires_on`` has passed.
42
+
43
+ A retired alias still serves requests (via ``alias_of``), but the API asks
44
+ callers to migrate, so pickers should not offer it.
45
+ """
46
+ raw = item.get("retires_on")
47
+ if not isinstance(raw, str):
48
+ return False
49
+ try:
50
+ return date.fromisoformat(raw) <= (today or date.today())
51
+ except ValueError:
52
+ return False
53
+
54
+
39
55
  def fetch_sference_model_entries(base_url: str, api_key: str) -> list[dict[str, Any]]:
40
- """Pull the live text-generation model entries from GET {base_url}/v1/models."""
41
- api_root = base_url.rstrip("/") + "/v1"
56
+ """Pull the live, non-retired text-generation entries from GET {base_url}/v1/models.
57
+
58
+ ``base_url`` may be the API origin (``launch claude``) or already end in
59
+ ``/v1`` (the OpenAI-compatible base the other launchers pass); both resolve
60
+ to the same ``/v1/models``.
61
+ """
62
+ origin = base_url.rstrip("/")
63
+ if origin.endswith("/v1"):
64
+ origin = origin[: -len("/v1")]
65
+ api_root = origin + "/v1"
42
66
  req = urllib.request.Request(
43
67
  f"{api_root}/models",
44
68
  headers={"Authorization": f"Bearer {api_key}"},
@@ -48,7 +72,10 @@ def fetch_sference_model_entries(base_url: str, api_key: str) -> list[dict[str,
48
72
  return [
49
73
  item
50
74
  for item in payload.get("data", [])
51
- if isinstance(item, dict) and item.get("id") and item.get("modality", "text_generation") == "text_generation"
75
+ if isinstance(item, dict)
76
+ and item.get("id")
77
+ and item.get("modality", "text_generation") == "text_generation"
78
+ and not is_retired(item)
52
79
  ]
53
80
 
54
81