{"id":28165420,"url":"https://github.com/eniompw/free-llm-api-examples","last_synced_at":"2025-10-18T18:42:01.822Z","repository":{"id":288249804,"uuid":"967346496","full_name":"eniompw/Free-LLM-API-Examples","owner":"eniompw","description":"A collection of Python examples and resources for accessing free and alternative OpenAI-compatible LLM APIs.","archived":false,"fork":false,"pushed_at":"2025-04-23T13:43:08.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T14:36:24.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eniompw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-16T10:09:23.000Z","updated_at":"2025-04-23T13:43:12.000Z","dependencies_parsed_at":"2025-04-16T13:32:19.946Z","dependency_job_id":"e43806b8-9ec6-42b0-956c-f4fe1ab85b3f","html_url":"https://github.com/eniompw/Free-LLM-API-Examples","commit_stats":null,"previous_names":["eniompw/free-llm-api-examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eniompw%2FFree-LLM-API-Examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eniompw%2FFree-LLM-API-Examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eniompw%2FFree-LLM-API-Examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eniompw%2FFree-LLM-API-Examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eniompw","download_url":"https://codeload.github.com/eniompw/Free-LLM-API-Examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337567,"owners_count":22054254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-05-15T12:11:31.482Z","updated_at":"2025-10-18T18:42:01.802Z","avatar_url":"https://github.com/eniompw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Free-LLM-API-Examples\n\n## Overview\n\nThis repository provides examples of how to interact with various Large Language Model APIs that are either free to use (with certain limitations) or provide alternatives to the official OpenAI services. All of these APIs follow the OpenAI API format, making them easy to integrate into existing applications.\n\n## Table of Contents\n- [Overview](#overview)\n- [Requirements](#requirements)\n- [Provider Integrations](#provider-integrations)\n- [Usage](#usage)\n- [Usage Tips](#usage-tips)\n- [Disclaimer](#disclaimer)\n\n\n## Requirements\n\n- Python 3.x\n- `requests` library (install with `pip install requests`)\n\n## Provider Integrations\n\n| Provider     | Endpoint URL                                           | Notes                                  | Example                                              |\n|--------------|--------------------------------------------------------|----------------------------------------|------------------------------------------------------|\n| OpenRouter   | https://openrouter.ai/api/v1/chat/completions         | Provides access to multiple models     | [Python REST Example](rest.py)                       |\n| Chutes       | https://llm.chutes.ai/v1/chat/completions             | Free tier available                    | [Chutes Example](https://github.com/eniompw/Chutes-API/blob/main/rest.py) |\n| Groq         | https://api.groq.com/openai/v1/chat/completions       | Known for fast inference               | [Groq Example](https://github.com/eniompw/GroqGPT/blob/main/rest.py)    |\n| Azure AI     | https://models.inference.ai.azure.com/chat/completions | Microsoft's AI services                                                          |\n| Mistral AI   | https://api.mistral.ai/v1/chat/completions            | Offers various Mistral models          | [Mistral Example](https://github.com/eniompw/Mistral/blob/main/rest.py) |\n| NVIDIA       | https://integrate.api.nvidia.com/v1/chat/completions  | NVIDIA AI platform                     | [NVIDIA Example](https://github.com/eniompw/NVIDIA-NIM/blob/main/rest.py) |\n| SambaNova    | https://fast-api.snova.ai/v1/chat/completions         | Fast API service                       | [SambaNova Example](https://github.com/eniompw/SambaNovaREST/blob/main/rest.py) |\n| Tavily       | https://tavily.com                                     | Free Search API: 1,000 API credits/month, no credit card required                                           |\n| Pixtral      | n/a                                                    | Multimodal image \u0026 text                | [Pixtral Example](https://github.com/eniompw/Pixtral/blob/main/app.py)  |\n| Google Gemini| n/a                                                    | Google's Gemini models                 | [Gemini Example](https://github.com/eniompw/GeminiAPI/blob/main/dev/rest.py) |\n\n### Usage\n\nThese endpoints generally follow the OpenAI API format. Use with appropriate authentication as required by each provider.\n\n```python\nimport requests\nimport os\n\nurl = \"https://openrouter.ai/api/v1/chat/completions\"\nheaders = {\"Authorization\": \"Bearer \" + os.environ.get(\"API_KEY\", \"\")}\nquery = \"In one word, what is the capital of France?\"\ndata = {\"messages\": [{\"role\": \"user\", \"content\": query}], \"model\": \"deepseek/deepseek-chat-v3-0324:free\"}\nresponse = requests.post(url, headers=headers, json=data)\n\nif response.status_code == 200:\n    print(\"Response:\", response.json()[\"choices\"][0][\"message\"][\"content\"])\nelse:\n    print(\"Error:\", response.status_code, response.text)\n```\n\nRefer to `llm_quickstart.py` for a complete script and additional provider examples.\n\n## Usage Tips\n\n- Set your API key environment variable:\n  ```bash\n  export API_KEY=\"your_api_key_here\"\n  ```\n- Adapt endpoints to other providers by updating the URL and model parameters.\n- Watch out for rate limits and monitor your provider’s quotas.\n- Some services require region or resource-specific endpoint configuration (e.g., Azure).\n\n## Disclaimer\n\nThis repository is not affiliated with OpenAI or any of the API providers listed. Service availability, pricing, and terms may change over time. Always refer to the official documentation of each provider.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feniompw%2Ffree-llm-api-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feniompw%2Ffree-llm-api-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feniompw%2Ffree-llm-api-examples/lists"}