chore(gen)!: render BYOK/TTS/STT as initialisms in generated symbols - #716
Conversation
Original prompt from christine.chen
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
Perry's Review
Verdict: 💬 Comments / questions
Risk: 🟡 Medium
Details
Summary
This PR adds customCasings to the Speakeasy generator config (gen.yaml) to render BYOK/TTS/STT as initialisms in generated TypeScript symbols. The regenerated code is clean and consistent — all class names (Byok→BYOK, Tts→TTS, Stt→STT), imports, type annotations, and enum keys are updated with zero dangling references to the old names. Public accessor properties (openrouter.byok, .tts, .stt) and enum string values ("tts", "stt") are correctly preserved.
Breaking change: ApiType enum keys (see inline)
ApiType.Tts → ApiType.TTS and ApiType.Stt → ApiType.STT is a source-level breaking change. ApiType is publicly exported through the SDK's models entry point. The PR body says "one enum member key" changed — it's actually two.
CI failure (pre-existing, unrelated to this PR)
The validate check fails on the e2e embeddings test — the "should handle empty string input gracefully" test sends input: '' to the live OpenRouter embeddings API, which now rejects it with a Zod validation error ("Too small: expected string to have >=1 characters"). This test is not modified by this PR and the failure is entirely unrelated to the BYOK/TTS/STT rename. It should be fixed separately (update the test to expect the 400 error, or skip it).
Stale PR body
The PR body states the version bump as "1.1.19 → 1.1.20", but the actual diff shows "1.1.21 → 1.1.22" — the PR was rebased/merged with main multiple times, picking up intermediate SDK regenerations. Consider updating the body to match the current state.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
The generator would have published this as a patch (1.1.25) even though the ApiType enum keys rename is source-breaking; pinning the version in gen.yaml makes the minor bump explicit. Regeneration also picks up main's SCIM spec update.
Summary
The OpenAPI tags are already
BYOK/TTS/STT, but Speakeasy re-cases single all-caps tokens, so generated symbols came out asByok,Tts,Stt. The fix is generator config, not a hand edit:customCasingsdeclares terms whose PascalCase form must stay all-caps.Regenerated with the pinned
speakeasyVersion(1.787.0), which renames the sub-SDK classes (class Byok→class BYOK,Tts→TTS,Stt→STT, modules staysrc/sdk/byok.tsetc.) and theApiTypeenum keys.Unchanged: accessors (
openrouter.byok,.tts,.stt), camelCase properties (isByok,includeByokInLimit), and every wire value/JSON name — onlypascalcasing feeds generated symbol names.Breaking for source consumers
ApiTypeis re-exported from@openrouter/sdk/models, and two of its keys change (the values don't):export const ApiType = { - Tts: "tts", - Stt: "stt", + TTS: "tts", + STT: "stt", } as const;So
ApiType.Tts/ApiType.Sttand direct imports of theByok/Tts/Sttclasses stop compiling;ApiType.TTS/ApiType.STTreplace them. Worth calling out in release notes.Also included
tests/e2e/embeddings.test.tsasserted thatinput: ''succeeds, but openrouter-web#30855 tightened the embeddings schema toz.string().min(1), so the live API now returns 400 and thevalidatejob failed on every typescript-sdk PR (including Speakeasy's own regen branches). The test now asserts the current contract:This supersedes #723.
Scope note:
Api→APIwas deliberately left alone (APIKeysalready renders correctly since the tag isAPI Keys; renamingApiTypeand friends would be a much wider change). Matching python-sdk PR (merged): OpenRouterTeam/python-sdk#561 · go-sdk (merged): OpenRouterTeam/go-sdk#480Version is hand-set to 1.2.0 in
gen.yaml(Speakeasy honours a custom version:versioning: custom SDK version detected), since the generator would otherwise have shipped this source break as a patch. Localpnpm run typecheck,eslint, and the unit suite pass.BREAKING CHANGE:
ApiType.TtsandApiType.Sttare renamed toApiType.TTSandApiType.STT(enum values"tts"/"stt"unchanged), and the deep-importable sub-SDK classesByok/Tts/Sttare renamed toBYOK/TTS/STT. Runtime behaviour, JSON field names, and theopenrouter.byok/.tts/.sttaccessors are unchanged.Link to Devin session: https://openrouter.devinenterprise.com/sessions/236b5466ec42476c8645101ef5bcd17f
Requested by: @christineschen