Repository navigation
feat(shared): add extraBody to HttpOptions - #352
Merged
Merged
Conversation
Merge extraBody over JSON request bodies in sendRequest, so callers can send parameters that an adapter does not map. Requests without a JSON body ignore it, and model catalogs leave it out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xsai/audio
@xsai/decide
@xsai/embed
@xsai/image
@xsai/model
@xsai/shared
@xsai/text
@xsai/text-chat
@xsai/text-messages
@xsai/text-responses
xsai
xsschema
commit: |
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
extraBody?: Record<string, unknown>toHttpOptions.sendRequestmerges it over the JSON body that the adapter builds, one level deep, so every JSON adapter supports it. A field inextraBodyreplaces the same field in the body, and a field set toundefinedis removed. Field names are sent as written.FormDatabody ignores it.models()leaves it out of its options, because a catalog sends no body.Why
Adapter request bodies are fixed field lists, so parameters that an adapter does not map have no official path. In 0.5, extra options went straight into the body. AIRI uses this for
thinking(DeepSeek, Moonshot, Z.ai, Ark, MiMo),chat_template_kwargs(Featherless), andreasoning(OpenRouter). WithoutextraBody, AIRI would parse and rewrite the JSON body in a customfetch.Tests
vitest runfor shared, text-chat, and model.pnpm typecheck.🤖 Generated with Claude Code