Skip to content

fix: declare a JSON 200 for intern chat so the Python SDK compiles - #875

Merged
louisgv merged 1 commit into
mainfrom
devin/1789699797-intern-chat-sse-overload
Sep 18, 2026
Merged

louisgv merged 1 commit into
mainfrom
devin/1789699797-intern-chat-sse-overload

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Every "Generate (spec change merged)" run since the intern chat endpoint landed (openrouter-web#43374, spec update #867) fails in Compile SDK, so no Python release has shipped since 1.1.156 and Decisions is missing from PyPI and the Python docs:

src/openrouter/interns.py:2060: Incompatible return value type (got "EventStream[InternChatCompletionChunk]", expected "InternChatCompletionChunk")

createInternChatCompletion is the only operation in the spec whose 200 declares text/event-stream alone. With sseFlatResponse: true, the Python generator (pinned 1.787.0) annotates chat() as returning the flattened chunk while emitting an EventStream body. TypeScript and Go generate the same operation correctly.

This adds a Python-only overlay that declares an application/json sibling on that 200 pointing at the same InternChatCompletionChunk schema. The generator then produces the supported SSE-overload shape:

def chat(...) -> Union[components.InternChatCompletionChunk, eventstreaming.EventStream[components.InternChatCompletionChunk]]

Runtime behaviour is unchanged (stream=True is required, the server always streams). The public spec stays SSE-only, so the TS and Go SDKs are untouched. Supersedes openrouter-web#44455, which made the same change in the public spec and would have widened the TS return type.

Tried and rejected: x-speakeasy-sse-overload: false on the operation and inferSSEOverload: false in gen.yaml both leave the error in place with 1.787.0, so the trigger is the flat SSE response path, not overload inference.

Note: merging this does not trigger generation on its own (that workflow filters on in.openapi.yaml). The nightly Generate run or a manual workflow_dispatch will produce the release PR.

Verification

speakeasy run -t open-router --skip-versioning with the pinned 1.787.0 on this branch: generation succeeds, mypy src/openrouter and pyright src/openrouter report no issues (902 files). Same command on main reproduces the CI error.

Searched existing PRs: none address this.

Link to Devin session: https://openrouter.devinenterprise.com/sessions/3f706d7e7e6f4a1dbe42eef374519a68
Open in Devin Desktop: https://openrouter.devinenterprise.com/desktop/session/3f706d7e7e6f4a1dbe42eef374519a68?variant=devin
Requested by: @christineschen

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Christine

SYSTEM:
<latest_message>
Christine Chen (U0B8QM7RKLL) [ts=1789686258.156009]: @Devin look into why ts and python sdks aren't enabled
</latest_message>

=== BEGIN THREAD HISTORY (in #proj-jev) ===
Abhinav Pola (U090K0G7JF3) [ts=1789682735.294299]: LETSSS GOOO
&gt; Real request works. typesafe/jev-1.13 → HTTP 200, provider TypeSafe, one noul answer (0.97), usage 289 in / 21 out, cost 0.000012138 (exactly 289 × 4.2e-8, so pricing is live). Same result for the dated permaslug.

Jacky Liang (U0AUY9BQV18) [ts=1789682862.355109]: this is on openrouter yeah?

Abhinav Pola (U090K0G7JF3) [ts=1789682867.572409]: yup

Abhinav Pola (U090K0G7JF3) [ts=1789682874.528679]: private endpoint (only our org can use it)

Ayush Patel (U0B8L6RNMA9) [ts=1789683251.473799]: aside i wonder why they opted for that model naming, i hope they dont just release a shit ton of minor versions

they do jev-latest in their docs maybe to point people to not use jev-1.13 specifically

ATTACHMENT:"https://openrouter.devinenterprise.com/attachments/f9f4910c-8f9f-44d9-af01-1e4b663826f9/image.png"

Louis Vichy (U0ACWETHNLT) [ts=1789683500.173969]: @Abhinav Pola btw what's the SDK looking like?

Louis Vichy (U0ACWETHNLT) [ts=1789683518.815939]: do we have the SDK gen for alpha API hooked up or is that... a separate hurdle

Abhinav Pola (U090K0G7JF3) [ts=1789683698.072549]: just saw this <https://openrouter.ai/docs/client-sdks/go/sdks/decisions/README`#`decisions>

Louis Vichy (U0ACWETHNLT) [ts=1789685494.257079]: Weird, so go works, but TS and Python isn't?..

Abhinav Pola (U090K0G7JF3) [ts=1789685510.082919]: i'm not sure what went wrong

Abhinav Pola (U090K0G7JF3) [ts=1789685522.539739]: docs arent showing up either

Louis Vichy (U0ACWETHNLT) [ts=1789685523.518409]: cc @Christine Chen do you know why the TS and Python are not being enabled

Christine Chen (U0B8QM7RKLL) [ts=1789686242.551129]: hmm I'm not sure, t... (742 chars truncated...)

@louisgv
louisgv marked this pull request as ready for review September 18, 2026 02:56
@louisgv
louisgv merged commit df46b87 into main Sep 18, 2026
1 check passed
@louisgv
louisgv deleted the devin/1789699797-intern-chat-sse-overload branch September 18, 2026 02:56
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