gp.nvim icon indicating copy to clipboard operation
gp.nvim copied to clipboard

Add a support for Grok-4 from x.ai

Open rebel1324 opened this issue 5 months ago • 0 comments

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 avatar Aug 14 '25 13:08 rebel1324