@myapihq/cli 1.1.0-wip.4 → 1.2.0

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.
Files changed (127) hide show
  1. package/dist/commands/{email.d.ts → audience.d.ts} +2 -0
  2. package/dist/commands/audience.js +245 -0
  3. package/dist/commands/auth.d.ts +5 -2
  4. package/dist/commands/auth.js +133 -5
  5. package/dist/commands/billing.d.ts +2 -0
  6. package/dist/commands/billing.js +18 -1
  7. package/dist/commands/company.d.ts +6 -0
  8. package/dist/commands/company.js +149 -0
  9. package/dist/commands/config.d.ts +2 -0
  10. package/dist/commands/config.js +20 -0
  11. package/dist/commands/crm/companies.d.ts +6 -0
  12. package/dist/commands/crm/companies.js +193 -0
  13. package/dist/commands/crm/contacts.d.ts +6 -0
  14. package/dist/commands/crm/contacts.js +241 -0
  15. package/dist/commands/crm/index.d.ts +6 -0
  16. package/dist/commands/crm/index.js +74 -0
  17. package/dist/commands/database.d.ts +6 -0
  18. package/dist/commands/database.js +259 -0
  19. package/dist/commands/domain.d.ts +3 -0
  20. package/dist/commands/domain.js +67 -1
  21. package/dist/commands/email/campaign.d.ts +2 -0
  22. package/dist/commands/email/campaign.js +34 -1
  23. package/dist/commands/email/index.d.ts +2 -0
  24. package/dist/commands/email/index.js +9 -0
  25. package/dist/commands/email/mailbox.d.ts +2 -0
  26. package/dist/commands/email/mailbox.js +5 -0
  27. package/dist/commands/email/message.d.ts +2 -0
  28. package/dist/commands/email/message.js +8 -0
  29. package/dist/commands/email/template.d.ts +2 -0
  30. package/dist/commands/email/template.js +54 -0
  31. package/dist/commands/email/verify.d.ts +7 -0
  32. package/dist/commands/email/verify.js +52 -0
  33. package/dist/commands/email/warmup.d.ts +2 -0
  34. package/dist/commands/email/warmup.js +7 -0
  35. package/dist/commands/funnel.d.ts +3 -0
  36. package/dist/commands/funnel.js +31 -0
  37. package/dist/commands/image.d.ts +2 -0
  38. package/dist/commands/image.js +43 -9
  39. package/dist/commands/keys.d.ts +2 -0
  40. package/dist/commands/keys.js +5 -0
  41. package/dist/commands/llm.d.ts +6 -0
  42. package/dist/commands/llm.js +156 -0
  43. package/dist/commands/org.d.ts +3 -0
  44. package/dist/commands/org.js +55 -0
  45. package/dist/commands/people.d.ts +6 -0
  46. package/dist/commands/people.js +136 -0
  47. package/dist/commands/pixel.d.ts +11 -3
  48. package/dist/commands/pixel.js +93 -0
  49. package/dist/commands/setup.d.ts +2 -0
  50. package/dist/commands/setup.js +57 -5
  51. package/dist/commands/status.d.ts +7 -0
  52. package/dist/commands/status.js +154 -0
  53. package/dist/commands/storage.d.ts +2 -0
  54. package/dist/commands/storage.js +14 -2
  55. package/dist/commands/update.d.ts +2 -0
  56. package/dist/commands/update.js +3 -0
  57. package/dist/commands/url.d.ts +7 -2
  58. package/dist/commands/url.js +6 -0
  59. package/dist/commands/verify.d.ts +7 -0
  60. package/dist/commands/verify.js +56 -0
  61. package/dist/commands/webhook.d.ts +2 -0
  62. package/dist/commands/webhook.js +31 -6
  63. package/dist/commands/workflow.d.ts +2 -0
  64. package/dist/commands/workflow.js +19 -1
  65. package/dist/completion.d.ts +3 -0
  66. package/dist/completion.js +78 -0
  67. package/dist/config.d.ts +2 -0
  68. package/dist/exposes.d.ts +2 -0
  69. package/dist/exposes.js +13 -0
  70. package/dist/exposes.test.js +99 -0
  71. package/dist/flags.test.js +84 -0
  72. package/dist/index.js +106 -14
  73. package/dist/prompt.d.ts +15 -0
  74. package/dist/prompt.js +27 -0
  75. package/dist/registrant.d.ts +6 -0
  76. package/dist/registrant.js +155 -0
  77. package/dist/services-sync.test.d.ts +1 -0
  78. package/dist/services-sync.test.js +32 -0
  79. package/dist/skills/my-api-hq/SKILL.md +51 -45
  80. package/dist/skills/my-crm-api/README.md +42 -0
  81. package/dist/skills/my-crm-api/SKILL.md +165 -0
  82. package/dist/skills/my-crm-api/claude/.claude-plugin/plugin.json +6 -0
  83. package/dist/skills/my-database-api/README.md +41 -0
  84. package/dist/skills/my-database-api/SKILL.md +107 -0
  85. package/dist/skills/my-database-api/claude/.claude-plugin/plugin.json +6 -0
  86. package/dist/skills/my-domain-api/SKILL.md +53 -26
  87. package/dist/skills/my-email-verify-api/README.md +33 -0
  88. package/dist/skills/my-email-verify-api/SKILL.md +91 -0
  89. package/dist/skills/my-email-verify-api/claude/.claude-plugin/plugin.json +6 -0
  90. package/dist/skills/my-funnel-api/SKILL.md +41 -37
  91. package/dist/skills/my-image-api/SKILL.md +48 -44
  92. package/dist/skills/my-llm-api/README.md +35 -0
  93. package/dist/skills/my-llm-api/SKILL.md +125 -0
  94. package/dist/skills/my-llm-api/claude/.claude-plugin/plugin.json +6 -0
  95. package/dist/skills/my-storage-api/README.md +1 -1
  96. package/dist/skills/my-storage-api/SKILL.md +44 -54
  97. package/dist/skills/my-webhook-api/README.md +1 -1
  98. package/dist/skills/my-webhook-api/SKILL.md +48 -92
  99. package/dist/skills/my-workflow-api/SKILL.md +46 -115
  100. package/dist/telemetry.d.ts +12 -0
  101. package/dist/telemetry.js +80 -0
  102. package/dist/telemetry.test.d.ts +1 -0
  103. package/dist/telemetry.test.js +101 -0
  104. package/package.json +13 -8
  105. package/dist/commands/email.js +0 -586
  106. package/dist/skills/my-email-api/README.md +0 -45
  107. package/dist/skills/my-email-api/SKILL.md +0 -104
  108. package/dist/skills/my-email-api/claude/.claude-plugin/plugin.json +0 -6
  109. package/dist/skills/my-email-api/make/.gitkeep +0 -0
  110. package/dist/skills/my-email-api/n8n/.gitkeep +0 -0
  111. package/dist/skills/my-email-api/openapi/.gitkeep +0 -0
  112. package/dist/skills/my-funnel-api/make/.gitkeep +0 -0
  113. package/dist/skills/my-funnel-api/n8n/.gitkeep +0 -0
  114. package/dist/skills/my-image-api/make/.gitkeep +0 -0
  115. package/dist/skills/my-image-api/n8n/.gitkeep +0 -0
  116. package/dist/skills/my-storage-api/make/.gitkeep +0 -0
  117. package/dist/skills/my-storage-api/n8n/.gitkeep +0 -0
  118. package/dist/skills/my-webhook-api/make/.gitkeep +0 -0
  119. package/dist/skills/my-webhook-api/n8n/.gitkeep +0 -0
  120. package/dist/skills/my-workflow-api/make/.gitkeep +0 -0
  121. package/dist/skills/my-workflow-api/n8n/.gitkeep +0 -0
  122. package/dist/utils.test.js +0 -48
  123. /package/dist/{utils.test.d.ts → exposes.test.d.ts} +0 -0
  124. /package/dist/skills/{my-api-hq/make → my-crm-api/openapi}/.gitkeep +0 -0
  125. /package/dist/skills/{my-api-hq/n8n → my-database-api/openapi}/.gitkeep +0 -0
  126. /package/dist/skills/{my-domain-api/make → my-email-verify-api/openapi}/.gitkeep +0 -0
  127. /package/dist/skills/{my-domain-api/n8n → my-llm-api/openapi}/.gitkeep +0 -0
