Skip to content

Add support for OpenAI-compatible API providers (e.g., MiniMax)#165

Open
octo-patch wants to merge 1 commit intoVectifyAI:mainfrom
octo-patch:feature/add-openai-compatible-provider-support
Open

Add support for OpenAI-compatible API providers (e.g., MiniMax)#165
octo-patch wants to merge 1 commit intoVectifyAI:mainfrom
octo-patch:feature/add-openai-compatible-provider-support

Conversation

@octo-patch
Copy link

Summary

  • Add support for OpenAI-compatible API providers via OPENAI_BASE_URL env var and --base-url CLI flag
  • Support OPENAI_API_KEY as alternative to CHATGPT_API_KEY for broader compatibility
  • Add --api-key CLI argument to override API key at runtime
  • Handle temperature=0 incompatibility with some providers (e.g., MiniMax rejects exactly 0) by using 0.01 when a custom base URL is set
  • Document MiniMax (MiniMax-M2.5 with 204K context window) and other alternative providers in README

Motivation

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 optional base_url parameter and pass it to the OpenAI client. Added OPENAI_API_KEY fallback.
  • run_pageindex.py: Added --api-key and --base-url CLI arguments.
  • README.md: Added documentation section for using alternative providers, with MiniMax as an example.

Test plan

  • Existing OpenAI usage is fully backward-compatible (no behavior change when OPENAI_BASE_URL is not set)
  • Tested with MiniMax API (MiniMax-M2.5 model) via --base-url https://api.minimax.io/v1

- 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
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