Skip to content

feat(xai): expose explicit Responses API routing via xai_api provider option#699

Merged
mikehostetler merged 1 commit into
agentjido:mainfrom
valiot:xai-api-override
May 14, 2026
Merged

feat(xai): expose explicit Responses API routing via xai_api provider option#699
mikehostetler merged 1 commit into
agentjido:mainfrom
valiot:xai-api-override

Conversation

@acrogenesis
Copy link
Copy Markdown
Contributor

Description

Add xai_api: :auto | :chat | :responses provider option so callers can force xAI's /responses endpoint without enabling a built-in web_search / x_search tool. Default :auto preserves the existing behavior.

use_responses_api?/1 now reads xai_api and xai_tools from both the top level and :provider_options, so the toggle works on the streaming path too (Options.process!/4 re-nests provider-schema keys before they reach attach_stream).

Adds a guides/xai.md entry under Provider Options and 4 tests for the routing-override matrix.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Breaking Changes

Testing

  • Tests pass (mix test)
  • Quality checks pass (mix quality)

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation accordingly
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • My commits follow conventional commit format
  • I have NOT edited CHANGELOG.md (it is auto-generated by git_ops)

Related Issues

Closes #

… option

`use_responses_api?/1` only flipped to `/responses` as a side effect of
including xAI's built-in tools (web_search/x_search). Multi-turn
reasoning loops with custom function tools benefit from the stateful
Responses endpoint too — `previous_response_id` threads reasoning
across turns so Grok-4 family models keep "thinking" through a tool
round-trip rather than restarting fresh in each Chat Completions call.

Add `xai_api: :auto | :chat | :responses` (default `:auto` preserves
the existing built-in-tool behavior). `:responses` forces the
Responses endpoint regardless of which tools are present; `:chat` is
the explicit override the other direction.

Verified end-to-end with a probe: Grok 4.3 + reasoning_effort: medium
+ tool_choice: required completes a two-turn fetch_changed_files →
post_review loop natively on /responses but stalls after the first
tool call on /chat/completions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mikehostetler mikehostetler added needs_work Changes requested before merge ready_to_merge and removed needs_work Changes requested before merge labels May 14, 2026
@mikehostetler mikehostetler merged commit 7727168 into agentjido:main May 14, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants