Support custom base URL for OpenAI Responses API#342
Open
chyax98 wants to merge 1 commit into
Open
Conversation
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.
Closes #343
Problem
The native
openai-apiprovider uses the OpenAI Responses API, but its base URL was hardcoded tohttps://api.openai.com/v1. Users with a local or proxied Responses API endpoint could only configureopenai-compatible, which is the wrong protocol path because it targets OpenAI-compatible chat/completions rather than native/responses.Summary
openai-apiResponses API requests to use a custom API base URL.JCODE_OPENAI_API_BASE,OPENAI_API_BASE, orOPENAI_BASE_URL, including values saved inopenai.env.jcode login openai-api \ --api-base http://127.0.0.1:8317/v1 \ --api-key '<key>' \ --model gpt-5.5openai-compatibleseparate and unchanged.Edge cases and tradeoffs
https://chatgpt.com/backend-api/codex.normalize_api_basepolicy, so HTTPS is accepted and private/local HTTP endpoints are allowed, while unsafe public HTTP endpoints are rejected.JCODE_OPENAI_API_BASE, thenOPENAI_API_BASE, thenOPENAI_BASE_URL.Validation
cargo check -p jcode-base -p jcode --bin jcodeopenai-apiagainst a local Responses endpoint:/Users/xd/.jcode/source/jcode/target/debug/jcode \ --socket /tmp/jcode-openai-base-test.sock \ -p openai-api -m gpt-5.5 \ run 'Reply exactly JCODE_RESPONSES_BASE_OK'Result: