Skip to content

Default wpcom provider for Studio Code in Studio UI - #3696

Merged
nightnei merged 4 commits into
trunkfrom
addAnthropicApiFlow
Jun 9, 2026
Merged

Default wpcom provider for Studio Code in Studio UI#3696
nightnei merged 4 commits into
trunkfrom
addAnthropicApiFlow

Conversation

@nightnei

@nightnei nightnei commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

I figured out and wrote the code manually. AI just double checked the approach. Since AI was generating overengineered solutions.

Proposed Changes

In Studio UI we decided to default to wpcom provider, since it's free right now and there is no sense for users to use own keys.

Testing Instructions

  1. npm run cli:build
  2. node apps/cli/dist/cli/main.mjs code
  3. Select wpcom
  4. Assert that no regresion, it work well as before
  5. npm start
  6. Open Studio Code tab
  7. Open ~/.studio/cli.json
  8. Remove aiProvider
  9. Say hi to Assistant
  10. Assert that you imiidiatelly see the response from AI. And assert that aiProvider has value wpcom in ~/.studio/cli.json
@nightnei
nightnei requested review from a team, sejas and youknowriad June 4, 2026 14:19
@wpmobilebot

wpmobilebot commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing d1a8562 vs trunk

app-size

Metric trunk d1a8562 Diff Change
App Size (Mac) 1384.35 MB 1312.72 MB 71.64 MB 🟢 -5.2%

site-editor

Metric trunk d1a8562 Diff Change
load 1710 ms 1667 ms 43 ms ⚪ 0.0%

site-startup

Metric trunk d1a8562 Diff Change
siteCreation 9048 ms 9013 ms 35 ms ⚪ 0.0%
siteStartup 4423 ms 4459 ms +36 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad

Copy link
Copy Markdown
Contributor

Can we instead disable the "api key" provider entirely from Studio App and rely full on the .com provider? Alternative would be to surface the API KEY config in the app settings but I'm not sure it's necessary for a start. I think there's not much value for the moment to provide your own API KEY specially if we're still giving free access.

@nightnei

nightnei commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Can we instead disable the "api key" provider entirely from Studio App and rely full on the .com provider? Alternative would be to surface the API KEY config in the app settings but I'm not sure it's necessary for a start. I think there's not much value for the moment to provide your own API KEY specially if we're still giving free access.

@youknowriad do you mean to:

  1. Remove this:
    Screenshot 2026-06-04 at 21 07 55

  2. If the user opens the Assistant tab and if aiProvider is not set yet, then set it to wpcom automatically in cli.json

Do I understand your suggestion correctly?

I think it doesn't make sense to show only 1 open to chose, like this:
Screenshot 2026-06-04 at 21 12 39

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vova, thanks for working to add Anthropic API. I tested it and confirmed I was able to add my Anthropic API key and worked as expected.

In the testing instructions there is a small typo with the Studio home folder. The folder is hidden and requires a dot Open ~/.studio/cli.json.

Before After
api-key-before.mp4
enter-anthropic-api-key.mp4

I agree with Riad and we can default to WPcom provider without asking the user, at least initially.

@youknowriad

youknowriad commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Yes, that was my suggestion, I'm hesitant about proposing the removal of the anthropic provider entirely from the the code command as well. (CLI). I think it's still useful for me to check whether an issue is due to our proxy or not, but other than that, I don't see it being useful to users right now.

@nightnei nightnei closed this Jun 8, 2026
@nightnei
nightnei force-pushed the addAnthropicApiFlow branch from 36d1d61 to 83953c0 Compare June 8, 2026 14:51
@nightnei nightnei reopened this Jun 8, 2026
@nightnei
nightnei requested a review from sejas June 8, 2026 15:27
@nightnei

nightnei commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author
@nightnei nightnei changed the title Implement Anthropic API key flow for Assistant Jun 8, 2026

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nightnei, thanks for the change. I tested it and works as expected. Let's add or update existing unit tests, so we make sure we don't introduce regressions in the future.
I tested it by renaming my ~/.studio I went through the onboarding , logged in and tested the Studio Assistant/Code tab. I confirm it responded correctly instead of asking me to select the provider.

Image

Also noting that we don't need to test if it has the token ready, because the UI limits the chat interface to authenticated users.

Comment thread apps/cli/commands/ai/index.ts Outdated
const config = await readCliConfig();
let showCapabilitiesOnConnect = ! config.aiProvider;

// Since Studio Code inside Studio UI is free right now - we decided to default to WordPress.com provider so far.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Since Studio Code inside Studio UI is free right now - we decided to default to WordPress.com provider so far.
// Studio Code Desktop defaults to WordPress.com provider.
@nightnei
nightnei merged commit 6fff35f into trunk Jun 9, 2026
11 checks passed
@nightnei
nightnei deleted the addAnthropicApiFlow branch June 9, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants