sference-cli 0.0.6__tar.gz → 0.0.7__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,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sference-cli
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: sference command-line interface
5
5
  Requires-Python: >=3.12
6
- Requires-Dist: sference-sdk>=0.0.6
6
+ Requires-Dist: sference-sdk>=0.0.7
7
7
  Requires-Dist: typer>=0.24.1
8
8
  Description-Content-Type: text/markdown
9
9
 
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "sference-cli"
3
- version = "0.0.6"
3
+ version = "0.0.7"
4
4
  description = "sference command-line interface"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
7
  dependencies = [
8
8
  "typer>=0.24.1",
9
- "sference-sdk>=0.0.6",
9
+ "sference-sdk>=0.0.7",
10
10
  ]
11
11
 
12
12
  [project.scripts]
@@ -30,10 +30,12 @@ auth_app = typer.Typer(help="Auth commands", invoke_without_command=True)
30
30
  batch_app = typer.Typer(help="Batch commands", invoke_without_command=True)
31
31
  stream_app = typer.Typer(help="Stream commands", invoke_without_command=True)
32
32
  responses_app = typer.Typer(help="Responses commands", invoke_without_command=True)
33
+ models_app = typer.Typer(help="List models (GET /v1/models)", invoke_without_command=True)
33
34
  app.add_typer(auth_app, name="auth")
34
35
  app.add_typer(batch_app, name="batch")
35
36
  app.add_typer(stream_app, name="stream")
36
37
  app.add_typer(responses_app, name="responses")
38
+ app.add_typer(models_app, name="models")
37
39
 
38
40
  CREDENTIALS_PATH = Path.home() / ".sference" / "credentials.json"
39
41
 
@@ -135,6 +137,11 @@ def _print(value: object, as_json: bool) -> None:
135
137
  typer.echo(value)
136
138
 
137
139
 
140
+ def _list_models(*, client: SferenceClient, as_json: bool) -> None:
141
+ payload = _call_api(client.list_models)
142
+ typer.echo(json.dumps(payload, indent=None if as_json else 2))
143
+
144
+
138
145
  def _wait_for_response(
139
146
  client: SferenceClient, response_id: str, *, poll_ms: int, timeout_s: int
140
147
  ) -> Any:
@@ -219,6 +226,31 @@ def _responses_root(ctx: typer.Context) -> None:
219
226
  raise typer.Exit(code=0)
220
227
 
221
228
 
229
+ @models_app.callback()
230
+ def _models_root(
231
+ ctx: typer.Context,
232
+ as_json: bool = typer.Option(False, "--json", help="Print GET /v1/models JSON."),
233
+ base_url: str = typer.Option("https://api.sference.com"),
234
+ ) -> None:
235
+ """List models (OpenAI-compatible GET /v1/models)."""
236
+ if ctx.invoked_subcommand is not None:
237
+ return
238
+ _ensure_api_credential()
239
+ client = _client(base_url)
240
+ _list_models(client=client, as_json=as_json)
241
+
242
+
243
+ @models_app.command("list")
244
+ def models_list(
245
+ as_json: bool = typer.Option(False, "--json", help="Print GET /v1/models JSON."),
246
+ base_url: str = typer.Option("https://api.sference.com"),
247
+ ) -> None:
248
+ """List models (OpenAI-compatible GET /v1/models)."""
249
+ _ensure_api_credential()
250
+ client = _client(base_url)
251
+ _list_models(client=client, as_json=as_json)
252
+
253
+
222
254
  @auth_app.command("login")
223
255
  def auth_login(
224
256
  api_key: Optional[str] = typer.Option(
File without changes
File without changes