@@ -1,69 +1,73 @@
1
1
  ---
2
2
  name: my-funnel-api
3
+ version: 1.0.0
3
4
  description: >
4
5
  Create and publish websites (funnels) to the edge. Push raw HTML to any slug and it goes live instantly on your org's domain or preview subdomain.
6
+ triggers: [funnel, landing page, website, page, publish, push, slug, html, edge, preview subdomain, makeautonomous]
7
+ checksum: sha256-pending
5
8
  ---
6
9
 
7
10
  # MyFunnelAPI
8
11
 
9
- A funnel is a website tied to an org. You push raw HTML pages to slugs and they are served from the edge immediately — no build pipeline, no deploy queue.
12
+ A funnel is a website tied to an org. Push raw HTML pages to slugs and they're served from the edge immediately — no build pipeline, no deploy queue.
10
13
 
11
- ## How It Fits Together
14
+ ## Capabilities
15
+ <!-- llm:start -->
16
+ Funnels are the publishing surface. You create a funnel under an org (one command), then `funnel push` raw HTML to any slug (`/`, `/about`, `/pricing`, etc.). The edge serves the page within seconds — no CI/CD, no build, no deploy queue.
12
17
 
13
- - Requires `api_key` and `org_id` from **myapihq**.
14
- - Works out of the box on the free preview subdomain (`*.makeautonomous.com`).
15
- - To serve on a custom domain, register and assign a domain via **mydomainapi** first.
18
+ By default, your funnel lives on a free preview subdomain (`*.makeautonomous.com`) you get with every org. To serve on a custom domain, register and assign one via **mydomainapi** first.
16
19
 
