Skip to content

Conversation

@bledden
Copy link

@bledden bledden commented Dec 21, 2025

Summary

Fixes #98

The embeddings endpoint has a text/event-stream response type in the OpenAPI spec, but the spec itself says:

"Not used for embeddings - embeddings do not support streaming"

This unused response type causes Speakeasy to generate:

type CreateEmbeddingsResponse = CreateEmbeddingsResponseBody | string;

Which forces developers to write unnecessary type guards:

if (typeof embedding === "string") {
  throw new Error("Invalid embedding response");  // Never happens
}

Changes

Removed the unused text/event-stream response from .speakeasy/in.openapi.yaml.

After Regeneration

After regenerating with Speakeasy, the type will be:

type CreateEmbeddingsResponse = CreateEmbeddingsResponseBody;

Allowing clean access: response.data[0].embedding

Note

This PR only updates the OpenAPI spec. The maintainers will need to regenerate with Speakeasy to update the TypeScript types.

🤖 Generated with Claude Code

…penRouterTeam#98)

The embeddings endpoint had a text/event-stream response type defined in
the OpenAPI spec, but the spec itself noted: "Not used for embeddings -
embeddings do not support streaming."

This unused response type caused Speakeasy to generate:
  type CreateEmbeddingsResponse = CreateEmbeddingsResponseBody | string;

Which forces developers to write unnecessary type guards.

After regenerating with Speakeasy, the type will be:
  type CreateEmbeddingsResponse = CreateEmbeddingsResponseBody;

Allowing direct access to response.data[0].embedding without checking
if the response is a string first.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

CreateEmbeddingsResponse has confusing type structure

1 participant