xai

xAI: Grok 2

models/Grok 2

Grok 2 is xAI's frontier language model with state of the art reasoning capabilities, best for complex and multi step use cases. To use a faster version, see the (https://x.ai/blog/grok 2).
Currency$USD
Input$3.00
Output$15.00
Context window32.8K

Generate API Key Generate your API Key to securely access IndoxHub's AI models. Integrate with OpenAI-compatible tools, run queries, and build powerful AI applications — all with a single secure key.
Endpoint
POSThttps://api.indoxhub.com/api/v1/chat/completions
Configxai/grok-2
from indoxhub import Client
 
# Initialize the client
with Client(api_key="[LOGIN TO GET API KEY]") as client:
    # Generate a chat completion
    response = client.chat(
        messages=[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"What is machine learning and why is it important?"}],
        model="xai/grok-2",
        temperature:"0.7"
    )
 
    # Print the response
    print(response["data"])