17
- ## Typical Flow
18
-
19
- ```bash
20
- myapi funnel create # creates a funnel under your default org
21
- echo '<h1>Hello</h1>' | myapi funnel push / # pushes HTML to /
22
- myapi funnel list # see all funnels and their preview URLs
23
- ```
24
-
25
- After `funnel create`, the CLI prints a preview URL. After `push`, the page is immediately live.
26
-
27
- ## All Commands
20
+ Every funnel includes two public proxy endpoints your HTML can call directly (no API key needed): a **form submit** endpoint that forwards POSTs to your org's webhook, and an **analytics/event ingest** for pageviews and click tracking.
21
+ <!-- llm:end -->
28
22
 
23
+ ## Commands
24
+ <!-- generated:start -->
29
25
  | Command | What it does |
30
26
  |---|---|
31
- | `myapi funnel create` | Create a new funnel in the default org |
32
- | `myapi funnel list` | List all funnels with their preview/domain URLs |
33
- | `myapi funnel get <id>` | Inspect a funnel's metadata and preview URL |
34
- | `myapi funnel delete <id>` | Delete funnel and purge all its edge pages |
35
- | `myapi funnel push [slug]` | Push HTML from stdin to a slug path |
36
-
37
- ## Pushing Pages
38
-
39
- The `push` command reads HTML from stdin and deploys it to a slug. The funnel is resolved from your saved default (`myapi auth config set-funnel <id>`) or `--funnel <id>`.
40
-
27
+ | `myapi funnel create` | Create a funnel in the default org |
28
+ | `myapi funnel list` | List all funnels with preview/domain URLs |
29
+ | `myapi funnel get <id>` | Inspect a funnel's metadata + preview URL |
30
+ | `myapi funnel delete <id>` | Delete the funnel and purge its edge pages |
31
+ | `myapi funnel push [slug]` | Push HTML from stdin to a slug (default: `/`) |
32
+ | `myapi funnel pages [funnel_id]` | List the pages currently published to a funnel |
33
+ | `myapi funnel verify [slug]` | Verify a published page is reachable + check links/webhooks |
34
+ <!-- generated:end -->
35
+
36
+ ## Examples
37
+ <!-- llm:start -->
41
38
  ```bash
42
- # push to /
43
- cat index.html | myapi funnel push /
39
+ # Create a funnel + push a homepage
40
+ myapi funnel create
41
+ echo '<h1>Hello</h1>' | myapi funnel push /
42
+
43
+ # Push multiple pages
44
+ cat about.html | myapi funnel push /about
45
+ cat pricing.html | myapi funnel push /pricing
44
46
 
45
- # push to /contact
46
- cat contact.html | myapi funnel push /contact
47
+ # Pipe directly from a generator
48
+ my-html-gen | myapi funnel push /landing
47
49
 
48
- # push to / using explicit funnel
49
- cat index.html | myapi funnel push / --funnel <funnel_id>
50
+ # Inspect what's published
51
+ myapi funnel pages
52
+ myapi funnel verify /pricing
50
53
 
51
- # pipe from a generator
52
- my-html-gen | myapi funnel push /landing
54
+ # Clean up
55
+ myapi funnel delete <funnel_id>
53
56
  ```
54
57
 
55
- Omitting `[slug]` defaults to `/`.
58
+ Omitting `[slug]` defaults to `/`. The funnel id is resolved from `--funnel`, the saved default funnel, or — only if the org has exactly one funnel — auto-picked.
59
+ <!-- llm:end -->
56
60
 
57
61
  ## Form Submissions & Analytics
58
62
 
59
- Funnels include two public proxy endpoints your HTML can call directly (no API key needed):
63
+ Funnels expose two public proxy endpoints your published HTML can hit directly (no API key needed):
60
64
 
61
65
  - **Form submit:** `POST /funnel/funnels/{id}/submit/{slug}` — validates payload and forwards to your org's configured webhook.
62
66
  - **Analytics/tracking:** `POST /funnel/funnels/{id}/event` — proxies pageviews, clicks, and pixel events to your webhook. Rate-limited to 60 req/min per funnel.
63
67
 
64
68
  ## Notes
65
69
 
66
- - Default org and funnel are stored in config. Set them once with `myapi auth config set-org <id>` to skip `--org` on every command.
70
+ - Set defaults with `myapi config set-org <id>` and `myapi config set-funnel <id>` to skip flags on every command.
67
71
  - Deleting a funnel purges all its edge pages immediately.
68
72
  - `402` errors mean insufficient credits — run `myapi billing topup <amount>`.
