Skip to content

feat(shared): add extraBody to HttpOptions - #352

Merged
kwaa merged 1 commit into
mainfrom
feat/http-extra-body
Nov 8, 2026
Merged

kwaa merged 1 commit into
mainfrom
feat/http-extra-body

Conversation

@kwaa

@kwaa kwaa commented Nov 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add extraBody?: Record<string, unknown> to HttpOptions.
  • sendRequest merges it over the JSON body that the adapter builds, one level deep, so every JSON adapter supports it. A field in extraBody replaces the same field in the body, and a field set to undefined is removed. Field names are sent as written.
  • A request with no body or a FormData body 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), and reasoning (OpenRouter). Without extraBody, AIRI would parse and rewrite the JSON body in a custom fetch.

Tests

  • vitest run for shared, text-chat, and model.
  • pnpm typecheck.
  • ESLint on changed packages: no errors.

🤖 Generated with Claude Code

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>
@pkg-pr-new

pkg-pr-new Bot commented Nov 8, 2026

Copy link
Copy Markdown
@xsai/audio

pnpm add https://pkg.pr.new/@xsai/audio@352

@xsai/decide

pnpm add https://pkg.pr.new/@xsai/decide@352

@xsai/embed

pnpm add https://pkg.pr.new/@xsai/embed@352

@xsai/image

pnpm add https://pkg.pr.new/@xsai/image@352

@xsai/model

pnpm add https://pkg.pr.new/@xsai/model@352

@xsai/shared

pnpm add https://pkg.pr.new/@xsai/shared@352

@xsai/text

pnpm add https://pkg.pr.new/@xsai/text@352

@xsai/text-chat

pnpm add https://pkg.pr.new/@xsai/text-chat@352

@xsai/text-messages

pnpm add https://pkg.pr.new/@xsai/text-messages@352

@xsai/text-responses

pnpm add https://pkg.pr.new/@xsai/text-responses@352

xsai

pnpm add https://pkg.pr.new/xsai@352

xsschema

pnpm add https://pkg.pr.new/xsschema@352

commit: 852caf4

@kwaa
kwaa merged commit 7518798 into main Nov 8, 2026
5 of 6 checks passed
@kwaa
kwaa deleted the feat/http-extra-body branch November 8, 2026 15:51
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.

1 participant