Skip to content

feat: re-export SDK model types and add item type aliases#17

Merged
mattapperson merged 3 commits intomainfrom
export-sdk-types
Apr 9, 2026
Merged

feat: re-export SDK model types and add item type aliases#17
mattapperson merged 3 commits intomainfrom
export-sdk-types

Conversation

@mattapperson
Copy link
Copy Markdown
Collaborator

Summary

  • Re-exports all 28 SDK types used in this package's public API (InputsUnion, OpenResponsesResult, EasyInputMessage, InputAudio, InputFile, etc.) so consumers don't need to install @openrouter/sdk separately just to annotate their variables
  • Adds clean item type aliases (Item, AssistantMessageItem, CallFunctionToolItem, ErrorItem, etc.) in src/lib/item-types.ts that provide user-friendly names over the raw SDK types

Test plan

  • pnpm run build passes (type-only exports, zero runtime impact)
  • All 218 unit tests pass
  • Verified re-exported types appear in built esm/index.d.ts

Consumers no longer need to depend on @openrouter/sdk directly to
annotate variables with types used in this package's public API.

- Re-export 28 SDK types (request/response, message, multimodal
  content, output items, error event) from the main entry point
- Add user-friendly item type aliases (Item, AssistantMessageItem,
  CallFunctionToolItem, etc.) via new src/lib/item-types.ts
- Use OutputFunctionCallItem (output) instead of FunctionCallItem (input)
  for CallFunctionToolItem
- Drop WithID from FunctionResultItem, FunctionProgressItem, and ErrorItem
  where it fabricated or narrowed id fields not matching runtime values
- Document WithID convention and Item union non-exhaustiveness
@mattapperson mattapperson merged commit bf6dca8 into main Apr 9, 2026
1 check passed
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.

1 participant