69
73
 
@@ -1,74 +1,78 @@
1
1
  ---
2
2
  name: my-image-api
3
+ version: 1.0.0
3
4
  description: >
4
5
  Generate AI images from a text prompt. Async — submit a prompt, the CLI polls until the image is ready, then returns a public CDN URL. Image lands automatically in your org's storage.
6
+ triggers: [image, generate image, ai image, hero image, logo, illustration, watercolor, prompt, cyberpunk, ratio, aspect ratio]
7
+ checksum: sha256-pending
5
8
  ---
6
9
 
7
10
  # MyImageAPI
8
11
 
9
12
  Text-to-image generation. Submit a prompt with optional aspect ratio, style, color palette, and "allow text" hint. The job is asynchronous — the CLI polls until completion (typically 10–30s, capped at 90s).
10
13
 
11
- ## How It Fits Together
14
+ ## Capabilities
15
+ <!-- llm:start -->
16
+ Generation is async. Submit a prompt → get a `job_id` immediately. The CLI polls every 3 seconds and returns when the job completes (or times out at 90s — the job continues server-side; check back with `image get <job_id>`).
12
17
 
13
- - Requires `api_key` and `org_id` from **myapihq**.
14
- - Each generation costs ~$0.05 (deducted from your balance).
15
- - The output asset is stored in your org's **mystorageapi** bucket — `myapi storage list` and `myapi storage get` can fetch it later by id.
16
- - Generated images can be referenced from a **myfunnelapi** page or embedded in a **myemailapi** template.
18
+ Cost is per-image at the selected model's catalog rate (today $0.039 for the default flash model, $0.10 for the pro model). Run `myapi image models` for the live catalog. Failed jobs aren't charged. Generated images land automatically in your org's **mystorageapi** bucket — they show up in `myapi storage list` and can be referenced from a **myfunnelapi** page or embedded in a **myemailapi** template.
17
19
 
18
- ## Quick Start
19
-
20
- ```bash
21
- # Generate (positional prompt is the recommended shape)
22
- myapi image generate "A clean flat-color logo for a sustainable jam company"
23
-
24
- # Same with options
25
- myapi image generate "Hero image, 16:9, mountains at dawn" \
26
- --ratio 16:9 --style "watercolor" --colors "#ff6600,#003366"
27
-
28
- # List your generations
29
- myapi image list
30
-
31
- # Inspect or fetch a specific job
32
- myapi image get <job_id>
33
-
34
- # Delete the asset (the job history record stays)
35
- myapi image delete <job_id>
36
- ```
37
-
38
- ## All Commands
20
+ The output URL is public — anyone with it can view. Don't generate sensitive content.
21
+ <!-- llm:end -->
39
22
 
23
+ ## Commands
24
+ <!-- generated:start -->
40
25
  | Command | What it does |
41
26
  |---|---|
42
27
  | `myapi image generate <prompt>` | Async generate, polls up to 90s, returns id + URL |
43
28
  | `myapi image list` | List all generated images for the org |
44
- | `myapi image get <job_id>` | Get full job details (status, URL, prompt, aspect ratio) |
29
+ | `myapi image get <job_id>` | Get full job details (status, URL, prompt, ratio) |
30
+ | `myapi image models` | List available image models with per-image pricing |
45
31
  | `myapi image delete <job_id>` | Delete the asset (job record kept for history) |
46
32
 
47
- ## Generate Flags
33
+ ### Generate flags
48
34
 
49
35
  | Flag | Allowed | Default | Notes |
50
36
  |---|---|---|---|
37
+ | `--model` | id from `image models` | `gemini-2.5-flash-image` | Override the default model (e.g. `gemini-3-pro-image-preview` for higher quality) |
51
38
  | `--ratio` | `1:1`, `16:9`, `9:16`, `4:3`, `3:4` | `1:1` | Aspect ratio of the output |
52
- | `--style` | free-form string | none | Style hint, e.g. `"watercolor"`, `"cyberpunk neon"` |
53
- | `--colors` | hex list, comma-separated | none | e.g. `"#ff6600,#003366"` — the model will bias toward these |
54
- | `--text` | flag (no value) | off | Allow text in the image. Off by default — text rarely renders well, use only when you specifically want a logo or sign |
39
+ | `--style` | free-form | none | e.g. `"watercolor"`, `"cyberpunk neon"` |
40
+ | `--colors` | hex list | none | e.g. `"#ff6600,#003366"` — the model biases toward these |
41
+ | `--text` | flag (no value) | off | Allow text in the image. Off by default — text rarely renders well |
42
+ <!-- generated:end -->
43
+
44
+ ## Examples
45
+ <!-- llm:start -->
46
+ ```bash
47
+ # Plain generation
48
+ myapi image generate "A clean flat-color logo for a sustainable jam company"
49
+
50
+ # With styling
51
+ myapi image generate "Hero image, mountains at dawn" \
52
+ --ratio 16:9 --style "watercolor" --colors "#ff6600,#003366"
55
53
 
56
- ## Async Behavior
54
+ # Higher-quality pro model
55
+ myapi image generate "Editorial portrait, soft natural light" \
56
+ --model gemini-3-pro-image-preview --ratio 4:3
57
+
58
+ # History
59
+ myapi image list
60
+ myapi image get <job_id>
61
+ myapi image delete <job_id>
62
+
63
+ # Catalog — see which models are available and what they cost per image
64
+ myapi image models
65
+ ```
57
66
 
