Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/ant-vu_llm-apis.json
T

1 line
1.1 KiB
JSON

{"repo": "ant-vu/llm-apis", "files": {"grok.py": {"f75a2476af79523fca4d0b085474fe438e42a24a": {"t": 1785674552.9791672, "n": 863, "h": "c0679dabada5966e", "c": "# In your terminal, first run:\n# pip install openai\n\nimport os\nfrom openai import OpenAI\n\nXAI_API_KEY = os.getenv(\"XAI_API_KEY\")\nimage_url = \"https://science.nasa.gov/wp-content/uploads/2023/09/web-first-images-release.png\"\n\nclient = OpenAI(\n api_key=XAI_API_KEY,\n base_url=\"https://api.x.ai/v1\",\n)\n\nmessages = [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": image_url,\n \"detail\": \"high\",\n },\n },\n {\n \"type\": \"text\",\n \"text\": \"What's in this image?\",\n },\n ],\n },\n]\n\ncompletion = client.chat.completions.create(\n model=\"grok-2-vision-latest\",\n messages=messages,\n temperature=0.01,\n)\nprint(completion.choices[0].message.content)"}}}}