Skip to content

chore(gen)!: render BYOK/TTS/STT as initialisms in generated symbols - #716

Merged
christineschen merged 10 commits into
mainfrom
devin/1785338548-initialism-casing
Jul 30, 2026
Merged

chore(gen)!: render BYOK/TTS/STT as initialisms in generated symbols#716
christineschen merged 10 commits into
mainfrom
devin/1785338548-initialism-casing

Conversation

@christineschen

@christineschen christineschen commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

The OpenAPI tags are already BYOK / TTS / STT, but Speakeasy re-cases single all-caps tokens, so generated symbols came out as Byok, Tts, Stt. The fix is generator config, not a hand edit: customCasings declares terms whose PascalCase form must stay all-caps.

 typescript:
   version: 1.2.0
+  customCasings:
+    byok:
+      initialism: true
+    stt:
+      initialism: true
+    tts:
+      initialism: true

Regenerated with the pinned speakeasyVersion (1.787.0), which renames the sub-SDK classes (class Byokclass BYOK, TtsTTS, SttSTT, modules stay src/sdk/byok.ts etc.) and the ApiType enum keys.

Unchanged: accessors (openrouter.byok, .tts, .stt), camelCase properties (isByok, includeByokInLimit), and every wire value/JSON name — only pascal casing feeds generated symbol names.

Breaking for source consumers

ApiType is 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.Stt and direct imports of the Byok/Tts/Stt classes stop compiling; ApiType.TTS / ApiType.STT replace them. Worth calling out in release notes.

Also included

tests/e2e/embeddings.test.ts asserted that input: '' succeeds, but openrouter-web#30855 tightened the embeddings schema to z.string().min(1), so the live API now returns 400 and the validate job failed on every typescript-sdk PR (including Speakeasy's own regen branches). The test now asserts the current contract:

it('should reject an empty string input', async () => {
  await expect(client.embeddings.generate({ requestBody: { input: '', model: 'openai/text-embedding-3-small' } }))
    .rejects.toThrow(BadRequestResponseError);
});

This supersedes #723.

Scope note: ApiAPI was deliberately left alone (APIKeys already renders correctly since the tag is API Keys; renaming ApiType and friends would be a much wider change). Matching python-sdk PR (merged): OpenRouterTeam/python-sdk#561 · go-sdk (merged): OpenRouterTeam/go-sdk#480

Version 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. Local pnpm run typecheck, eslint, and the unit suite pass.

BREAKING CHANGE: ApiType.Tts and ApiType.Stt are renamed to ApiType.TTS and ApiType.STT (enum values "tts"/"stt" unchanged), and the deep-importable sub-SDK classes Byok/Tts/Stt are renamed to BYOK/TTS/STT. Runtime behaviour, JSON field names, and the openrouter.byok/.tts/.stt accessors are unchanged.

Link to Devin session: https://openrouter.devinenterprise.com/sessions/236b5466ec42476c8645101ef5bcd17f
Requested by: @christineschen

@christineschen christineschen self-assigned this Jul 29, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from christine.chen

SYSTEM:
=== BEGIN THREAD HISTORY ===
<most_recent_message>
Christine Chen (U0B8QM7RKLL): create a pr to fix this

[Slack unfurl — this is an automatic link preview, not a user message]
Quote of conversation (https://openrouter.slack.com/archives/C0BCDN7RHJM/p1785278350731749?thread_ts=1785278350.731749&amp;cid=C0BCDN7RHJM):
> From David Bai
> <@U0B8QM7RKLL> non urgent nit but would it be a problem to update our client sdks to use initialism for BYOK, TTS, STT etc? At first I thought it was just a docs change but looks like need to update speakeasy configs and not sure if theres any implications there
> Posted on July 28, 2026 at 10:39 PM

</most_recent_message>
=== END THREAD HISTORY ===

Thread URL: https://openrouter.slack.com/archives/D0B9SPV4LV9/p1785338154566759?thread_ts=1785338154.566759&amp;cid=D0B9SPV4LV9

The latest message is the one right above that tagged you. The <most_recent_message> is the message that you should use to guide your goals + task for this session, and you should use the rest of the slack thread as context.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 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

@mintlify

mintlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
openrouter-production 🟡 Building Jul 29, 2026, 3:22 PM

@mintlify

mintlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
openrouter-staging 🟡 Building Jul 29, 2026, 3:22 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review July 29, 2026 18:01

@perry-the-pr-reviewer perry-the-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (ByokBYOK, TtsTTS, SttSTT), 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.TtsApiType.TTS and ApiType.SttApiType.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.

Comment thread src/models/generationresponse.ts
@mintlify

mintlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
openrouter-production 🟡 Building Jul 30, 2026, 3:07 PM

@mintlify

mintlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
openrouter-staging 🟡 Building Jul 30, 2026, 3:07 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@kimblekabrain607-wq kimblekabrain607-wq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devin-ai-integration devin-ai-integration Bot changed the title chore(gen): render BYOK/TTS/STT as initialisms in generated symbols chore(gen)!: render BYOK/TTS/STT as initialisms in generated symbols Jul 30, 2026
devin-ai-integration Bot and others added 3 commits July 30, 2026 19:25
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.
@christineschen
christineschen merged commit 60545a7 into main Jul 30, 2026
1 check passed
@christineschen
christineschen deleted the devin/1785338548-initialism-casing branch July 30, 2026 19:37
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