Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

MCP drained my api in 2 Days

mark_cawley
mark_cawley Member Posts: 11 ✭

The mcp completely drained my api after only a few days.

This is very disappointing. I have been using gpt for coding features for a year. Copy paste repeat. From my point of view the MCP is saving me the trouble of clicking ctr+a/c/a/v —> commit over and over. It's great!

It was. So this tool seemed amazing. No more copy/pasta. Two days of testing: Done. Paywall.

No more fun.

I feel like the api wasnt ready for the amazing feature that onshape just gave the world.

Is this a problem across the board? something that is being addressed?

Comments

  • Arthur_Hobden
    Arthur_Hobden Member Posts: 4 PRO

    I feel your disappointment I too have been clicking ctr+a/c/a/v —> committing over and over, and I have numbers if they help.

    One read-only session: listed the Feature Studios in nine documents, read seven of them. No writes, no tests, no iteration. That cost 53 API requests from about 20 tool calls, because one call fans out into several REST requests underneath.

    I am on 2,500 a year, which is 11 requests per working day. An afternoon of looking at my own documents cost four and a half days of it.

    The part I keep getting stuck on is that nobody did anything wrong. The MCP is not inefficient and Mark was not careless. Exploring is what an agent does! it lists things to find out what exists, then reads whatever those reference. A script you can budget. An agent you cannot. The API call limit allocation was built for scripts.

    So Onshape shipped the best FeatureScript tool it has ever made and metered it as though we would use it twice a month!

    What is the intended answer? Either the allocation moves, or traffic through Onshape's own MCP server gets the same exemption public App Store apps already have.

  • S1mon
    S1mon Member Posts: 4,648 PRO
    edited August 21

    I burnt through 2500 in a few months when I was only using scripts that ChatGPT created to GET and PUT the FeatureScript into documents.

    I was given an additional 2500 recently. I burned those and somehow went 25% over my limit in 3 small projects in a matter of hours of total use.

    On the one hand the Onshape API tokens are ~$0.03 each, and I'm paying OpenAI a bunch each month for what works out to be unlimited tokens for my usage. I can (and likely will) pay for more Onshape API tokens, but I'd like them to be something I need to think about a lot less. It literally feels like we're being nickel and dimed here. I was more excited to start using the MCP server than any normal person should be, but I have to say burning through tokens instantly is a huge buzz kill.

    image.png
    1. My hello world - AKA make a box - test. Maybe 50 tokens?
    2. A version of End cap (End Cap Plus) for Frames which can automatically find all the open frame ends. The feature is mostly done and I was excited to publish it. Chat estimates this used ~190 tokens.
    3. I noticed that the Javawizard GitHub clone of the Standard Library was months out of date, so I asked ChatGPT for help to figure out a good way to create a current Repo, and keep it up to date. I told it to look at the changelog and only check the Std Lib doc once a week in a lightweight way. There are ~270 tabs of FS, there were 4 releases to backfill, it made a couple failed tests, and it wanted to do a SHA-256 verification of the synced code. This apparently took a few thousand tokens.

    The whole point of having an up to date mirror like this is to avoid burning API tokens regularly for my LLM to learn from or use the standard library correctly.

    The updated GitHub Mirror is in the link below, but I ran out of tokens so there may be issues. I also don't know if I can maintain this given the API token issues.

    [edit: the repo below has been retired. use @Derek_Van_Allen_BD clone of the standard library here]

    https://github.com/gatrall/onshape-std-library-mirror/tree/readme


    Can Onshape PLEASE make and maintain an official GitHub mirror of the standard library so no one needs to waste tokens like this?

    @GregBrown @Vajrang_Parvate

    😭

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • mark_cawley
    mark_cawley Member Posts: 11 ✭

    Onshape MCP API Usage Investigation Report

    Date: 2026-08-16Scope: Consolidated analysis and controlled benchmarks through the production test ending at API counter 254.


    1. Executive Summary

    The most important findings are:

    1. One MCP tool call is not equivalent to one Onshape API request.
    2. Several MCP tools fan out into multiple Onshape REST requests.
    3. The cost of an operation is driven much more by the remote workflow than by the amount of local reasoning or code transformation.
    4. A deliberately optimized FeatureScript workflow can perform substantial real development at a predictable 9-call floor:
      • get_featurescript = 6 calls
      • put_featurescript = 3 calls
    5. A large derivative design task—converting a copied wheel FeatureScript into a new complementary tire generator—also cost exactly 9 calls, despite extensive local redesign.
    6. Expensive validation and convenience workflows, especially test_feature and create_geometry, consume roughly 10–13 calls each.
    7. Identity checks, usage checks, discovery, and other apparently minor helper operations can themselves cost multiple API calls.
    8. The most promising optimization strategy is not necessarily reducing design complexity. It is reducing the number and type of remote Onshape interactions per development cycle.

    The investigation therefore supports a new operating model:

    Perform as much reasoning, code transformation, design work, and batching locally as possible, then use the minimum number of Onshape MCP interactions required to read and persist the result.


    2. Investigation Background

    The original main Onshape account showed:

    • Plan: Free
    • Annual API limit: 2,500
    • Usage observed: 2,513
    • Usage percentage: 100.52%
    • Tracking start date shown by Onshape: Feb. 19, 2026

    The user reported:

    • no manually created API key on the main account,
    • only roughly two days of active Onshape MCP use when exhaustion was discovered,
    • heavy MCP activity during those two days,
    • advanced FeatureScript editing,
    • repeated rebuilding and derived-feature creation,
    • a complex feature with more than 50 geometry controls,
    • autonomous creation of one house followed by roughly 30 additional related modules.

    Before controlled testing, it was uncertain whether two days of MCP work could plausibly consume most or all of the annual allocation.

    The benchmark results now make that explanation credible.


    3. Important Architectural Distinction

    The investigation established that two different quantities must be kept separate:

    1. Assistant-visible MCP tool calls
    2. Underlying Onshape REST API requests generated by the MCP server

    Reducing the number of visible MCP tool calls helps, but it does not guarantee low Onshape API consumption.

    The parallel investigation had already identified this distinction and noted that high-level MCP tools can perform multiple hidden operations internally. fileciteturn0file0L146-L186

    Examples include:

    • test_feature
    • create_geometry
    • identity/context checks
    • source reads
    • usage checks
    • Feature Studio discovery
    • workspace/branch management
    • preview generation

    This distinction became the central framework for all later testing.


    4. Earlier Uncontrolled / Partially Controlled Evidence

    Before the clean isolated benchmarks, several experiments suggested unexpectedly high API consumption.

    Cube-related observations

    A first cube-related session showed a 20-call delta, but that session included more than the final geometry operation. It also included usage checks, source reads, notes/documentation activity, testing, and a final write. Therefore, it should not be treated as a pure “cube creation = 20 calls” benchmark. fileciteturn0file0L107-L125

    A separate later cube experiment showed:

    • Start: 86
    • End: 105
    • Delta: 19

    That result occurred even after API-conservation instructions had been introduced. fileciteturn0file0L127-L142

    Other user-measured simple edits had previously shown:

    • edit to double cube size: 11 calls
    • edit to 2 × 2 × 3 in: 10 calls

    Those earlier 10–11 call results became especially important after the isolated read/write costs were measured.


    5. Controlled Benchmark Method

    The controlled-test protocol was:

    1. The user manually records the Onshape API counter.
    2. The assistant performs exactly one targeted MCP operation, or one tightly defined workflow.
    3. No unrelated discovery, identity lookup, usage check, testing, documentation search, branching, or verification is performed unless that is the specific test.
    4. The user manually checks the counter again.
    5. The before/after delta becomes the measured API cost.

    The manual dashboard was intentionally preferred over get_api_usage, because the investigation later showed that get_api_usage itself consumes quota and may be timing-sensitive.


    6. Isolated Primitive Benchmarks

    6.1 get_featurescript

    Two identical reads were performed against the same Feature Studio.

    Run 1

    • Before: 132
    • After: 138
    • Delta: 6

    Run 2

    • Before: 141
    • After: 147
    • Delta: 6

    Result

    get_featurescript = stable at 6 API calls

    This was one of the most important early discoveries. A simple source read is already expensive relative to the annual 2,500-call limit.

    No caching benefit was observed on the immediate repeated read.


    6.2 put_featurescript

    The exact same FeatureScript source was written back unchanged.

    Run 1

    • Before: 138
    • After: 141
    • Delta: 3

    Run 2

    • Before: 147
    • After: 150
    • Delta: 3

    Result

    put_featurescript = stable at 3 API calls

    This established the minimal existing-Feature-Studio edit baseline:

    get_featurescript

    6 +

    put_featurescript

    3 =

    9 API calls


    6.3 test_featurescript

    A trivial lambda was used:

    function(context, id) { return "ok"; }

    Run 1

    • Before: 150
    • After: 154
    • Delta: 4

    Run 2

    • Before: 154
    • After: 158
    • Delta: 4

    Result

    test_featurescript = stable at 4 API calls

    This means a workflow using:

    get_featurescript -> test_featurescript -> put_featurescript

    has a measured component cost of approximately:

    6 + 4 + 3 = 13 API calls


    6.4 test_feature

    A minimal no-op feature was tested in a real Part Studio context.

    Run 1

    • Before: 158
    • After: 171
    • Delta: 13

    Run 2

    • Before: 171
    • After: 181
    • Delta: 10

    Result

    test_feature = variable, 10–13 API calls observed

    This confirmed that test_feature is one of the expensive MCP primitives.

    Its documented workflow already implies substantial fan-out because it writes into a real Feature Studio, inserts a temporary or “trojan” feature into a Part Studio, and evaluates through Onshape.

    A read + test_feature + write development cycle therefore costs approximately:

    6 + 10–13 + 3 = 19–22 API calls

    That cost is roughly double the optimized read/write-only path.


    6.5 create_geometry

    A minimal cube-style feature was created using the normal branch-based workflow with cleanup enabled.

    Run 1

    • Before: 181
    • After: 193
    • Delta: 12

    Run 2

    • Before: 193
    • After: 205
    • Delta: 12

    Result

    create_geometry = stable at 12 API calls

    The visible operation included:

    • creating a new branch/workspace,
    • deploying FeatureScript,
    • adding a feature to a Part Studio,
    • generating geometry,
    • producing three preview images,
    • cleanup behavior.

    The parallel analysis had already noted that create_geometry is not a direct edit of a supplied Feature Studio and is better understood as an isolated branch/testing workflow. fileciteturn0file0L33-L46

    This reinforced the rule:

    Do not use

    create_geometry

    for normal editing of an existing Feature Studio.


    6.6 create_feature_studio — empty

    Two empty Feature Studios were created in the same workspace.

    Run 1

    • Before: 205
    • After: 210
    • Delta: 5

    Run 2

    • Before: 210
    • After: 212
    • Delta: 2

    Result

    create_feature_studio empty = variable, 2–5 API calls observed

    This suggested a possible cold/warm effect.

    The first call may include setup, context resolution, or other one-time work that the immediate repeat did not need.


    6.7 list_feature_studios

    Two identical discovery calls were made.

    Run 1

    • Before: 212
    • After: 214
    • Delta: 2

    Run 2

    • Before: 214
    • After: 216
    • Delta: 2

    Result

    list_feature_studios = stable at 2 API calls

    This is relatively cheap, but still unnecessary when a direct Feature Studio URL already supplies the element ID.

    Therefore:

    If

    did

    ,

    wid

    , and

    eid

    are known from the URL, do not call

    list_feature_studios

    .


    6.8 get_api_usage

    Two usage-check calls were tested.

    Run 1

    • Dashboard before: 216
    • Tool reported: 216
    • Dashboard after: 218
    • Observed delta: 2

    Run 2

    • Dashboard before: 218
    • Tool response reported: 220
    • Dashboard after: 223
    • Observed delta: 5

    Result

    get_api_usage = variable / timing-sensitive, 2–5 calls observed

    The second run showed that the usage value returned by the tool may represent an intermediate state during the tool’s own execution.

    This suggests:

    • some requests may occur after the usage value is fetched,
    • Onshape’s usage accounting may update asynchronously,
    • the tool may perform additional calls after retrieving the counter,
    • or the dashboard and API usage endpoint may update on slightly different schedules.

    The practical conclusion is clear:

    get_api_usage

    should not be used as the primary benchmarking instrument.

    Manual dashboard before/after checks are cleaner.


    6.9 create_feature_studio with initial source

    A new Feature Studio was created and populated with valid FeatureScript in the same MCP invocation.

    Run 1

    • Before: 223
    • After: 226
    • Delta: 3

    Run 2

    • Before: 226
    • After: 229
    • Delta: 3

    Result

    Prepopulated create_feature_studio = stable at 3 API calls

    This was a strong optimization result.

    Compare:

    • create empty Studio, warm result = 2
    • then put_featurescript = 3
    • separate total = ~5
    • create Studio with source already supplied = 3

    Therefore, when creating a new Feature Studio whose complete source is already known:

    Prefer

    create_feature_studio(..., contents=completeSource)


    6.10 whoami

    Two identity checks were measured.

    Run 1

    • Before: 229
    • After: 234
    • Delta: 5

    Run 2

    • Before: 234
    • After: 236
    • Delta: 2

    Result

    whoami = variable, 2–5 API calls observed

    This showed another cold/warm pattern.

    Operational conclusion:

    Do not call

    whoami

    routinely when the account context is already known.


    7. Production Workflow Test 1 — Real Menu Reorganization

    A fully developed wheel FeatureScript was used for a production-style test.

    The requested change was substantial at the UI level:

    • reorganize menu structure,
    • improve terminology,
    • make groups more user-friendly,
    • preserve geometry logic.

    The controlled workflow was:

    1. one get_featurescript
    2. extensive local analysis and code reorganization
    3. one put_featurescript
    4. no remote testing
    5. no docs search
    6. no identity check
    7. no listing
    8. no usage check
    9. no verification read

    Result

    • Before: 236
    • After: 245
    • Delta: 9

    This exactly matched the predicted 6 + 3 read/write floor.

    Significance

    This was the first strong demonstration that a meaningful real-world FeatureScript edit can stay at the theoretical minimum established by the primitive benchmarks.

    The complexity of the local edit did not increase API usage.


    8. Production Workflow Test 2 — Major Derivative Feature Creation

    The next test was intentionally much more ambitious.

    A copied wheel FeatureScript was supplied in a new Feature Studio. The task was:

    Use the coordinate system of the wheel FeatureScript to create a complementary tire model, with controls for tire fit. Use the supplied tire specification document as guidance, but prioritize a working model and choose practical dimensions where necessary.

    The supplied tire specification defined:

    • tire-to-rim interface parameters,
    • rim diameter and rim width,
    • bead-seat planes,
    • section width,
    • aspect ratio,
    • overall diameter,
    • sidewall geometry,
    • bead geometry,
    • tread/crown geometry,
    • fit/clearance concepts,
    • the same Z-axis wheel rotational coordinate convention,
    • and extensive higher-order carcass/tread/manufacturing options. fileciteturn1file0L3-L31 fileciteturn1file0L33-L55

    The tire document explicitly defined:

    • Z axis = wheel rotational axis
    • XY plane = wheel radial plane
    • origin = wheel center
    • axial coordinate = Z fileciteturn1file0L590-L612

    The tire model was designed locally to use that same coordinate convention and the wheel’s existing rim placement logic.

    The first tire version prioritized:

    • working tire envelope,
    • rim fit,
    • hollow cavity,
    • bead bundles,
    • sidewall shape,
    • shoulder/tread geometry,
    • useful fit controls,
    • circumferential grooves,
    • default dimensions compatible with the copied wheel.

    The source specification included far more advanced options—carcass plies, belts, cap ply, internal liner, loaded geometry, tread blocks, sipes, lettering, and manufacturing features—but these were intentionally not required for the first working tire pass. fileciteturn1file0L509-L574

    The controlled workflow was again:

    1. one get_featurescript
    2. complete local redesign
    3. one put_featurescript
    4. no remote testing
    5. no documentation search
    6. no listing
    7. no identity check
    8. no usage check
    9. no branch creation
    10. no verification read

    Result

    • Before: 245
    • After: 254
    • Delta: 9

    Significance

    This was the strongest production result in the investigation.

    A large existing FeatureScript was:

    • read,
    • understood,
    • structurally reinterpreted,
    • combined with an external technical specification,
    • transformed into a substantially different parametric model,
    • and written back,

    while consuming exactly the same 9 API calls as the menu reorganization.

    This strongly supports the following conclusion:

    Local task complexity does not materially increase Onshape API consumption when the remote interaction pattern remains one read and one write.


    9. Current Evidence Table Through Counter 254

    | Operation / workflow | Run 1 | Run 2 | Current interpretation |
    |---|---:|---:|---|
    | get_featurescript | 6 | 6 | Stable at 6 |
    | put_featurescript | 3 | 3 | Stable at 3 |
    | test_featurescript | 4 | 4 | Stable at 4 |
    | test_feature | 13 | 10 | Variable: 10–13 |
    | create_geometry | 12 | 12 | Stable at 12 |
    | create_feature_studio empty | 5 | 2 | Variable: 2–5 |
    | list_feature_studios | 2 | 2 | Stable at 2 |
    | get_api_usage | 2 | 5 | Variable / timing-sensitive |
    | create_feature_studio with source | 3 | 3 | Stable at 3 |
    | whoami | 5 | 2 | Variable: 2–5 |
    | Real optimized menu edit | 9 | — | Matched predicted floor |
    | Major derivative FeatureScript creation | 9 | — | Matched predicted floor |


    10. Cost Model Derived From the Tests

    Minimal existing-Feature-Studio edit

    get_featurescript + put_featurescript

    = 6 + 3

    = 9 API calls

    Existing edit with lightweight FeatureScript evaluation

    get_featurescript + test_featurescript + put_featurescript

    = 6 + 4 + 3

    = 13 API calls

    Existing edit with full test_feature

    get_featurescript + test_feature + put_featurescript

    = 6 + (10–13) + 3

    = 19–22 API calls

    New Feature Studio with known source

    create_feature_studio(contents=completeSource)

    = 3 API calls

    Branch-based geometry test

    create_geometry

    = 12 API calls


    11. Why the Earlier 10–11 Call Simple Edits Now Make Sense

    Earlier simple edit tests had shown:

    • 11 calls
    • 10 calls

    The isolated benchmarks now explain those numbers.

    The basic edit path alone costs:

    • 6 calls to read
    • 3 calls to write

    Total = 9

    That leaves only 1–2 additional calls for any surrounding ancillary behavior.

    Therefore the earlier 10–11 call edit measurements are consistent with the current primitive cost model.


    12. Major Architectural Conclusions

    12.1 FeatureScript complexity is not the primary cost driver

    The 9-call menu-edit test and the 9-call wheel-to-tire derivative test demonstrate that:

    • small local edit
    • large local edit
    • major code reorganization
    • major derivative model creation

    can all cost essentially the same amount if the Onshape interaction pattern stays unchanged.

    The dominant cost is therefore not local reasoning or code volume.

    It is remote interaction count and tool choice.


    12.2 test_feature is expensive

    At 10–13 calls per invocation, test_feature is one of the largest isolated costs measured.

    Repeatedly calling it during normal development can double or triple the cost of an otherwise efficient edit.


    12.3 create_geometry should remain special-purpose

    create_geometry consistently cost 12 calls and performs a branch-heavy workflow.

    It should be reserved for cases where:

    • isolated geometry testing is explicitly desired,
    • a temporary branch is useful,
    • preview generation is useful,
    • or the workflow specifically needs a persistent experimental workspace.

    It should not be the default route for editing an existing Feature Studio.


    12.4 Discovery and account checks should not be routine

    Measured costs:

    • list_feature_studios = 2
    • whoami = 2–5
    • get_api_usage = 2–5 and timing-sensitive

    These are meaningful costs under a 2,500-call annual allowance.

    If the direct Feature Studio URL already gives:

    • document ID
    • workspace ID
    • element ID

    then those IDs should be parsed client-side and reused.


    12.5 Usage measurement should ideally be internal to the MCP

    The parallel investigation proposed returning an apiCallsConsumed value from each MCP operation. fileciteturn0file0L284-L309

    The later get_api_usage tests strengthened that recommendation because:

    • quota checks themselves consume quota,
    • returned usage may not reflect the complete cost of the same invocation,
    • manual dashboard checks are more reliable but cumbersome.

    A future MCP should internally count outbound Onshape REST requests and return:

    apiCallsConsumed

    with each tool result.


    13. Recommended Low-Cost Production Modes

    Mode 1 — Existing Feature Studio, known safe change

    Use:

    get_featurescript -> local edit -> put_featurescript

    Expected cost:

    9 calls

    This is now proven for both minor and major transformations.


    Mode 2 — Existing Feature Studio, lightweight validation needed

    Use:

    get_featurescript -> local edit -> test_featurescript -> put_featurescript

    Expected cost:

    13 calls

    Use only when the requested change requires evaluation but does not require a full real-feature environment.


    Mode 3 — Existing Feature Studio, full real-feature validation needed

    Use:

    get_featurescript -> local edit -> test_feature -> put_featurescript

    Expected cost:

    19–22 calls

    This should be used deliberately, not automatically.


    Mode 4 — New Feature Studio with complete known source

    Use:

    create_feature_studio(..., contents=completeSource)

    Expected cost:

    3 calls

    This is currently the most efficient measured deployment path for a brand-new Studio.


    14. Implications for Autonomous Development

    The investigation does not show that autonomous development itself is inherently expensive.

    It shows that autonomous development becomes expensive when each implementation step is coupled to repeated remote operations such as:

    • read,
    • test,
    • verify,
    • discover,
    • branch,
    • preview,
    • read again,
    • write again.

    The two production tests demonstrate that a large bounded implementation packet can potentially cost only 9 calls if:

    • the assistant reads once,
    • performs extensive design and code work locally,
    • writes once,
    • and owner verification happens afterward.

    This suggests a much more sustainable development pattern:

    large implementation packet -> owner test/acceptance -> one corrective packet if needed

    rather than:

    many small remote edit/test/verify loops

    For example:

    • one optimized implementation packet = ~9 calls
    • one owner-directed correction packet = another ~9 calls
    • total for a two-pass owner-validation cycle = ~18 calls

    By contrast, repeated read -> test_feature -> write cycles can cost roughly 19–22 calls each.


    15. Annual Capacity Implications

    At a 2,500-call annual limit:

    If every meaningful edit costs 9 calls

    2,500 / 9 ≈ 277 optimized edit cycles

    If every edit uses test_featurescript

    2,500 / 13 ≈ 192 cycles

    If every edit uses test_feature

    2,500 / 19–22 ≈ 113–131 cycles

    If a workflow repeatedly uses 12-call create_geometry

    2,500 / 12 ≈ 208 operations

    These are still theoretical maxima because real usage also includes:

    • setup,
    • retries,
    • mistakes,
    • account checks,
    • usage checks,
    • failures,
    • branch operations,
    • document management,
    • feature creation,
    • and unrelated MCP activity.

    The practical lesson is that 2,500 calls is a small annual budget for high-frequency CAD automation unless workflows are deliberately optimized.


    16. Current Working Conclusions

    Through API counter 254, the investigation supports the following conclusions:

    1. The Onshape MCP itself is strongly implicated in rapid API consumption.
    2. A visible MCP invocation can fan out into several underlying Onshape REST requests.
    3. get_featurescript is unexpectedly expensive at 6 calls.
    4. put_featurescript is relatively efficient at 3 calls.
    5. test_featurescript costs 4 calls.
    6. test_feature costs 10–13 calls and should be treated as expensive.
    7. create_geometry costs 12 calls and should remain special-purpose.
    8. create_feature_studio with complete source is highly efficient at 3 calls.
    9. list_feature_studios, whoami, and get_api_usage should not be routine preflight calls.
    10. get_api_usage is unsuitable as a clean benchmark instrument because it consumes quota and appears timing-sensitive.
    11. The minimal proven edit workflow is 9 calls.
    12. A substantial menu reorganization hit that 9-call floor exactly.
    13. A major wheel-to-tire derivative model also hit that same 9-call floor exactly.
    14. Local reasoning complexity does not materially affect API usage when the remote interaction pattern is held constant.
    15. The best immediate optimization is to batch more work locally and reduce remote validation/discovery calls.
    16. The investigation now has enough evidence to move from primitive benchmarking into higher-level autonomous workflow experiments.

  • mark_cawley
    mark_cawley Member Posts: 11 ✭

    I created a new account. Using it to analyze the api. I hammered it hard the first hard when the mcp arrived, not paying attention. I learned a lesson at least.

    I am still very happy with the mcp. I just see i have to manage the api side.

    The tool at its current state is a convenience to an experienced featurescript coder. I now have a budget plan for API. Too little, too late for this account!

    My disappointment is that my main account is depleted of api and i now have to use alt-account to test and work with the mcp. Otherwise, i am still digging the mcp launch

  • Derek_Van_Allen_BD
    Derek_Van_Allen_BD Member Posts: 1,171 PRO
    edited August 16

    https://github.com/h0witzer/Onshape-Standard-Library-Mirror-2-Electric-Boogaloo

    I learned from your example about ripping stuff right out of a browser session and bypassing the API for featurescript updates. I've only used it to keep this repo up to date, but I've been steadily keeping it up to the latest version for the last few updates.

  • S1mon
    S1mon Member Posts: 4,648 PRO

    I'm about to upgrade from Standard to Professional for a personal account just so I can continue to do more FS development with MCP. Part of the agreement now says that API overages are $0.06/token, just for reference.

    So that my experience burning tokens to create a Standard Library mirror repo isn't in vain…

    @GregBrown @Darren_A_Henry please take a look at this IR:

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • robert_stiles
    robert_stiles Member Posts: 201 PRO

    Very interesting. Thanks for all this analysis.

    Its made a bit more sense of the API limits. When there are (or were) relatively few of us building apps, I could not understand why Onshape implemented the limits; it had been an all you can eat buffet for years. I thought that surely any dev API calls were insignificant compared to the enormous cost of the 3 million (?) or so free onshape accounts?? But I guess now they new what was coming - not so much on the AI prompt feature script side, but on the upcoming text prompt modelling which will surely mature over the next few months and and years. It could rinse their servers, just as people experiment.

    It makes you think about what the big AI services should really cost users, and what they will cost after we become fully dependent on them, and the investors ask for their return.

  • Derek_Van_Allen_BD
    Derek_Van_Allen_BD Member Posts: 1,171 PRO

    The inverse of that conversation is what value do these AI services provide the end users and businesses. I haven't yet ran the Onshape MCP through its paces (I'm being conservative with my API allowances until the right project comes along) but I've recently been leaning on AI more and more to target complex problems that we otherwise would never have scoped at the business or subcontracted out to other firms and we're starting to see the value come back 10 or 20 fold for some projects.

    As an example, we've been in need of a CAM post processor for a particularly quirky piece of CNC equipment and had initially commissioned a company to develop said post for around ~$10,000 and after months of back and forth between us, them, and the machine manufacturer who wrote the non-standard proprietary file format this machine uses instead of normal G code or NC code we were no closer to having parts produced on the machine than when we started working with them. A day and a half with Claude on the $200 plan has produced a functional post where both the machine manufacturer and the post developer had told us there were fundamental limitations with the file format we needed to export to and that we would need to be changing our 15 year running workflow to accommodate these limitations that didn't in fact exist.

    When used for this purpose it could have cost us another couple thousand dollars for the AI subscription or more token budget and the business case could still be made for the value it brings to the company after considering all alternatives. But we're also gatekeeping team access to this service to only the senior development team that truly knows what they're doing because if we were to have opened the doors to the entire rest of the team we'd be burning team budgets on memes or mundane questions that have answers that have been answered time and time again if you just read our docs.

    That's a long winded way to say I think even in an API rate limited model with token costs being what they are at present day there will be use cases that make sense to spend that budget on, and other use cases that are just plain silly. Long term I'd hope things trend more towards accessibility and being cheaper, but I'll find the use for it one day either way.

  • robert_stiles
    robert_stiles Member Posts: 201 PRO

    yep @Derek_Van_Allen_BD , I agree. I did some Featurescript today on the simple plus tier of gpt. Nothing ground breaking, just an adaption to the stock sweep feature that adds optional overshoot tolerance on the path (so bendy ply can be cut down after fixing, because its never a such a precise process laminating up layers of plywood). This thread stopped me trying Onshape labs because of the api limits.

    Gpt got it absolutely right first time. It hasn't been right first time for me before now.

    I'm just thinking that all these tools will go up one day. But I agree its likely to be less than staff time, or an external consultant.

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    edited August 20

    @mark_cawley thanks for doing this, it's very well done.

    Now I'm very cautious about what to ask for and will track my api usage.

    I'm thinking of forcing it to use a featurescript tab I created by adding this prompt.

    use https://cad.onshape.com/documents/b6e221cb7b4d15cab86f91b1/w/23496d7c6df43ac06d392281/e/dabbb61e3c7c57dd789d41db

    and trying to stop it from doing simple stuff I can do easily with the user interface.

  • S1mon
    S1mon Member Posts: 4,648 PRO

    So here's a really basic issue: apparently asking through the MCP how many API tokens you have left consumes at least a token. I can do the same thing by having my agent go to https://cad.onshape.com/user/developer and scrape the number. Surely that takes more resources from the Onshape servers to serve up that dynamic webpage than a simple API call?

    get_api_usage consumes one or more Onshape API requests

    Can someone from Onshape please explain this logic? To me this makes zero sense.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO

    When the api started, in the beginning, Onshape was going to take a cut from each api store sale. How much are you going to take? No answers. This was in the early days when Joe was in charge of the app store. I know Joe well and he had no answers.

    They're listening and they want us to be successful, they just don't know the answers, but they're going to support us. Don't give up, just keep going…

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO

    @mark_cawley how did you run your tests? are you snooping packets outbound from OS?

    I just checked the official API library and test_feature isn't an endpoint. Maybe the MCP is adding new endpoints not found in the standard api documentation?

  • mark_cawley
    mark_cawley Member Posts: 11 ✭

    I ran the test by running the mcp through gpt on a new account and feeding gpt the numbers back from the developer api usage page. So the end_point call is an early marker from gpt. I have no idea. What the test did for me was allow me to see that it didn't matter if i made a 1in cube, or I had the mcp revise a complex feature, the cost was relatively the same for the API Usage. My failure was probably the quantity of calls that I made the first few days. A couple hundred, easy.

    One update: Onshape sent me four emails that I did not see which me know about the API usage. The emails went to my spam though. However, to give Onshape their credit, they sent me emails every 25% until it was gone.

    I haven't really used the api much. Codex can perform all the tasks of the mcp without api usage or a developer key. It uses rest calls. Mine is set up on its own cdp with Playwright. (429 was my only real hurdle at the beginning. 15 hour retry-after. Really Onshape?) Its fast, but not as fast as the mcp.

    Point is that I am no expert at API. This drain took me by suprise. My other accounts are not having any trouble, so I learned my lesson.

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    edited August 26

    @mark_cawley

    I've used the api a lot. Many times you make a call to get a list and then make many calls based on the number of items in that list. If you change anything, then you modify and put the list back which takes more api calls. But this has nothing to do with a feature script. The api controls assemblies and other system level stuff. I'm confused about the api usage and AI, what's it really doing?

    The api is just controlling the reading and writing of the feature script tabs but it also has to know the compile errors and runtime errors. The published api doesn't support feature script errors so how does AI know this stuff?

    My little block was 70 tokens for a worthless feature and I'm with S1mon that isn't going to be enough. I'm struggling trying to figure out how to be more efficient with my prompts so I don't run out.

    My favorite prompt for the day is to tell AI "if you don't know that's ok, don't quess just tell me you don't know"

  • mark_cawley
    mark_cawley Member Posts: 11 ✭

    From a Temporary GPT session about MCP instructions: The List used by the MCP, what each is used for, and its API usage level. Note this is conjecture, but maybe it can help the cause.
    ———————————-

    1. whoami
      Identifies the Onshape user currently authenticated through the MCP, including company information when available. It also reports which account’s API allocation is currently being consumed.
      API usage: Low. Likely one or a small number of account/session REST API calls.
    2. logout
      Signs the current user out of the MCP’s Onshape session. The next Onshape MCP action would require authentication again.
      API usage: Low. Primarily authentication/session handling rather than CAD-document activity.
    3. set_api_allocation
      Lets the user view or change which eligible account’s Onshape API allocation is charged for MCP activity, such as personal versus company allocation.
      API usage: Low. Account/company allocation lookup or configuration calls.
    4. get_api_usage
      Reports API usage for the current allocation period, including calls used, remaining allowance, limits, cycle dates, and overage information when applicable.
      API usage: Low. Reads account/API-allocation information; no CAD modeling operations.
    5. test_featurescript
      Executes a FeatureScript lambda against an Onshape Part Studio context. This is the lighter-weight tool used to test and debug FeatureScript behavior without installing a complete custom feature.
      API usage: Moderate. Uses Onshape’s FeatureScript-evaluation/Part Studio API. Each new test attempt creates another API interaction.
    6. search_featurescript_documentation
      Searches the available FeatureScript documentation for functions, operations, types, queries, examples, and other language/API information relevant to writing or debugging FeatureScript.
      API usage: Low or possibly mixed MCP-side/API activity. The MCP states that its tool calls consume Onshape API calls, but the exact underlying endpoint used for documentation search is not exposed.
    7. edit_featurescript_notes
      Updates the MCP’s saved FeatureScript knowledge notes. It is intended for recording useful discoveries, fixes, workarounds, and non-obvious FeatureScript behavior learned during development.
      API usage: Unclear/likely minimal. The notes appear to be MCP-side storage, although the server generally states that tool calls consume Onshape API activity.
    8. read_featurescript_notes
      Reads the MCP’s accumulated FeatureScript notes. These notes help avoid repeating previously discovered mistakes and allow successful patterns to be reused.
      API usage: Unclear/likely minimal. Primarily MCP-side knowledge access rather than document or geometry access.
    9. list_feature_studios
      Lists the Feature Studio elements that exist in a specified Onshape document workspace, including the information needed to identify which studio to read or modify.
      API usage: Low. Document/element metadata REST calls.
    10. create_feature_studio
      Creates a new Feature Studio element inside a specified Onshape document workspace. It can optionally be initialized with FeatureScript source code.
      API usage: Low to moderate. Performs document/element creation and possibly Feature Studio content-writing calls.
    11. create_geometry
      Creates actual CAD geometry by making a new branched workspace, writing a FeatureScript custom feature, adding that feature to a Part Studio, and executing it.
      API usage: High. Likely involves several REST calls across documents/workspaces, elements, Feature Studios, Part Studio features, regeneration/evaluation, and potentially cleanup.
    12. test_feature
      Tests a complete FeatureScript custom feature in a real Feature Studio and Part Studio environment. Unlike test_featurescript, it validates the full installed-feature path.
      API usage: High. The MCP creates/writes temporary Feature Studio state, adds a temporary feature to a Part Studio, and evaluates the feature, so one invocation can fan out into multiple API calls.
    13. get_featurescript
      Reads the complete current FeatureScript source from a specified Feature Studio. It is typically used before modifying an existing studio so the current code is not accidentally overwritten.
      API usage: Low. Feature Studio/document read operation.
    14. put_featurescript
      Writes the complete finalized FeatureScript source back into an existing Feature Studio. It replaces the studio’s contents, so it is intended for use after testing and debugging are complete.
      API usage: Low to moderate. Feature Studio write/update API call(s), potentially followed by validation/error reporting.

    The biggest API consumers are therefore generally create_geometry and test_feature, followed by repeated test_featurescript calls. The lightest operations are account lookups, Feature Studio reads/listing, and probably documentation/notes operations. The exact number of allocation-counted REST requests behind each MCP instruction is not exposed by the MCP.

  • Arthur_Hobden
    Arthur_Hobden Member Posts: 4 PRO

    Check out this latest post and technique for reducing your API calls: https://forum.onshape.com/discussion/31663/onshape-mcp-how-ai-can-ask-30-questions-for-the-price-of-1-api-call#latest