Skip to content

Add a support for Grok-4 from x.ai #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rebel1324
Copy link
Contributor

Summary

  • Adding a support for Grok-4 model by adding "xai" as a provider

Changes

  • Adding "xai" provider
  • Adding "Grok-4" model (provider: xai, model-id: "grok-4-latest")

Added Config

{
    provider = "xai",
    name = "Grok-4",
    chat = false,
    command = true,
    -- string with model name or table with model name and parameters
    model = { model = "grok-4-latest", temperature = 0 },
    system_prompt = require("gp.defaults").code_system_prompt,
},

Note

  • the response has been tested for some coding assignments.
  • The reponse time is very slow (approx 1-2 seconds), compared to other model provider.
  • the temperature parameter configuration was brought from the default curl example that x.ai provided.
  • the pricing of grok-4 is input for $3/mil, output for $15/mil.
  • If requested, I can add grok-3 (same pricing, but if you want to) and grok-3 mini (more cheaper) in configuration.

@rebel1324 rebel1324 changed the title Add a support for x.ai Grok-4 Add a support for Grok-4 from x.ai Aug 14, 2025
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