sference-cli 0.1.1__tar.gz → 0.1.2__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.4
2
2
  Name: sference-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
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
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Programming Language :: Python :: 3.13
22
22
  Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
- Requires-Dist: sference-sdk>=0.1.1
24
+ Requires-Dist: sference-sdk>=0.1.2
25
25
  Requires-Dist: typer>=0.24.1
26
26
  Description-Content-Type: text/markdown
27
27
 
@@ -33,7 +33,7 @@ Command-line interface for the sference batch API (`sference`). It uses the Pyth
33
33
 
34
34
  ```bash
35
35
  # One-line install (macOS / Linux)
36
- curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh | sh
36
+ eval "$(curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh)"
37
37
  ```
38
38
 
39
39
  Or install from PyPI:
@@ -122,35 +122,33 @@ sference responses tail --stream-id <stream_id>
122
122
  | `sference auth login` | Store an API key (optional `--api-key`, `--no-browser`) |
123
123
  | `sference auth me` | Show current user (`--json` for machine-readable output) |
124
124
 
125
- ### Launch (hidden from `sference --help`)
126
-
127
- These commands are intentionally omitted from the top-level CLI help; see this section for usage.
125
+ ### Launch
128
126
 
129
127
  | Command | Description |
130
128
  |---------|-------------|
131
129
  | `sference launch claude` | Launch Claude Code with Sference API routing (`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_MODEL`) |
132
130
  | `sference launch claude --dry-run` | Print env + command without starting Claude Code |
133
- | `sference launch claude --model moonshotai/Kimi-K2.6` | Override catalog model |
131
+ | `sference launch claude --model moonshotai/Kimi-K2.7-Code` | Override catalog model |
134
132
  | `sference launch claude --enable-tool-search` | Set `ENABLE_TOOL_SEARCH=true` on custom hosts |
135
133
  | `sference launch claude --resume` | Forward Claude Code flags/args after `sference launch claude` |
136
134
 
137
- Requires the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) on `PATH`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.6` (override with `--model` or `SFERENCE_MODEL`).
135
+ Requires the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) on `PATH`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.7-Code` (override with `--model` or `SFERENCE_MODEL`).
138
136
 
139
137
  | Command | Description |
140
138
  |---------|-------------|
141
139
  | `sference launch pi` | Launch Pi with Sference API routing (writes `~/.pi/agent/models.json`) |
142
140
  | `sference launch pi --dry-run` | Print provider config and command without launching Pi |
143
- | `sference launch pi --model moonshotai/Kimi-K2.6` | Override catalog model |
141
+ | `sference launch pi --model moonshotai/Kimi-K2.7-Code` | Override catalog model |
144
142
  | `sference launch pi -- /path/to/project` | Forward Pi args after `sference launch pi` |
145
143
 
146
- Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` with `baseUrl`, `apiKey`, and the chosen `model`, then execs `pi --provider sference --model <id>`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.6` (override with `--model` or `SFERENCE_MODEL`).
144
+ Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` with `baseUrl`, `apiKey`, and the chosen `model`, then execs `pi --provider sference --model <id>`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.7-Code` (override with `--model` or `SFERENCE_MODEL`).
147
145
 
148
146
  ### Batch
149
147
 
150
148
  | Command | Description |
151
149
  |---------|-------------|
152
150
  | `sference batch list` | List batches (table; `--json` for raw payload) |
153
- | `sference batch submit` | Submit a JSONL file (`--input-file`, optional `--model` for content-only lines, `--window` must be `24h`) |
151
+ | `sference batch submit` | Submit a JSONL file (`--input-file`, optional `--model` for content-only lines, `--window` `15m`/`1h`/`24h`) |
154
152
  | `sference batch stream` | Submit, wait, print **JSONL results on stdout** (see below) |
155
153
  | `sference batch status` | Get one batch (`--batch-id`, `--json`) |
156
154
  | `sference batch wait` | Poll until terminal state (`--batch-id`, `--poll-interval`, `--timeout`, `--json`) |