58
- Generation is async. The CLI:
59
- 1. Submits the prompt gets a `job_id` immediately.
60
- 2. Polls `GET /image/orgs/<org>/jobs/<job_id>` every 3 seconds.
61
- 3. Returns when status is `completed` (success) or `failed` (errors out).
62
- 4. If 90 seconds elapse without completion, the CLI prints a timeout message but **the job keeps running server-side**. Check back with:
63
- ```
64
- myapi image get <job_id>
65
- ```
67
+ Tips for agents:
68
+ - Prompts with explicit text usually fail — for branded text use a separate text overlay step.
69
+ - For non-square layouts, set `--ratio` rather than describing dimensions in the prompt.
70
+ <!-- llm:end -->
66
71
 
67
72
  ## Notes
68
73
 
69
- - Generations cost $0.05 each. Failed jobs aren't charged.
70
- - The asset URL is public (anyone with the URL can view) — don't generate sensitive content.
71
- - Prompts with explicit text usually fail; for branded text use a separate text overlay step or a real designer.
72
- - Delete is permanent for the asset; the job's prompt + metadata stays for your history (`image list` will still show it with an empty URL).
74
+ - Cost is per-image at the selected model's catalog rate (`myapi image models`). Failed jobs aren't charged.
75
+ - The asset URL is public — don't generate sensitive content.
76
+ - `delete` is permanent for the asset; the job record (prompt + metadata) stays for history.
73
77
 
74
78
  Run `myapi image --help` or `myapi image <subcommand> --help` for full flag reference.
