Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function getModel() {
})
// Optionally, add a check for credit status or skip xAI if credits are exhausted
try {
return xai('grok-3-fast-beta')
return xai('grok-4-fast-non-reasoning')

Choose a reason for hiding this comment

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

Hard-coding the model ID makes future updates brittle and requires code changes to switch models. Consider making the model configurable (e.g., via an environment variable) and defaulting to grok-4-fast-non-reasoning. This improves maintainability and eases rollback if needed.

Suggestion

You could parameterize the model ID and provide a sensible default:

const modelId = process.env.XAI_MODEL ?? 'grok-4-fast-non-reasoning'
return xai(modelId)

Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this change.

Choose a reason for hiding this comment

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

Switching to a non-reasoning variant may change output quality/behavior (e.g., reasoning depth, tool-use capabilities, or structured output behavior). If the intent is performance/cost, consider a graceful in-provider fallback to the previous model before falling back to OpenAI to avoid surprising cross-provider differences when the new model is unavailable.

Suggestion

Add a secondary fallback to the previous xAI model before dropping to OpenAI:

try {
  return xai('grok-4-fast-non-reasoning')
} catch {
  try {
    return xai(process.env.XAI_FALLBACK_MODEL ?? 'grok-3-fast-beta')
  } catch {
    console.warn('xAI models unavailable, falling back to OpenAI:')
  }
}

Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this change.

} catch (error) {
console.warn('xAI API unavailable, falling back to OpenAI:')
}
Expand Down