{"id":103348,"plugin_id":"plugin_asdk_app_6aedf6ea2fac819180910f8b98663c77","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-18T06:19:21.434Z","digest":"ff1e989dc732073879d4bba683ab26427e9bd526597a390582eb3d0c855c4be8","against":null,"payload":{"description":"Clay workflows — reduce a workflow's credit and LLM cost via the CLI (`clay workflows` commands). Identifies expensive patterns and suggests cheaper alternatives.","included_files":[],"name":"workflows-optimize-credits","skill_md_contents":"---\nname: workflows-optimize-credits\ndescription: Clay workflows — reduce a workflow's credit and LLM cost via the CLI (`clay workflows` commands). Identifies expensive patterns and suggests cheaper alternatives.\n---\n\n# Reducing workflow credit & LLM cost\n\nBefore using this skill, read the `clay` entry skill if you haven’t already this session, and follow its access guidance.\n\nAnalyze the current workflow and suggest changes to reduce credit consumption and LLM costs without sacrificing quality.\n\n## Process\n\n1. **Read the workflow** using `clay workflows graph get <workflowId> --mode full` to get all node details\n2. **Identify cost drivers** — LLM calls, Clay action usage, model selection\n3. **Present optimization opportunities** with estimated impact, alongside a render of the **current graph** (`clay workflows diagram <workflowId>`) with the expensive nodes called out so the user can see where the cost lives\n4. **Apply authorized changes** — edit the workflow only when the user's request authorizes modifications, via `clay workflows nodes update`/`create`/`delete`. Once authorized, apply clearly safe optimizations as you go and ask before changes with a material quality or behavior trade-off\n5. **Show the result** — after applying, run `clay workflows graph format <workflowId>` and render the **updated graph** so the change is visible\n\nNarrate throughout and prefer the diagram over raw node JSON — see the `workflows` skill's `presenting.md`.\n\n## Cost Drivers in Clay Workflows\n\n### LLM Calls (biggest cost driver)\n\nEvery regular (LLM) node makes at least one LLM call per execution. More capable models cost more.\n\n**Optimizations:**\n\n- **Replace with code nodes:** If a node does deterministic work (data transformation, filtering, formatting), replace it with a code node — zero LLM cost\n- **Use cheaper models:** Simple tasks (parameter extraction, basic classification) can use smaller/faster models. Reserve powerful models for complex reasoning\n- **Merge nodes:** Two sequential LLM nodes doing related work can often be one node with a combined prompt — cuts LLM calls in half\n- **Pre-map action parameters:** When a node calls a Clay action, configure `static` or `reference` input mappings (`inputMappingConfig`, see the `workflows` skill's `data-passing.md`) for parameters that don't need LLM inference. If ALL parameters are pre-mapped, the LLM parameter mapping call is skipped entirely\n\n### Clay Action Credits\n\nEach Clay action execution consumes credits based on the action's pricing tier.\n\n**Optimizations:**\n\n- **Avoid redundant enrichments:** If the same data was already fetched in an earlier node, reference it via a pinned input (`sourceNodeId`/`sourcePath`) instead of calling the action again\n- **Use conditional routing:** Skip expensive enrichments for items that don't need them (e.g., skip company research for companies you already have data on)\n- **Choose cheaper alternatives:** Some actions have cheaper equivalents. Use `clay workflows actions list` (see `/workflows-discover-actions`) to compare options and their priority tier\n\n### Model Selection\n\nDifferent models have different cost/capability profiles.\n\n**Optimizations:**\n\n- **Match model to task complexity:**\n  - Simple extraction/classification → use a smaller, faster model\n  - Complex reasoning, multi-step analysis → use a more capable model\n  - Creative writing, nuanced decisions → use the most capable model\n- **Downgrade where safe:** Review each regular node's prompt. If the task is straightforward, try a cheaper model\n\n### Repeat Node Efficiency\n\nNodes in Repeat mode (`listMode: true`) multiply costs by the number of items processed.\n\n**Optimizations:**\n\n- **Code over agent:** If the per-item processing is deterministic, use a code node (zero LLM cost per item)\n- **Filter before repeating:** Add a code node before the Repeat node to filter out items that don't need processing\n\n### Conditional Routing\n\nUse conditional nodes to skip expensive branches for items that don't need them.\n\n**Example:**\n\n```\nInstead of:  [All items] → [Expensive enrichment] → [Process]\nDo this:     [All items] → [Conditional: has data?] → Yes → [Process]\n                                                    → No  → [Enrichment] → [Process]\n```\n\n## Analysis Output Format\n\nFor each optimization opportunity, present:\n\n1. **Node(s) affected** — which nodes to change\n2. **Current cost pattern** — what's expensive and why\n3. **Suggested change** — specific modification\n4. **Estimated impact** — qualitative (high/medium/low) cost reduction\n5. **Risk** — any quality trade-offs\n\nPrioritize suggestions by impact (highest savings first). Pair the list with the current-graph render, with the expensive nodes called out, so each is easy to locate.\n\nFor analysis or recommendation requests, present the opportunities without editing. If the user asks you to modify the workflow, apply clearly safe savings as you identify them and state your assumptions. Ask only when an optimization has a meaningful quality, cost, or behavior trade-off. Then validate with `clay workflows graph format <workflowId>` and show the updated graph so the user can see the before/after difference.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}