Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/abhayp111_abhayp111.json
T

1 line
1.6 KiB
JSON

{"repo": "abhayp111/abhayp111", "files": {"llm2.py": {"ae94929e6fbd16d26cbb55e0ca833f1d48cd345d": {"t": 1785674522.7708733, "n": 1403, "h": "32dd3e6c9562a898", "c": "import requests\n\n# Replace this with your actual OpenRouter API key\nOPENROUTER_API_KEY = \"sk-...\" # ← Replace with your real key\n\n# Set up headers\nheaders = {\n \"Authorization\": f\"Bearer {\"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\"}\",\n \"Content-Type\": \"application/json\",\n}\n\n# Prepare the prompt and payload\nprompt = \"Generate a quiz on the topic 'Physics' with 3 questions. Provide each question as a JSON object with keys: 'question', 'options', and 'answer'. Return a JSON array.\"\npayload = {\n \"model\": \"mistralai/mistral-7b-instruct\", # You can try \"mistralai/mistral-7b-instruct\" if unsure\n \"messages\": [{\"role\": \"user\", \"content\": prompt}]\n}\n\n# Send POST request to OpenRouter\ntry:\n response = requests.post(\n \"https://openrouter.ai/api/v1/chat/completions\",\n headers=headers,\n json=payload,\n timeout=20\n )\n\n print(f\"Status Code: {response.status_code}\")\n print(f\"Response Text:\\n{response.text}\")\n print(f\"Headers Sent: {headers}\")\n print(f\"Payload Sent: {payload}\")\n\n if response.status_code == 200:\n content = response.json()[\"choices\"][0][\"message\"][\"content\"]\n print(\"\\nLLM Response Content:\\n\", content)\n else:\n print(f\"\\nError occurred: {response.status_code} - {response.text}\")\n\nexcept requests.exceptions.RequestException as e:\n print(f\"RequestException: {str(e)}\")\n"}}}}