Skip to content

Commit 126cb92

Browse files
HavenDVclaude
andcommitted
feat(cli): multifile skill bundle + auto-regeneration from spec
Replace the single hand-written SKILL.md with a three-file bundle auto-generated from openapi.yaml by `autosdk skill`: SKILL.md — concise groups-only overview (3.6 KB) commands.md — full per-command reference (41 KB, 241 ops) auth.md — credential setup + detected schemes The .CLI project now packs all `.md` files under `.claude/skills/` into `claude-skill/` inside the nupkg, and the `skill` subcommand accepts a file name argument: dnx tryAGI.OpenAI.CLI skill # SKILL.md dnx tryAGI.OpenAI.CLI skill commands # commands.md dnx tryAGI.OpenAI.CLI skill auth # auth.md dnx tryAGI.OpenAI.CLI skill list `generate.sh` now calls `autosdk skill` after the SDK generation so every spec refresh keeps the manifest in sync, and switches `dotnet tool install` to `update||install` so the skill subcommand (shipped in autosdk.cli@next) is picked up automatically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6d34eb9 commit 126cb92

6 files changed

Lines changed: 634 additions & 73 deletions

File tree

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,88 @@
11
---
22
name: tryagi-openai
3-
description: Call the OpenAI API from the command line. Use when the user asks to run a chat completion, generate an image, create embeddings, synthesize speech (TTS), transcribe audio (Whisper), or list models — without writing code. Zero-install — runs via `dnx tryAGI.OpenAI.CLI`. Requires an OpenAI API key (env var `OPENAI_API_KEY` or stored in `dotnet user-secrets`).
3+
description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. Invoke any endpoint via `dnx tryAGI.OpenAI.CLI <group> <command>`. Requires an API key in `$OPENAI_API_KEY`.
44
---
55

6-
# tryAGI.OpenAI CLI
6+
# OpenAI API CLI
77

8-
A command-line interface to every core OpenAI endpoint, distributed as a `dotnet tool` (.NET 10). Run without install using `dnx`.
8+
The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
99

10-
## Installation (zero-install)
11-
12-
Prerequisite: .NET 10 SDK. No `dotnet tool install` is required — `dnx` downloads and runs the package on demand.
10+
## Quickstart
1311

1412
```bash
15-
dnx tryAGI.OpenAI.CLI --help
16-
```
13+
# one-time: save your API key
14+
dnx tryAGI.OpenAI.CLI auth set <your-key>
1715

18-
To pin a version:
19-
```bash
20-
dnx tryAGI.OpenAI.CLI@<version> --help
21-
```
16+
# run a command
17+
dnx tryAGI.OpenAI.CLI <group> <command> [options]
2218