@@ -0,0 +1,35 @@
1
+ # my-llm-api
2
+
3
+ Provider-agnostic LLM completions and embeddings, billed at upstream cost. Today routes to Gemini; the model id is just a string, so additional providers land without breaking callers.
4
+
5
+ ## What it does
6
+
7
+ - **Chat completion** — messages array (role/content), get reply + usage + cost
8
+ - **Embeddings** — single string or batch, returns vector(s) + usage
9
+ - **Model catalog** — list available models with per-1M-token pricing
10
+
11
+ ## Quickstart
12
+
13
+ ```bash
14
+ myapi llm models
15
+ myapi llm complete "explain HMAC in two sentences" # defaults to gemini-3.1-flash-lite-preview
16
+ myapi llm embed "the quick brown fox" --model gemini-embedding-001
17
+ ```
18
+
19
+ ## Authentication
20
+
21
+ ```bash
22
+ export MYAPI_KEY=mak_...
23
+ ```
24
+
25
+ Requires `api_key` and `org_id` from **myapihq**. Inference cost is debited from your MyAPI balance — top up via `myapi billing topup`.
26
+
27
+ ## When to use
28
+
29
+ This is the **workflow-step LLM** — use it inside scripted pipelines (summarize a doc, classify an email, embed text for similarity). It is **not** a replacement for your own reasoning if you're an agent; you already have a model.
30
+
31
+ ## Documentation
32
+
33
+ Model catalog, message shapes, and cost semantics: see `SKILL.md`.
34
+
35
+ Run `myapi llm --help` for inline reference.
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: my-llm-api
3
+ version: 1.0.0
4
+ description: >
5
+ Provider-agnostic LLM completions and embeddings, billed at upstream cost.
6
+ The model id is just a string — today routes to Gemini, more providers land
7
+ without breaking callers. Use this inside workflow steps and scripted
8
+ pipelines, not as a replacement for your own reasoning.
9
+ triggers: [llm, completion, chat, embed, embedding, gemini, inference, summarize, classify, vector]
10
+ checksum: sha256-pending
11
+ ---
12
+
13
+ # MyLLMAPI
14
+
15
+ A thin, OpenAI-compatible-shape LLM gateway. Three endpoints: `complete` (chat), `embed` (vectors), `models` (catalog). Pricing is per-1M tokens at the upstream rate while we build our own inference; cost is debited from your MyAPI balance.
16
+
17
+ ## Capabilities
18
+ <!-- llm:start -->
19
+ Use this for workflow tasks — summarize a doc, classify an inbound email, embed text for similarity, expand a one-line prompt into structured copy. The reply goes to stdout; a one-line usage footer (tokens + cost + finish reason) goes to stderr, so `myapi llm complete ... | jq` and similar pipelines work as expected.
20
+
21
+ **Don't use this as your own model.** If you're an agent reading this, you already have a more capable model than what's exposed here. Reach for `llm complete` when you're scripting a recurring step where a small/cheap model is the right tool — not for one-shot reasoning that you can just do yourself.
22
+
23
+ ### Messages shape
24
+ ```json
25
+ {
26
+ "model": "gemini-3.1-flash-lite-preview",
27
+ "messages": [
28
+ { "role": "system", "content": "You are a terse editor." },
29
+ { "role": "user", "content": "Tighten this paragraph: ..." }
30
+ ],
31
+ "max_tokens": 200,
32
+ "temperature": 0.2,
33
+ "stop": ["\n\n"]
34
+ }
35
+ ```
36
+
37
+ Roles: `system | user | assistant`. Multiple system messages collapse to one instruction. `max_tokens`, `temperature`, and `stop` are optional — per-model defaults apply.
38
+
39
+ ### Complete response
40
+ ```json
41
+ {
42
+ "model": "gemini-3.1-flash-lite-preview",
43
+ "content": "...assistant reply...",
44
+ "finish_reason": "stop",
45
+ "usage": { "input_tokens": 42, "output_tokens": 87, "cost_usd": 0.000029 }
46
+ }
47
+ ```
48
+
49
+ `finish_reason` is typically `stop` (model returned naturally), `length` (hit max_tokens — increase if you need more), or `safety` (blocked).
50
+
51
+ ### Embed response
52
+ ```json
53
+ {
54
+ "model": "gemini-embedding-001",
55
+ "embeddings": [[-0.0226, 0.0118, ...]],
56
+ "usage": { "input_tokens": 5, "cost_usd": 0.0000007 }
57
+ }
58
+ ```
59
+
60
+ `embeddings` is always `number[][]` — even a single-string input returns a one-element array of vectors. Embed-only usage has no `output_tokens`.
61
+
62
+ ### Model catalog
63
+ - Chat models: `id`, `kind: 'chat'`, `context` (token window), `input_per_1m`, `output_per_1m`
64
+ - Embed models: `id`, `kind: 'embed'`, `dimensions`, `input_per_1m`
65
+
66
+ Today: `gemini-3.1-pro-preview`, `gemini-3.1-flash-lite-preview`, `gemini-embedding-001`. Catalog is live — always query `models` rather than hard-coding ids.
67
+ <!-- llm:end -->
68
+
69
+ ## Commands
70
+ <!-- generated:start -->
71
+ | Command | What it does |
72
+ |---|---|
73
+ | `myapi llm models [--kind chat\|embed] [--json]` | List available models with pricing |
74
+ | `myapi llm complete "<prompt>" [--model <id>] [--system "<s>"] [--max-tokens N] [--temperature 0..1] [--stop <csv>] [--file <path>] [--json]` | Chat completion; reply to stdout, usage to stderr. Default model: `gemini-3.1-flash-lite-preview` |
75
+ | `myapi llm embed "<text>" --model <id> [--file <path>] [--json]` | Embed a string; default render shows model + dim + first 5 values |
76
+ <!-- generated:end -->
77
+
78
+ Pass `-` as the prompt to read from stdin. Pass `--file <path>` to read a longer prompt from disk.
79
+
80
+ ## Examples
81
+ <!-- llm:start -->
82
+ ```bash
83
+ # List the catalog
84
+ myapi llm models
85
+ # Filter to embed-only
86
+ myapi llm models --kind embed --json | jq '.models[].id'
87
+
88
+ # One-shot completion (default model = gemini-3.1-flash-lite-preview)
89
+ myapi llm complete "Summarize in 12 words: $(cat README.md)"
90
+
91
+ # Override the model (e.g. when you need pro-tier quality)
92
+ myapi llm complete "Polish this draft: ..." \
93
+ --model gemini-3.1-pro-preview \
94
+ --system "You are a terse copy editor" \
95
+ --max-tokens 300
96
+
97
+ # Read from stdin (useful in pipelines)
98
+ cat email.txt | myapi llm complete - \
99
+ --system "Classify intent: support | sales | spam"
100
+
101
+ # Embed and save the vector
102
+ myapi llm embed --file doc.txt --model gemini-embedding-001 --json \
103
+ > doc.vec.json
104
+ ```
105
+
106
+ ### End-to-end recipe — classify inbound webhooks
107
+ ```bash
108
+ # Pull the last delivery body, classify with a tiny model, route accordingly
109
+ BODY=$(myapi webhook delivery <delivery_id> --json | jq -r '.body')
110
+ INTENT=$(printf '%s' "$BODY" | myapi llm complete - \
111
+ --system 'Respond with one word: support, sales, or spam.' \
112
+ --max-tokens 5)
113
+ echo "Routing $INTENT"
114
+ ```
115
+ <!-- llm:end -->
116
+
117
+ ## Notes
118
+
119
+ - **No upstream tokens involved.** MyAPI never holds your Gemini/OpenAI/Anthropic credentials — we hold ours, you pay us at-cost while we build our own inference. The model id is just a string; routing happens server-side.
120
+ - **Latency.** Flash-lite ≈ 200–800ms first token. Pro ≈ 600ms–2s. Embeddings sub-second.
121
+ - **Cost.** `usage.cost_usd` is the authoritative number — debited at upstream rate (no MyAPI markup today). Use this for cost-accounting in workflows.
122
+ - **Streaming.** Not exposed yet — `complete` returns the full reply. Add streaming support when there's a use case that requires it.
123
+ - **Bring-your-own-key.** Not supported by design. MyAPI's value here is unified billing + a stable API across providers; managing your upstream keys would defeat both.
124
+
125
+ Run `myapi llm --help` for inline reference.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "my-llm-api",
3
+ "description": "Provider-agnostic LLM completions + embeddings via MyAPI. Routes to managed models (Gemini today, more soon) at upstream cost. Use in workflow steps, not for your own reasoning.",
4
+ "version": "1.0.0",
5
+ "published": true
6
+ }
@@ -17,7 +17,7 @@ myapi storage upload ./logo.png
17
17
  # → asset uploaded! URL: https://api.mystorageapi.com/storage/<id>
