Skip to content

Correct MiniMax Anthropic-compatible base URLs - #321

Open
octo-patch wants to merge 3 commits into
AgentEra:mainfrom
octo-patch:octo/20260713-correct-minimax-anthropic-base-urls-recvoRQM5daXm6-followup
Open

Correct MiniMax Anthropic-compatible base URLs#321
octo-patch wants to merge 3 commits into
AgentEra:mainfrom
octo-patch:octo/20260713-correct-minimax-anthropic-base-urls-recvoRQM5daXm6-followup

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Follow-up to #318.

Summary

  • Use the official global and China MiniMax Anthropic-compatible Base URLs ending in /anthropic.
  • Append /v1/messages inside AnthropicCompatible when a Base URL is not already versioned.
  • Preserve existing Base URLs that already end in /v1.
  • Add request-generation and outbound request-capture coverage.

Why

#318 included /v1 in the documented Base URLs so the adapter would reach the versioned Messages endpoint. MiniMax documents /anthropic as the Base URL, so the versioned request path should be derived inside the adapter instead of exposed in user configuration.

Testing

  • .venv/bin/python -m pytest tests/test_plugins/test_model_requester/test_anthropic_compatible.py -q (16 passed)
  • .venv/bin/python -m pytest tests/test_plugins/test_model_requester/test_anthropic_compatible.py -q -k 'generate_request_uses_messages_path or auth_headers_are_preserved_in_outgoing_request' (3 passed)
  • .venv/bin/python -m compileall -q agently/builtins/plugins/ModelRequester/AnthropicCompatible/modules/request_builder.py tests/test_plugins/test_model_requester/test_anthropic_compatible.py
  • git diff --check

I have read and agree to the CLA in CLA.md.

@Maplemx Maplemx Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"/v1" can not be seem as a solid promised base url part, it's more safer to let user provide it instead of adding it in framework process silently.

If base url from model provider is totally different from Anthropic official base url format, try use "full_url" instead of "base_url" in settings.

@Maplemx Maplemx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"/v1" can not be seem as a solid promised base url part, it's more safer to let user provide it instead of adding it in framework process silently.

If base url from model provider is totally different from Anthropic official base url format, try use "full_url" instead of "base_url" in settings.

@octo-patch

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I removed the implicit /v1 suffix so configured base URLs are respected, updated the regression coverage, and pushed a new commit. The targeted test run is currently blocked by a missing json5 dependency.

@Maplemx Maplemx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes because the proposed documentation and the adapter's URL semantics do not match.

The Agently AnthropicCompatible adapter sends HTTP directly and constructs request_url = <base_url>/messages. MiniMax's documented request endpoint is https://api.minimax.io/anthropic/v1/messages (and the corresponding api.minimaxi.com endpoint). Therefore:

  • the current documented Agently base_url = .../anthropic/v1 produces the correct request URL;
  • this PR's base_url = .../anthropic produces .../anthropic/messages, which drops the required /v1;
  • MiniMax's SDK environment variable named ANTHROPIC_BASE_URL is not automatically the same contract as Agently's direct-HTTP base_url setting.

Please keep the functional .../anthropic/v1 prefix, or document an explicit full_url = .../anthropic/v1/messages if the intent is to use the provider's full endpoint. A regression test should assert the actual MiniMax URL produced by the documented configuration. The rstrip("/") hardening can remain as a separate small fix, with handling for a missing/empty base URL if applicable.

Official endpoint reference: https://platform.minimax.io/docs/api-reference/text-chat-anthropic

@Maplemx Maplemx mentioned this pull request Jul 25, 2026
@octo-patch

Copy link
Copy Markdown
Contributor Author

Thanks for clarifying the adapter contract. I restored the functional /anthropic/v1 base URLs in both provider guides, kept generic base_url handling unchanged, and added regression cases for the actual global and China /messages URLs. I pushed a new commit and ran the targeted test file (18 passed).

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