[AI-Translations] Fix Anthropic Claude CORS error and change max_tokens#148
Conversation
Claude cannot run in DatoCMS because of a CORS error, for this we add a header to allow CORS. Also, there is no max_output_tokens value in the Claude API docs, currently it errors with a missing max tokens parameter, so changed this as well.
|
Tested on DatoCMS with a local plugin, it works! |
|
Good catch and thank you, @Techwolf12 ! I'm currently working on some related fixes to this plugin, and I'll roll your fixes in with the upcoming version, if that's OK? (and give you co-authorship credit too) I'll keep this open until that's released. |
|
@roger-datocms Sure thing! Any idea when the upcoming version will be released? We have a client that would like to use this, currently I have it running on my machine. Based on your answer I can check if we temporarily deploy a version ourselves and switch later when the update gets released, or just wait :) |
|
Gotcha. In that case I'll prep a new release now with just this fix... give me a sec |
|
Thank you, appreciate it! |
3.5.7 fixes Anthropic/Claude on top of the now-merged 3.5.6 over-split HTML
rejoin fix:
- send the required `max_tokens` parameter (the Messages API rejected
`max_output_tokens`, so Claude translations failed), and
- add the `anthropic-dangerous-direct-browser-access` header to BOTH the
translation call (#148) and the config-screen model listing, so neither
is blocked by CORS inside the plugin iframe.
Also backfills the changelog for 3.5.2–3.5.6.
Co-Authored-By: Christiaan de Die le Clercq <christiaanddlc@q42.nl>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The fix should be released in 3.5.7, which should show up in the marketplace/plug-in config screen in a few hours. If you're in a rush you can also use the "upgrade to canary version" in the plugin sidebar and just type in Thanks again :) |
Claude cannot run in DatoCMS because of a CORS error, for this we add a header to allow CORS.
Also, there is no max_output_tokens value in the Claude API docs, currently it errors with a missing max tokens parameter, so changed this as well.