Add support for OpenAI-compatible API providers (e.g., MiniMax)#165
Open
octo-patch wants to merge 1 commit intoVectifyAI:mainfrom
Open
Add support for OpenAI-compatible API providers (e.g., MiniMax)#165octo-patch wants to merge 1 commit intoVectifyAI:mainfrom
octo-patch wants to merge 1 commit intoVectifyAI:mainfrom
Conversation
- Support OPENAI_BASE_URL env var and --base-url CLI flag to use alternative OpenAI-compatible API endpoints - Support OPENAI_API_KEY as alternative to CHATGPT_API_KEY - Add --api-key CLI flag to override API key - Use temperature=0.01 for custom endpoints (some providers like MiniMax reject exactly 0) - Document MiniMax and alternative provider usage in README
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
OPENAI_BASE_URLenv var and--base-urlCLI flagOPENAI_API_KEYas alternative toCHATGPT_API_KEYfor broader compatibility--api-keyCLI argument to override API key at runtimetemperature=0incompatibility with some providers (e.g., MiniMax rejects exactly 0) by using0.01when a custom base URL is setMiniMax-M2.5with 204K context window) and other alternative providers in READMEMotivation
PageIndex currently only supports the OpenAI API directly. Many users want to use alternative LLM providers that offer OpenAI-compatible APIs. This PR makes it easy to switch providers with minimal configuration changes.
For example, MiniMax provides high-quality models with very large context windows (204K tokens) through an OpenAI-compatible endpoint at
https://api.minimax.io/v1, which is well-suited for PageIndex's long document processing workloads.Changes
pageindex/utils.py: All three API functions (ChatGPT_API,ChatGPT_API_async,ChatGPT_API_with_finish_reason) now accept an optionalbase_urlparameter and pass it to the OpenAI client. AddedOPENAI_API_KEYfallback.run_pageindex.py: Added--api-keyand--base-urlCLI arguments.README.md: Added documentation section for using alternative providers, with MiniMax as an example.Test plan
OPENAI_BASE_URLis not set)MiniMax-M2.5model) via--base-url https://api.minimax.io/v1