Skip to content

[AI-Translations] Fix Anthropic Claude CORS error and change max_tokens#148

Merged
roger-datocms merged 1 commit into
datocms:masterfrom
Techwolf12:feature/fix-anthropic
Jun 25, 2026
Merged

[AI-Translations] Fix Anthropic Claude CORS error and change max_tokens#148
roger-datocms merged 1 commit into
datocms:masterfrom
Techwolf12:feature/fix-anthropic

Conversation

@Techwolf12

Copy link
Copy Markdown
Contributor

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.

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.
@Techwolf12

Copy link
Copy Markdown
Contributor Author

Tested on DatoCMS with a local plugin, it works!

@Techwolf12 Techwolf12 changed the title AI-Translations: Fix Anthropic Claude CORS error and change max_tokens [AI-Translations] Fix Anthropic Claude CORS error and change max_tokens Jun 25, 2026
@roger-datocms

Copy link
Copy Markdown
Member

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.

@Techwolf12

Copy link
Copy Markdown
Contributor Author

@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 :)

@roger-datocms roger-datocms merged commit 828e22e into datocms:master Jun 25, 2026
@roger-datocms

Copy link
Copy Markdown
Member

Gotcha. In that case I'll prep a new release now with just this fix... give me a sec

@Techwolf12

Copy link
Copy Markdown
Contributor Author

Thank you, appreciate it!

roger-datocms added a commit that referenced this pull request Jun 25, 2026
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>
@roger-datocms

Copy link
Copy Markdown
Member

@Techwolf12

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 3.5.7

Thanks again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants