fix: OpenAI 1:1 spec-compat reconciliation (interfaze#218)#16
Merged
Conversation
This was referenced Jul 18, 2026
Khurdhula-Harshavardhan
requested changes
Jul 20, 2026
Khurdhula-Harshavardhan
left a comment
Contributor
There was a problem hiding this comment.
please help resolve the following.
…ve, streaming fence strip)
Abhinavexist
force-pushed
the
fix/openai-spec-compat-218
branch
from
July 21, 2026 00:07
823eb46 to
b7b4643
Compare
Collaborator
Author
Khurdhula-Harshavardhan
requested changes
Jul 21, 2026
Khurdhula-Harshavardhan
left a comment
Contributor
There was a problem hiding this comment.
please help resolve the following.
Collaborator
Author
|
Nit addressed in a835bb4: |
Khurdhula-Harshavardhan
approved these changes
Jul 22, 2026
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 #14. Consolidates the SDK-side reconciliation against server PR InterfazeAI/interfaze#218 (OpenAI 1:1 spec-compat, deploying). Supersedes #13 and #15.
Full audit: interfaze-py was checked against all six #218 fixes. Most SDK workarounds are backward-compat that no-op post-deploy (kept, not removed). Two items needed SDK changes:
1. Streaming
json_objectfence (deploy-independent bug)Non-stream
create()unwraps the```jsonfence Interfaze wrapsjson_objectoutput in, but the streaming path didn't:stream()discarded the strip flag and_State.build()never unwrapped it, soget_final_completion()leaked the fence.Fix: thread the strip flag from
stream()intoInterfazeStream/AsyncInterfazeStreamand applystrip_json_fenceinbuild(); scoped to the aggregated result (live-delta path untouched — incrementally-fenced JSON isn't a real usage). Movedstrip_json_fenceinto_stream.pyto avoid a circular import. Pre-#218 this fixes the current leak; post-#218 it no-ops on already-bare JSON.2.
max_completion_tokens+ models endpoints (#218 deploying)max_completion_tokens— #218 honors it as an alias formax_tokens(max_tokenswins if both set). Updated the README "Good to know" bullet that said to avoid it. No code change (params pass through);ChatInterfaze'sChatOpenAIrename is now honored, not a silent no-op.GET /v1/modelsthe OpenAI envelope and addsGET /v1/models/{id}. Addedtests/test_models.pylocking inmodels.list()(withowned_by),models.retrieve(), and the spec-shapedmodel_not_found404.Not changed (verified non-findings for Python)
delta.role: the accumulator already tolerates missing role; kept.choice.logprobs: openai-python defaults it toNone— never broke parsing.models.list()shape: openai-python parsed the old OpenRouter shape fine; #218 just enriches it.Tests
30 passing (streaming fence: stripped in
json_object, preserved otherwise, async; models: list/retrieve/not-found).ruff+mypy --strictclean.