# The official Python library for the ShuttleAI API
Access the ShuttleAI API with a simple, user-friendly lib; or a sleek command line interface (CLI)
> *PRs appreciated 🙂*
# Installation
## ShuttleAI
[![pypi](https://img.shields.io/pypi/v/shuttleai.svg?color=blue)](https://pypi.org/project/shuttleai/)
```ShellSession
pip install shuttleai
```
## ShuttleAI CLI
```ShellSession
pip install shuttleai[cli]
```
# Usage
## ShuttleAI CLI
```ShellSession
shuttleai
```
*That's it! Just type `shuttleai` in your terminal!*
## ShuttleAI
> [!IMPORTANT]
> It is strongly recommended to use the asynchronous client instead of the synchronous client.
```py
import asyncio
from shuttleai import *
SHUTTLE_KEY = "ShuttleAPI Key"
async def main():
async with ShuttleAsyncClient(SHUTTLE_KEY, timeout=60) as shuttle:
"""Optionally change base url"""
# shuttle.base_url = "https://api.shuttleai.app/v1"
"""Get Models Example"""
# response = await shuttle.get_models()
# print(response)
"""Get Model Example"""
# response = await shuttle.get_model("gpt-4")
# print(response)
"""Streaming Example"""
# response = await shuttle.chat_completion(
# model="gpt-3.5-turbo",
# messages="write me a short story about bees",
# stream=True,
# plain=True,
# internet=False
# )
# async for chunk in response:
# print(chunk.choices[0].delta.content)
"""Non-Streaming Example"""
# response = await shuttle.chat_completion(
# model="gpt-3.5-turbo",
# messages=[{"role":"user","content":"write me a short story about bees"}],
# stream=False,
# plain=False,
# internet=False,
# max_tokens=100,
# temperature=0.5,
# image="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
# )
# print(response)
"""Image Generation Example"""
# response = await shuttle.images_generations(
# model='sdxl',
# prompt='a cute cat',
# n=1,
# )
# print(response)
"""Audio Generation Example"""
# response = await shuttle.audio_generations(
# model='eleven-labs-999',
# input='Once upon a time, there was a cute cat wondering through a dark, cold forest.',
# voice="mimi"
# )
# print(response)
"""Audio Transcription Example"""
# response = await shuttle.audio_transcriptions(
# model='whisper-large',
# file="test.mp3"
# )
# print(response)
"""Moderation Example"""
# response = await shuttle.moderations(
# model='text-moderation-latest',
# input="I hate you"
# )
# print(response)
"""Embeddings Example"""
# response = await shuttle.embeddings(
# model='text-embedding-ada-002',
# input="Hello there world"
# )
# print(response)
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/shuttleai/shuttleai-python",
"name": "shuttleai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "shuttleai, ai, gpt, claude, api, free, chatgpt, gpt-4",
"author": "shuttle",
"author_email": "noreply@shuttleai.app",
"download_url": "https://files.pythonhosted.org/packages/d7/f4/52bf6193c00529f41d7d2861a7a214ac3058cdf3bebc1042eae45d2ebeef/shuttleai-3.9.4.tar.gz",
"platform": null,
"description": "# The official Python library for the ShuttleAI API\r\nAccess the ShuttleAI API with a simple, user-friendly lib; or a sleek command line interface (CLI)\r\n\r\n> *PRs appreciated \ud83d\ude42*\r\n# Installation\r\n## ShuttleAI\r\n[![pypi](https://img.shields.io/pypi/v/shuttleai.svg?color=blue)](https://pypi.org/project/shuttleai/)\r\n```ShellSession\r\npip install shuttleai\r\n```\r\n\r\n## ShuttleAI CLI\r\n```ShellSession\r\npip install shuttleai[cli]\r\n```\r\n\r\n# Usage\r\n## ShuttleAI CLI\r\n```ShellSession\r\nshuttleai\r\n```\r\n*That's it! Just type `shuttleai` in your terminal!*\r\n## ShuttleAI\r\n> [!IMPORTANT]\r\n> It is strongly recommended to use the asynchronous client instead of the synchronous client.\r\n```py\r\nimport asyncio\r\nfrom shuttleai import *\r\n\r\nSHUTTLE_KEY = \"ShuttleAPI Key\"\r\n\r\nasync def main():\r\n async with ShuttleAsyncClient(SHUTTLE_KEY, timeout=60) as shuttle:\r\n \"\"\"Optionally change base url\"\"\"\r\n # shuttle.base_url = \"https://api.shuttleai.app/v1\"\r\n\r\n \"\"\"Get Models Example\"\"\"\r\n # response = await shuttle.get_models()\r\n # print(response)\r\n \"\"\"Get Model Example\"\"\"\r\n # response = await shuttle.get_model(\"gpt-4\")\r\n # print(response)\r\n \"\"\"Streaming Example\"\"\"\r\n # response = await shuttle.chat_completion(\r\n # model=\"gpt-3.5-turbo\",\r\n # messages=\"write me a short story about bees\",\r\n # stream=True,\r\n # plain=True,\r\n # internet=False\r\n # )\r\n # async for chunk in response:\r\n # print(chunk.choices[0].delta.content)\r\n \"\"\"Non-Streaming Example\"\"\"\r\n # response = await shuttle.chat_completion(\r\n # model=\"gpt-3.5-turbo\",\r\n # messages=[{\"role\":\"user\",\"content\":\"write me a short story about bees\"}],\r\n # stream=False,\r\n # plain=False,\r\n # internet=False,\r\n # max_tokens=100,\r\n # temperature=0.5,\r\n # image=\"https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png\"\r\n # )\r\n # print(response)\r\n \"\"\"Image Generation Example\"\"\"\r\n # response = await shuttle.images_generations(\r\n # model='sdxl',\r\n # prompt='a cute cat',\r\n # n=1,\r\n # )\r\n # print(response)\r\n \"\"\"Audio Generation Example\"\"\"\r\n # response = await shuttle.audio_generations(\r\n # model='eleven-labs-999',\r\n # input='Once upon a time, there was a cute cat wondering through a dark, cold forest.',\r\n # voice=\"mimi\"\r\n # )\r\n # print(response)\r\n \"\"\"Audio Transcription Example\"\"\"\r\n # response = await shuttle.audio_transcriptions(\r\n # model='whisper-large',\r\n # file=\"test.mp3\"\r\n # )\r\n # print(response)\r\n \"\"\"Moderation Example\"\"\"\r\n # response = await shuttle.moderations(\r\n # model='text-moderation-latest',\r\n # input=\"I hate you\"\r\n # )\r\n # print(response)\r\n \"\"\"Embeddings Example\"\"\"\r\n # response = await shuttle.embeddings(\r\n # model='text-embedding-ada-002',\r\n # input=\"Hello there world\"\r\n # )\r\n # print(response)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n loop = asyncio.new_event_loop()\r\n loop.run_until_complete(main())\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Access Shuttle AI's API via a simple and user-friendly lib. Dashboard: https://shuttleai.app Discord: https://discord.gg/shuttleai",
"version": "3.9.4",
"project_urls": {
"Homepage": "https://github.com/shuttleai/shuttleai-python"
},
"split_keywords": [
"shuttleai",
" ai",
" gpt",
" claude",
" api",
" free",
" chatgpt",
" gpt-4"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d7f452bf6193c00529f41d7d2861a7a214ac3058cdf3bebc1042eae45d2ebeef",
"md5": "8ae1dec455fbe65fd92cc19ea8745333",
"sha256": "17b02a55a2f0ea9efa29406d227b2c6add802745da787aa2af16071845be96ca"
},
"downloads": -1,
"filename": "shuttleai-3.9.4.tar.gz",
"has_sig": false,
"md5_digest": "8ae1dec455fbe65fd92cc19ea8745333",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 13303,
"upload_time": "2024-04-27T00:34:35",
"upload_time_iso_8601": "2024-04-27T00:34:35.711149Z",
"url": "https://files.pythonhosted.org/packages/d7/f4/52bf6193c00529f41d7d2861a7a214ac3058cdf3bebc1042eae45d2ebeef/shuttleai-3.9.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-27 00:34:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "shuttleai",
"github_project": "shuttleai-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "shuttleai"
}