@@ -172,7 +170,7 @@ Long-lived **streams** are separate from **batches**: you create a stream, submi
172
170
 
173
171
  | Command | Description |
174
172
  |---------|-------------|
175
- | `sference stream create` | Create a stream (`--name`, `--window` `1h` or `24h`, `--json`) |
173
+ | `sference stream create` | Create a stream (`--name`, `--window` `15m`/`1h`/`24h`, `--json`) |
176
174
  | `sference stream list` | List streams (`--json`) |
177
175
  | `sference stream status` | Full detail + counters (`--stream-id`, `--json`) |
178
176
  | `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}` |
@@ -250,9 +248,19 @@ sference batch stream --input-file fixtures/example_batch.jsonl --poll-interval
250
248
 
251
249
  The SDK and CLI accept two line shapes (see also [`fixtures/example_batch.jsonl`](fixtures/example_batch.jsonl)):
252
250
 
253
- 1. **OpenAI-compatible:** each line has `custom_id`, `method`, `url`, and `body` (e.g. chat completions payload with per-line `model`). The CLI `--model` flag is ignored for these lines (a warning may be emitted by the SDK).
251
+ 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:
252
+ - **Chat completions:** `messages` (non-empty array), plus optional `temperature`, `max_tokens`, `tools`, …
253
+ - **Responses API:** `input` (string or message array), optional `instructions`, `max_output_tokens`, … — normalized to chat format at batch create.
254
254
  2. **Content-only:** each line is `{"content": "..."}`. Then **`--model` is required** on submit/stream.
255
255
 
256
+ 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.
257
+
258
+ Example Responses-shaped JSONL line:
259
+
260
+ ```json
261
+ {"custom_id":"r2","method":"POST","url":"/v1/responses","body":{"model":"Qwen/Qwen3.6-35B-A3B","input":[{"role":"user","content":"hi"}],"max_output_tokens":256}}
262
+ ```
263
+
256
264
  ---
257
265
 
258
266
  ## Python SDK
@@ -6,7 +6,7 @@ Command-line interface for the sference batch API (`sference`). It uses the Pyth
6
6
 
7
7
  ```bash
8
8
  # One-line install (macOS / Linux)
9
- curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh | sh
9
+ eval "$(curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh)"
10
10
  ```
11
11
 
12
12
  Or install from PyPI:
@@ -95,35 +95,33 @@ sference responses tail --stream-id <stream_id>
95
95
  | `sference auth login` | Store an API key (optional `--api-key`, `--no-browser`) |
96
96
  | `sference auth me` | Show current user (`--json` for machine-readable output) |
97
97
 
98
- ### Launch (hidden from `sference --help`)
99
-
100
- These commands are intentionally omitted from the top-level CLI help; see this section for usage.
98
+ ### Launch
101
99
 
102
100
  | Command | Description |
103
101
  |---------|-------------|
104
102
  | `sference launch claude` | Launch Claude Code with Sference API routing (`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_MODEL`) |
105
103
  | `sference launch claude --dry-run` | Print env + command without starting Claude Code |
106
- | `sference launch claude --model moonshotai/Kimi-K2.6` | Override catalog model |
104
+ | `sference launch claude --model moonshotai/Kimi-K2.7-Code` | Override catalog model |
107
105
  | `sference launch claude --enable-tool-search` | Set `ENABLE_TOOL_SEARCH=true` on custom hosts |
108
106
  | `sference launch claude --resume` | Forward Claude Code flags/args after `sference launch claude` |
109
107
 
110
- Requires the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) on `PATH`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.6` (override with `--model` or `SFERENCE_MODEL`).
108
+ Requires the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) on `PATH`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.7-Code` (override with `--model` or `SFERENCE_MODEL`).
111
109
 
112
110
  | Command | Description |
113
111
  |---------|-------------|
114
112
  | `sference launch pi` | Launch Pi with Sference API routing (writes `~/.pi/agent/models.json`) |
115
113
  | `sference launch pi --dry-run` | Print provider config and command without launching Pi |
