Roo-Code/packages/types
Enrico Carlesso 03fb47c27f feat: migrate xAI provider to Responses API with reusable transform utilities
Migrate the xAI provider from the deprecated Chat Completions API to the
Responses API, add grok-4.20 as the new default model, and introduce shared
transform utilities for Responses API that other providers can adopt.

New shared utilities (src/api/transform/):
- responses-api-stream.ts: processResponsesApiStream() handles core
  Responses API stream events (text, reasoning, tool calls, usage) and
  createUsageNormalizer() provides configurable token/cost extraction.
  Designed for reuse by openai-native, openai-codex, or any future
  Responses API provider.
- responses-api-input.ts: convertToResponsesApiInput() converts directly
  from Anthropic message format to Responses API input format, avoiding
  the intermediate Chat Completions conversion step. Handles input_text,
  input_image, function_call, and function_call_output mappings.

xAI provider (src/api/providers/xai.ts):
- Switch from client.chat.completions.create() to client.responses.create()
- Use shared transform utilities for stream handling and input conversion
- Enable reasoning traces via include: ["reasoning.encrypted_content"]
- System prompt via instructions field, store: false for privacy
- completePrompt() also migrated to Responses API

Model updates (packages/types/src/providers/xai.ts):
- Add grok-4.20 as the new default model (2M context, $2/$6 pricing)
- Remove grok-4.20-beta-0309-reasoning and grok-4.20-beta-0309-non-reasoning
2026-03-19 16:10:54 -07:00
..
npm Release: v1.115.0 (#11833) 2026-03-02 13:35:52 -08:00
scripts Fix publish-npm script (#7093) 2025-08-14 03:17:56 -07:00
src feat: migrate xAI provider to Responses API with reusable transform utilities 2026-03-19 16:10:54 -07:00
.gitignore Task metadata (#7092) 2025-08-14 03:14:17 -07:00
eslint.config.mjs Task metadata (#7092) 2025-08-14 03:14:17 -07:00
package.json feat: add AI SDK dependencies and message conversion utilities (#11047) 2026-01-28 14:05:53 -05:00
tsconfig.json Task metadata (#7092) 2025-08-14 03:14:17 -07:00
tsup.config.ts Bump @roo-code/types to v1.42.0 (#6610) 2025-08-02 13:27:59 -07:00
vitest.config.ts Convert jest tests to vitest and disable default watch mode for vitest (#4568) 2025-06-11 14:48:01 -07:00