23-
## Credentials
19+
# explore
20+
dnx tryAGI.OpenAI.CLI --help
21+
dnx tryAGI.OpenAI.CLI <group> --help
22+
```
2423

25-
Three resolution paths, checked in order:
26-
1. `--api-key <key>` command-line flag.
27-
2. `OPENAI_API_KEY` environment variable.
28-
3. `dotnet user-secrets` with id `tryAGI.OpenAI.CLI` (manageable via the built-in `auth` subcommand).
24+
## Command groups
25+
26+
| Group | Operations | Summary |
27+
|-------|-----------:|---------|
28+
| `assistant` | 18 | Build Assistants that can call models and use tools. |
29+
| `audio` | 9 | Turn audio into text or text into audio. |
30+
| `audit-log` | 1 | List user actions and configuration changes within this organization. |
31+
| `batch` | 4 | Create large batches of API requests to run asynchronously. |
32+
| `certificate` | 10 | |
33+
| `chat` | 6 | Given a list of messages comprising a conversation, the model will return a response. |
34+
| `completion` | 1 | Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. |
35+
| `conversation` | 8 | Manage conversations and conversation items. |
36+
| `embedding` | 1 | Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. |
37+
| `eval` | 12 | Manage and run evals in the OpenAI platform. |
38+
| `file` | 5 | Files are used to upload documents that can be used with features like Assistants and Fine-tuning. |
39+
| `fine-tuning` | 13 | Manage fine-tuning jobs to tailor a model to your specific training data. |
40+
| `group` | 4 | |
41+
| `group-organization-role-assignment` | 3 | |
42+
| `group-user` | 3 | |
43+
| `image` | 3 | Given a prompt and/or an input image, the model will generate a new image. |
44+
| `invite` | 4 | |
45+
| `model` | 3 | List and describe the various models available in the API. |
46+
| `moderation` | 1 | Given text and/or image inputs, classifies if those inputs are potentially harmful. |
47+
| `project` | 19 | |
48+
| `project-group` | 3 | |
49+
| `project-group-role-assignment` | 3 | |
50+
| `project-user-role-assignment` | 3 | |
51+
| `realtime` | 8 | |
52+
| `response` | 5 | |
53+
| `role` | 8 | |
54+
| `skill` | 11 | |
55+
| `upload` | 4 | Use Uploads to upload large files in multiple parts. |
56+
| `usage` | 9 | |
57+
| `user` | 4 | |
58+
| `user-organization-role-assignment` | 3 | |
59+
| `vector-store` | 16 | |
60+
| `video` | 10 | |
61+
| `default` | 21 | |
62+
63+
## References
64+
65+
- [commands.md](./commands.md) — full per-command reference (name, description, HTTP route).
66+
- [auth.md](./auth.md) — auth schemes detected in the spec + credential setup.
67+
68+
The bundled CLI also prints any of these on demand:
2969

30-
Store a key once, reuse forever:
3170
```bash
32-
dnx tryAGI.OpenAI.CLI auth set sk-...
33-
dnx tryAGI.OpenAI.CLI auth show
34-
dnx tryAGI.OpenAI.CLI auth clear
71+
dnx tryAGI.OpenAI.CLI skill # SKILL.md
72+
dnx tryAGI.OpenAI.CLI skill commands # commands.md
73+
dnx tryAGI.OpenAI.CLI skill auth # auth.md
74+
dnx tryAGI.OpenAI.CLI skill list # list bundled skill files
3575
```
3676

37-
## Commands
38-
39-
| Group | Example |
40-
|-------|---------|
41-
| `chat complete` | `dnx tryAGI.OpenAI.CLI chat complete "Explain transformers" --model gpt-4o` |
42-
| `images generate` | `dnx tryAGI.OpenAI.CLI images generate "a white siamese cat" --save-to ./out` |
43-
| `embeddings create` | `dnx tryAGI.OpenAI.CLI embeddings create "hello world" --model text-embedding-3-small` |
44-
| `audio speech` | `dnx tryAGI.OpenAI.CLI audio speech "Hello there" --voice alloy --save-to greeting.mp3` |
45-
| `audio transcribe` | `dnx tryAGI.OpenAI.CLI audio transcribe recording.mp3 --model whisper-1` |
46-
| `models list` | `dnx tryAGI.OpenAI.CLI models list` |
47-
| `auth set\|show\|clear` | See Credentials section above. |
48-
| `skill` | `dnx tryAGI.OpenAI.CLI skill` — print this manifest. |
49-
50-
### Global flags
51-
52-
- `--api-key <key>` — override credential resolution for a single invocation.
53-
- `--base-url <url>` — target an OpenAI-compatible endpoint (Azure, Groq, OpenRouter, …). Falls back to `$OPENAI_BASE_URL`.
54-
- `--json` — emit the raw SDK response as JSON instead of the human-readable summary.
55-
- `--output <path>` — write the output to a file instead of stdout.
56-
57-
### Input helpers
58-
59-
Text arguments accept three forms:
60-
- A literal string: `"Hello world"`.
61-
- `-` → read from stdin.
62-
- A file path → read file contents.
63-
6477
## For agents
6578

66-
When the user asks to perform an OpenAI operation:
79+
When the user asks to perform an operation against this API:
6780
1. Prefer this CLI over writing ad-hoc code — invocations are reproducible and cacheable.
68-
2. Before the first call, verify credentials with `dnx tryAGI.OpenAI.CLI auth show`. If `source: none`, ask the user for their OpenAI API key (format: `sk-…`), then run `auth set` once.
69-
3. Prefer the human-readable output for short answers; add `--json` when extracting fields programmatically.
81+
2. Before the first call, verify credentials with `dnx tryAGI.OpenAI.CLI auth show`. If `source: none`, ask the user for their key.
82+
3. Use `--json` to get structured output for downstream parsing.
83+
4. For unfamiliar groups/commands, run `--help` on the group rather than guessing.
7084

7185
## Links
7286

73-
- Source: https://github.com/tryAGI/OpenAI
74-
- Underlying SDK: https://www.nuget.org/packages/tryAGI.OpenAI
75-
- CLI package: https://www.nuget.org/packages/tryAGI.OpenAI.CLI
87+
- Home: https://github.com/tryAGI/OpenAI
88+
- Package: https://www.nuget.org/packages/tryAGI.OpenAI.CLI
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# OpenAI API — authentication
2+
3+
Credentials for `tryAGI.OpenAI.CLI` are resolved in this order:
4+
5+
1. `--api-key <key>` command-line flag.
6+
2. `OPENAI_API_KEY` environment variable.
7+
3. `dotnet user-secrets` stored under id `tryAGI.OpenAI.CLI`.
8+
9+
## One-time setup
10+
11+
```bash
12+
dnx tryAGI.OpenAI.CLI auth set <your-key>
13+
dnx tryAGI.OpenAI.CLI auth show
14+
```
15+
16+
## Detected auth schemes
17+
18+
- HTTP `bearer`
19+
20+
## For agents
21+
22+
If the user hasn't configured credentials:
23+
24+
1. Run `dnx tryAGI.OpenAI.CLI auth show`. If it reports `source: none`, ask the user for their key (format and source depend on the provider — see their docs).
25+
2. Run `dnx tryAGI.OpenAI.CLI auth set <key>` to persist it.
26+
3. Confirm with `auth show` again before retrying the failed command.

0 commit comments

Comments
 (0)