116
- | `sference launch pi --model moonshotai/Kimi-K2.6` | Override catalog model |
114
+ | `sference launch pi --model moonshotai/Kimi-K2.7-Code` | Override catalog model |
117
115
  | `sference launch pi -- /path/to/project` | Forward Pi args after `sference launch pi` |
118
116
 
119
- Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` with `baseUrl`, `apiKey`, and the chosen `model`, then execs `pi --provider sference --model <id>`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.6` (override with `--model` or `SFERENCE_MODEL`).
117
+ Requires the [Pi CLI](https://pi.dev/docs) on `PATH`. Writes a `sference` provider block to `~/.pi/agent/models.json` with `baseUrl`, `apiKey`, and the chosen `model`, then execs `pi --provider sference --model <id>`. Uses `~/.sference/credentials.json` or `SFERENCE_API_KEY`. Default model: `moonshotai/Kimi-K2.7-Code` (override with `--model` or `SFERENCE_MODEL`).
120
118
 
121
119
  ### Batch
122
120
 
123
121
  | Command | Description |
124
122
  |---------|-------------|
125
123
  | `sference batch list` | List batches (table; `--json` for raw payload) |
126
- | `sference batch submit` | Submit a JSONL file (`--input-file`, optional `--model` for content-only lines, `--window` must be `24h`) |
124
+ | `sference batch submit` | Submit a JSONL file (`--input-file`, optional `--model` for content-only lines, `--window` `15m`/`1h`/`24h`) |
127
125
  | `sference batch stream` | Submit, wait, print **JSONL results on stdout** (see below) |
128
126
  | `sference batch status` | Get one batch (`--batch-id`, `--json`) |
129
127
  | `sference batch wait` | Poll until terminal state (`--batch-id`, `--poll-interval`, `--timeout`, `--json`) |
@@ -145,7 +143,7 @@ Long-lived **streams** are separate from **batches**: you create a stream, submi
145
143
 
146
144
  | Command | Description |
147
145
  |---------|-------------|
148
- | `sference stream create` | Create a stream (`--name`, `--window` `1h` or `24h`, `--json`) |
146
+ | `sference stream create` | Create a stream (`--name`, `--window` `15m`/`1h`/`24h`, `--json`) |
149
147
  | `sference stream list` | List streams (`--json`) |
150
148
  | `sference stream status` | Full detail + counters (`--stream-id`, `--json`) |
151
149
  | `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}` |
@@ -223,9 +221,19 @@ sference batch stream --input-file fixtures/example_batch.jsonl --poll-interval
223
221
 
224
222
  The SDK and CLI accept two line shapes (see also [`fixtures/example_batch.jsonl`](fixtures/example_batch.jsonl)):
225
223
 
226
- 1. **OpenAI-compatible:** each line has `custom_id`, `method`, `url`, and `body` (e.g. chat completions payload with per-line `model`). The CLI `--model` flag is ignored for these lines (a warning may be emitted by the SDK).
224
+ 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:
225
+ - **Chat completions:** `messages` (non-empty array), plus optional `temperature`, `max_tokens`, `tools`, …
226
+ - **Responses API:** `input` (string or message array), optional `instructions`, `max_output_tokens`, … — normalized to chat format at batch create.
227
227
  2. **Content-only:** each line is `{"content": "..."}`. Then **`--model` is required** on submit/stream.
228
228
 
229
+ 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.
230
+
231
+ Example Responses-shaped JSONL line:
232
+
233
+ ```json
234
+ {"custom_id":"r2","method":"POST","url":"/v1/responses","body":{"model":"Qwen/Qwen3.6-35B-A3B","input":[{"role":"user","content":"hi"}],"max_output_tokens":256}}
235
+ ```
236
+
229
237
  ---
230
238
 
231
239
  ## Python SDK
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sference-cli"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "sference command-line interface"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -23,7 +23,7 @@ classifiers = [
23
23
  ]
24
24
  dependencies = [
25
25
  "typer>=0.24.1",
26
- "sference-sdk>=0.1.1",
26
+ "sference-sdk>=0.1.2",
27
27
  ]
