Connect your AI · API key

Grok (xAI API)

Grok, with our tools.

  1. 1

    Install the SDK and set your xAI key.

    bash
    pip install openai
    export XAI_API_KEY=xai-…
  2. 2

    Run this. Replace YOUR_API_KEY with your key from the API keys page.

    python
    import os
    from openai import OpenAI
    
    client = OpenAI(api_key=os.environ["XAI_API_KEY"], base_url="https://api.x.ai/v1")
    resp = client.responses.create(
        model="grok-4.7",
        tools=[{
            "type": "mcp",
            "server_url": "https://jobs-api.arihaan.ai/mcp",
            "server_label": "arihaan-jobs",
            "authorization": "Bearer YOUR_API_KEY",
        }],
        input="Use Arihaan Jobs to find remote data engineer jobs posted in the last 7 days that list pay. Show the title, company, pay and apply link.",
    )
    print(resp.output_text)
Try this prompt

“Use Arihaan Jobs to find remote data engineer jobs posted in the last 7 days that list pay. Show the title, company, pay and apply link.”