add-moderation-api-support: any-llm-ts#3
Merged
Conversation
Capture baseURL, apiKey, and platformToken on the client instance so raw fetch calls can reuse gateway routing and auth. Refactor handleError so the unsupported-capability mapping surfaces in both platform and non-platform modes (a logical error, not an auth concern), while the remaining status mappings stay platform-only.
The default path delegates to openai.moderations.create. When the
caller passes { includeRaw: true }, the method bypasses the OpenAI
SDK (which strips unknown fields) and POSTs directly to
/v1/moderations?include_raw=true so the provider's raw body can be
preserved on each result.
OpenAI's APIError prepends the HTTP status to the server's detail string (for example '400 Provider anthropic does not support moderation'), which broke the previous startsWith-based parser and missed the 'multimodal moderation' phrasing. Switch to regex-based detection so both the plain and multimodal variants map correctly regardless of any status prefix.
4b3fdfd to
e33a795
Compare
tbille
commented
Apr 17, 2026
Member
Author
There was a problem hiding this comment.
this file should be removed. Part of this PR remove the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implementation for add-moderation-api-support in any-llm-ts.
Changes
Testing