18
18
 
19
19
  # Or fetch via curl
20
- curl -O "$(myapi storage get <asset_id>)"
20
+ curl -O "$(myapi storage get-url <asset_id>)"
21
21
  ```
22
22
 
23
23
  ## Authentication
@@ -1,88 +1,78 @@
1
1
  ---
2
2
  name: my-storage-api
3
+ version: 1.0.0
3
4
  description: >
4
- Edge-hosted asset storage. Upload local files (.png/.jpg) directly, or have the server fetch from a public URL. Each asset gets a stable public CDN URL.
5
+ Edge-hosted asset storage. Upload local files (.png/.jpg/.gif/.webp) directly, or have the server fetch from a public URL. Each asset gets a stable public CDN URL.
6
+ triggers: [storage, upload, ingest, asset, cdn, image hosting, file upload, get-url, download, public url]
7
+ checksum: sha256-pending
5
8
  ---
6
9
 
7
10
  # MyStorageAPI
8
11
 
9
- Per-org asset storage with edge CDN delivery. Two ways in:
10
- - **Direct upload** — push a local file (multipart upload)
11
- - **Ingest from URL** — server fetches a public URL and stores the file
12
+ Per-org asset storage with edge CDN delivery. Two ways in: direct upload (local file → multipart) or ingest (server fetches a public URL). Both produce a stable public URL like `https://api.mystorageapi.com/storage/<id>`.
12
13
 
13
- Both produce a stable public URL like `https://api.mystorageapi.com/storage/<id>`.
14
+ ## Capabilities
15
+ <!-- llm:start -->
16
+ Storage is the asset layer. Anything you upload or ingest is served from the edge under a permanent public URL — embed it in funnel pages, email templates, anywhere.
14
17
 
15
- ## How It Fits Together
18
+ `upload` accepts `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp` from the local filesystem. For other formats (PDF, mp4, webm, svg) host the file somewhere public and use `ingest` instead — the server fetches it for you.
16
19
 
17
- - Requires `api_key` and `org_id` from **myapihq**.
18
- - Upload supports `.png`, `.jpg`, `.jpeg` today. (Add more via `mystorageapi`'s backend if you need them.)
19
- - Assets are public — anyone with the URL can fetch.
20
- - **myimageapi** automatically uses storage for generated images, so generated images appear in `myapi storage list` too.
20
+ Generated images from **myimageapi** automatically land here; they appear in `storage list` under their job id.
21
21
 
22
- ## Quick Start
22
+ Use `get` for a round-trip metadata fetch. Use `get-url` when you just need the URL — it's a pure local URL constructor (no API call, no auth, no rate limit), perfect for piping to curl or embedding into HTML.
23
+ <!-- llm:end -->
23
24
 
25
+ ## Commands
26
+ <!-- generated:start -->
27
+ | Command | What it does |
28
+ |---|---|
29
+ | `myapi storage list` | List all stored assets |
30
+ | `myapi storage upload <file>` | Direct multipart upload of a local image |
31
+ | `myapi storage ingest <url>` | Server fetches a public URL into storage |
32
+ | `myapi storage get <asset_id>` | Round-trip the API for full metadata (`--json` or human block) |
33
+ | `myapi storage get-url <asset_id>` | Pure local URL constructor — no API call, no auth |
34
+ | `myapi storage delete <asset_id>` | Permanently delete the asset |
35
+ <!-- generated:end -->
36
+
37
+ ## Examples
38
+ <!-- llm:start -->
24
39
  ```bash
25
- # Direct upload
40
+ # Direct upload of a local image
26
41
  myapi storage upload ./logo.png --name "brand-logo"
27
42
 
28
- # Ingest a public URL (server pulls)
43
+ # Ingest a remote file (server pulls it down)
29
44
  myapi storage ingest https://example.com/hero.jpg --name "hero"
30
45
 
31
- # List
46
+ # Inspect
32
47
  myapi storage list
48
+ myapi storage get <asset_id>
33
49
 
34
- # Get the public URL (curl-friendly)
35
- curl -O "$(myapi storage get <asset_id>)"
50
+ # Embed the URL — no API call, perfect for scripts
51
+ URL=$(myapi storage get-url <asset_id>)
52
+ echo "<img src=\"$URL\" />"
53
+ curl -O "$URL"
36
54
 
37
- # Delete
55
+ # Clean up
38
56
  myapi storage delete <asset_id>
39
57
  ```
40
-
41
- ## All Commands
42
-
43
- | Command | What it does |
44
- |---|---|
45
- | `myapi storage list` | List all stored assets |
46
- | `myapi storage upload <file>` | Direct multipart upload of a local file |
47
- | `myapi storage ingest <url>` | Server fetches a public URL into storage |
48
- | `myapi storage get <asset_id>` | Print the public CDN URL (no API call) |
49
- | `myapi storage delete <asset_id>` | Permanently delete the asset |
58
+ <!-- llm:end -->
50
59
 
51
60
  ## Upload vs Ingest
52
61
 
53
- Pick based on where the file is:
54
-
55
- - **`upload`** — file is on your machine. Multipart POST. Constraint: `.png` / `.jpg` / `.jpeg` only today.
56
- - **`ingest`** — file is at a public HTTP(S) URL. Server downloads and stores. Useful for migrating assets from another host or pulling in third-party images you have rights to.
57
-
58
- Both produce identical asset records — `list` doesn't distinguish them.
59
-
60
- ## Naming
61
-
62
- Both `upload` and `ingest` accept `--name <display>` for a human-friendly label. If omitted:
63
- - `upload` defaults to the filename's basename.
64
- - `ingest` defaults to the URL path's filename or empty.
62
+ - **`upload`** — file is on your machine. Multipart POST. Image types only: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`.
63
+ - **`ingest`** — file is at a public HTTP(S) URL. Server downloads and stores. Useful for migrating assets, pulling in third-party images you have rights to, or for non-image types (`image/svg+xml`, `application/pdf`, `video/mp4`, `video/webm`).
65
64
 
66
- The display name is for your reference only the public URL uses the auto-generated id.
65
+ Both produce identical asset records`list` doesn't distinguish.
67
66
 
68
- ## Public URLs
69
-
70
- `myapi storage get <id>` is a pure-local URL constructor — no API call, no auth, no rate limit. The output is exactly:
71
- ```
72
- https://api.mystorageapi.com/storage/<id>
73
- ```
74
- (or whatever `MYAPI_STORAGE_URL` is set to). Pipe it directly into curl:
75
- ```bash
76
- curl -O "$(myapi storage get abc123)"
77
- ```
67
+ ## `get` vs `get-url`
78
68
 
79
- The URL itself is permanent until you `myapi storage delete <id>` embed it freely in your funnels, emails, or anywhere else.
69
+ - **`get <id>`** round-trips the API. Returns name, URL, created_at. Honors `--json`. Use when you want metadata.
70
+ - **`get-url <id>`** — local URL constructor. No API call, no auth, no rate limit. Output is exactly `https://api.mystorageapi.com/storage/<id>` (or whatever `MYAPI_STORAGE_URL` is set to). Use to embed URLs into HTML, pipe to curl, or build download links cheaply.
80
71
 
81
72
  ## Notes
82
73
 
83
- - Assets are public by default. Don't store sensitive files.
74
+ - Assets are public by default — don't store sensitive files.
84
75
  - Delete is immediate and unrecoverable.
85
- - Generated images from **myimageapi** show up in `storage list` under their job id.
86
- - If you need a non-image format (PDF, video, etc.), `ingest` works as long as the server-side storage accepts it; `upload` is restricted to image types.
76
+ - The URL is permanent until you `myapi storage delete <id>` embed it freely.
87
77
 
88
78
  Run `myapi storage --help` for full flag reference.
@@ -15,7 +15,7 @@ Inbound HTTP endpoints that receive POSTs from third-party services and store ev
15
15
  ```bash
16
16
  # Create an endpoint
17
17
  myapi webhook create "stripe-events"
18
- # → prints: Inbound URL: https://api.myapihq.com/webhook/in/<slug>
18
+ # → prints: Inbound URL: https://api.mywebhookapi.com/webhook/in/<slug>
19
19
 
20
20
  # POST to it from anywhere
21
21
  curl -X POST <inbound-url> -d '{"event":"x"}'