-
Notifications
You must be signed in to change notification settings - Fork 81
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
grok provider #105
base: main
Are you sure you want to change the base?
grok provider #105
Conversation
I really don't want to have dozens of OpenAI-compatible providers. Instead, it would be neat to set the OpenAI API URL per model config instead (it is already possible to set it globally https://github.com/kharvd/gpt-cli?tab=readme-ov-file#customize-openai-api-url) |
Agree that proliferation of interfaces should be avoided. How would this handle the different model names/prices though? |
Model names are currently handled through the |
feat: Add support for xAI's grok
This PR adds support for xAI's grok models via their OpenAI-compatible API. Since the xAI API is compatible with the OpenAI SDK, this implementation extends the existing OpenAI provider.
The xAI documentation provides an example of using the OpenAI Python SDK:
To facilitate code reuse and accommodate xAI's pricing structure, the OpenAI provider interface was slightly modified to move pricing logic into the class itself.
This change allows for seamless integration with xAI while maintaining compatibility with existing OpenAI models. Pricing for
grok-beta
andgrok-2
models has been included.Tested and working (see attached screenshot).