{"id":23069319,"url":"https://github.com/mowhn/puterai-python_sdk","last_synced_at":"2025-07-16T07:40:51.227Z","repository":{"id":267310793,"uuid":"900864967","full_name":"mowhn/PuterAi-python_SDK","owner":"mowhn","description":"PuterAi Python SDK provides a simple way to interact with the Puter AI API for chatbot interactions and text-to-speech (TTS) generation. This SDK allows you to integrate chatbot and TTS functionalities into your own applications.","archived":false,"fork":false,"pushed_at":"2024-12-09T16:12:08.000Z","size":7,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T23:22:50.082Z","etag":null,"topics":["ai","api","app","puter","puter-sdk","python","sdk","tts"],"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/mowhn.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}},"created_at":"2024-12-09T16:01:20.000Z","updated_at":"2025-01-20T16:24:11.000Z","dependencies_parsed_at":"2024-12-09T16:55:27.551Z","dependency_job_id":null,"html_url":"https://github.com/mowhn/PuterAi-python_SDK","commit_stats":null,"previous_names":["mowhn/puterai-python_sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowhn%2FPuterAi-python_SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowhn%2FPuterAi-python_SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowhn%2FPuterAi-python_SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowhn%2FPuterAi-python_SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mowhn","download_url":"https://codeload.github.com/mowhn/PuterAi-python_SDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246981136,"owners_count":20863825,"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":["ai","api","app","puter","puter-sdk","python","sdk","tts"],"created_at":"2024-12-16T06:14:40.528Z","updated_at":"2025-04-03T09:45:42.327Z","avatar_url":"https://github.com/mowhn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# PuterAi-python_SDK\n\nPuterAi Python SDK provides a simple way to interact with the Puter AI API for chatbot interactions and text-to-speech (TTS) generation. This SDK allows you to integrate chatbot and TTS functionalities into your own applications.\n\n## Features\n\n- **Chatbot Interaction**: Communicate with a chatbot powered by Puter AI.\n- **Text-to-Speech (TTS)**: Convert any text into audio using AWS Polly TTS service.\n\n## Project Structure\n\nThe project consists of multiple components:\n\n- **`login.py`**: Script to handle user login and retrieve an API token for further requests.\n- **`cli.py`**: Command-line interface that allows users to interact with the Puter chatbot or generate TTS output.\n- **`server.py`**: A Flask-based API server that exposes endpoints for chatbot and TTS functionalities.\n- **`example.html`**: A simple HTML front-end to interact with the chatbot and generate TTS via a browser.\n\n## Requirements\n\nTo run this project, you need to install the following dependencies:\n\n- `requests`: To handle HTTP requests.\n- `flask`: For the API server.\n- `flask_cors`: For handling Cross-Origin Resource Sharing (CORS).\n- `dotenv`: To load environment variables from a .env file.\n\nYou can install the required dependencies with:\n\n```bash\npip install -r requirements.txt\n```\n\n## Setup Instructions\n\n1. **Clone the Repository**\n\n```bash\ngit clone https://github.com/mowhn/PuterAi-python_SDK.git\ncd puterAi-python_SDK\n```\n\n2. **Setup .env File in Both CLI and API Folders**\n\nCreate a `.env` file in both the `cli` and `API` directories and include your API_TOKEN:\n\n```env\nAPI_TOKEN=your_api_token_here\n```\n\n3. **Get the API Token**\n\nTo quickly obtain your `API_TOKEN`, you must first run `login.py` to log in and retrieve the token:\n\n- Run `login.py`:\n\n  ```bash\n  cd cli\n  python login.py\n  ```\n\n  This will prompt you for your username and password, and if the login is successful, it will output the `API_TOKEN`. You can copy this token and paste it into the `.env` file in both the `cli` and `API` folders.\n\n  **Note**: If you don't have a Puter AI account, you can sign up at \u003ca href=\"https://puter.com/?r=J1YOKLC5\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Sign%20Up%20for%20PuterAI-Click%20Here-brightgreen\" alt=\"Sign Up for PuterAI\" /\u003e\n\u003c/a\u003e\n\n4. **Running the Project**\n\n- Run the API Server:\n\n  ```bash\n  cd API\n  python server.py\n  ```\n\n  This will start the Flask API server on `http://localhost:5000`.\n\n- Use the Command-Line Interface (CLI):\n\n  To interact with the chatbot or generate TTS from the command line, run:\n\n  ```bash\n  cd cli\n  python cli.py\n  ```\n\n5. **Front-End Example**\n\nOpen the `example.html` file in a browser to interact with the Puter chatbot and generate TTS:\n\n- **Chat with the Bot**: Enter a message and receive a response from the bot.\n- **Generate TTS**: Enter text to convert into speech, and play the generated audio.\n\n## Endpoints\n\nThe Flask API exposes the following endpoints:\n\n- **POST `/chat`**: Accepts a JSON object with a `message` field and returns a bot response.\n\n  Example request:\n\n  ```json\n  {\n    \"message\": \"Hello, bot!\"\n  }\n  ```\n\n- **POST `/tts`**: Accepts a JSON object with a `text` field and returns the corresponding TTS audio.\n\n  Example request:\n\n  ```json\n  {\n    \"text\": \"Hello, this is a test.\"\n  }\n  ```\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/mowhn/PuterAi-python_SDK/blob/main/LICENSE) file for details.\n\n---\n\nEnjoy building with Puter!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmowhn%2Fputerai-python_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmowhn%2Fputerai-python_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmowhn%2Fputerai-python_sdk/lists"}