{"id":15844167,"url":"https://github.com/xtuc/ai-talk-demo","last_synced_at":"2026-02-24T08:03:42.582Z","repository":{"id":228585321,"uuid":"774391397","full_name":"xtuc/ai-talk-demo","owner":"xtuc","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-19T13:37:25.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T11:34:36.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xtuc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-19T13:22:05.000Z","updated_at":"2024-03-19T13:37:29.000Z","dependencies_parsed_at":"2024-03-19T14:53:23.708Z","dependency_job_id":"24019d7d-6f7d-49d0-8473-87d5fcf1479d","html_url":"https://github.com/xtuc/ai-talk-demo","commit_stats":null,"previous_names":["xtuc/ai-talk-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xtuc/ai-talk-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtuc%2Fai-talk-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtuc%2Fai-talk-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtuc%2Fai-talk-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtuc%2Fai-talk-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtuc","download_url":"https://codeload.github.com/xtuc/ai-talk-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtuc%2Fai-talk-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29775835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T17:20:29.805Z","updated_at":"2026-02-24T08:03:42.547Z","avatar_url":"https://github.com/xtuc.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Workers AI demo\n\n\n## Ask Llama to generate a prompt\n\n```python\nimport requests\nimport os\n\nendpoint = \"https://api.cloudflare.com/client/v4/accounts/85d0c02b57ed75faf9b18f92d5c01602/ai/run\"\nurl = \"{endpoint}/@cf/meta/llama-2-7b-chat-int8\".format(endpoint=endpoint)\n\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Authorization\": \"Bearer {token}\".format(token=os.getenv(\"API_TOKEN\"))\n}\n\npayload = {\n  \"messages\": [\n    {\n        \"role\": \"system\",\n        \"content\":\n            \"You are a simple and creative assistant that writes a prompt for a stable diffusion model, in a realistic and HD style.\"\n            \"Reply with the prompt only, avoid 'Here is the prompt...', double quotes and 'Prompt: '.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"cute black and gray cat that looks a bit mad at you and is skinny\"\n    },\n  ]\n}\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\nresponse.raise_for_status()\n\nprompt = response.json()[\"result\"][\"response\"]\nprint(\"Prompt: \" + prompt)\n```\n\n## Generate the image\n\n```py\nurl = \"{endpoint}/@cf/bytedance/stable-diffusion-xl-lightning\".format(endpoint=endpoint)\npayload = {\n    \"prompt\": prompt\n}\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\nresponse.raise_for_status()\n\nwith open(\"out.png\", 'wb') as f:\n    f.write(response.content)\n```\n\n## Create an AI gateway\n\nhttps://dash.cloudflare.com/85d0c02b57ed75faf9b18f92d5c01602/ai/ai-gateway\n\n## Change the endpoint to AI gateway\n\n```\nendpoint = \"https://gateway.ai.cloudflare.com/v1/85d0c02b57ed75faf9b18f92d5c01602/ai-talk-3/workers-ai\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtuc%2Fai-talk-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtuc%2Fai-talk-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtuc%2Fai-talk-demo/lists"}