Skip to content

Add MiniMax as LLM provider with thinking model middleware#63

Open
octo-patch wants to merge 2 commits into
mishushakov:mainfrom
octo-patch:feature/add-minimax-provider
Open

Add MiniMax as LLM provider with thinking model middleware#63
octo-patch wants to merge 2 commits into
mishushakov:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

  • Add MiniMax M2.7 as a supported LLM provider using @ai-sdk/openai OpenAI-compatible adapter
  • Include AI SDK wrapLanguageModel middleware that handles two MiniMax M2.7 quirks:
    • Downgrades json_schema response format to json_object (MiniMax doesn't support json_schema), embedding the schema in the system prompt
    • Strips <think>...</think> tags from both generate and stream responses (M2.7 is a thinking model)
  • Add MiniMax to README provider list with setup instructions
  • Add examples/minimax.ts with complete working example

Test plan

  • 6 unit tests for provider configuration and LLMScraper initialization (tests/minimax.test.ts)
  • 3 integration tests for scraping, streaming, and markdown format (tests/minimax-integration.test.ts) — requires MINIMAX_API_KEY env var, auto-skipped otherwise
  • All 9 tests passing

Files changed

File Description
README.md Add MiniMax to features list and provider setup section
examples/minimax.ts Full example with middleware for thinking model support
tests/minimax.test.ts 6 unit tests for provider config and scraper init
tests/minimax-integration.test.ts 3 integration tests (scraping, streaming, markdown)

PR Bot and others added 2 commits March 21, 2026 01:27
MiniMax M2.7 is a thinking model that wraps responses with <think> tags and
doesn't support json_schema response format. This adds AI SDK middleware to
handle both issues: downgrading json_schema to json_object with schema
instructions embedded in the system prompt, and stripping think tags from
both generate and stream responses.

- Add MiniMax to README provider list with setup instructions
- Add examples/minimax.ts with full middleware example
- Add 6 unit tests for provider configuration and LLMScraper initialization
- Add 3 integration tests for scraping, streaming, and markdown format

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
- Use MiniMax-M3 as the default chat model in the example and README
- Add a unit test for the new M3 model id; keep M2.7 / M2.7-highspeed
  test cases for backward compatibility
- Switch integration tests to call MiniMax-M3 by default
- Update middleware comments to reflect that the json_schema downgrade
  applies to any MiniMax model (the think-tag stripping is harmless
  if the model does not emit them)
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