28
28
 
29
29
  [project.urls]
@@ -12,7 +12,7 @@ from typing import Optional
12
12
 
13
13
  import typer
14
14
 
15
- DEFAULT_LAUNCH_MODEL = "moonshotai/Kimi-K2.6"
15
+ DEFAULT_LAUNCH_MODEL = "moonshotai/Kimi-K2.7-Code"
16
16
  DEFAULT_API_BASE_URL = "https://api.sference.com"
17
17
 
18
18
 
@@ -301,5 +301,4 @@ def register_launch_commands(app: typer.Typer) -> None:
301
301
  dry_run=dry_run,
302
302
  )
303
303
 
304
- # Hidden from `sference --help`; documented for Claude Code / Pi setup only.
305
- app.add_typer(launch_app, name="launch", hidden=True)
304
+ app.add_typer(launch_app, name="launch")
@@ -13,7 +13,7 @@ from typing import Any, Optional, TypeVar
13
13
  import typer
14
14
 
15
15
  import sference_sdk
16
- from sference_sdk import ApiError, SferenceClient
16
+ from sference_sdk import COMPLETION_WINDOWS, ApiError, SferenceClient
17
17
 
18
18
  from sference_cli import __version__ as _CLI_VERSION
19
19
  from sference_sdk.checkpoint import clear_checkpoint, load_checkpoint, save_checkpoint
@@ -151,15 +151,10 @@ def _list_models(*, client: SferenceClient, as_json: bool) -> None:
151
151
  typer.echo(json.dumps(payload, indent=None if as_json else 2))
152
152
 
153
153
 
154
- def _mvp_batch_window_only(value: str) -> str:
155
- if value != "24h":
156
- raise typer.BadParameter('Only "24h" is supported in MVP.', param_hint="--window")
157
- return value
158
-
159
-
160
- def _stream_window_only(value: str) -> str:
161
- if value not in ("1h", "24h"):
162
- raise typer.BadParameter('Window must be "1h" or "24h".', param_hint="--window")
154
+ def _window_choice(value: str) -> str:
155
+ if value not in COMPLETION_WINDOWS:
156
+ allowed = ", ".join(f'"{w}"' for w in COMPLETION_WINDOWS)
157
+ raise typer.BadParameter(f"Window must be one of {allowed}.", param_hint="--window")
163
158
  return value
164
159
 
165
160
 
@@ -506,8 +501,8 @@ def batch_submit(
506
501
  window: str = typer.Option(
507
502
  "24h",
508
503
  "--window",
509
- help='Batch SLA window (MVP: only "24h").',
510
- callback=_mvp_batch_window_only,
504
+ help='Batch SLA window: "15m", "1h", or "24h".',
505
+ callback=_window_choice,
511
506
  ),
512
507
  base_url: str = typer.Option("https://api.sference.com"),
513
508
  as_json: bool = typer.Option(False, "--json"),
@@ -537,8 +532,8 @@ def batch_stream(
537
532
  window: str = typer.Option(
538
533
  "24h",
539
534
  "--window",
540
- help='Batch SLA window (MVP: only "24h").',
541
- callback=_mvp_batch_window_only,
535
+ help='Batch SLA window: "15m", "1h", or "24h".',
536
+ callback=_window_choice,
542
537
  ),
543
538
  poll_interval: float = typer.Option(2.0, "--poll-interval", help="Seconds between status polls while the batch is running."),
544
539
  no_cache: bool = typer.Option(
@@ -653,8 +648,8 @@ def stream_create(
653
648
  window: str = typer.Option(
654
649
  "24h",
655
650
  "--window",
656
- help='Per-item SLA window: "1h" or "24h" (recorded only in MVP).',
657
- callback=_stream_window_only,
651
+ help='Per-item SLA window: "15m", "1h", or "24h" (default for items in this stream).',
652
+ callback=_window_choice,
658
653
  ),
659
654
  base_url: str = typer.Option("https://api.sference.com"),
660
655
  as_json: bool = typer.Option(False, "--json"),
File without changes
File without changes