claude-api-temp


Nameclaude-api-temp JSON
Version 1.0.18 PyPI version JSON
download
home_pagehttps://github.com/KoushikNavuluri/Claude-API/
SummaryAn unofficial API for Claude AI, allowing users to access and interact with Claude AII
upload_time2023-11-24 16:51:14
maintainer
docs_urlNone
authorKoushik
requires_python>=3.7
licenseMIT
keywords claude ai claude-ai api requests chatbot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Claude AI-API ( Unofficial )
This project provides an unofficial API for Claude AI, allowing users to access and interact with Claude AI .

<img src="https://github.com/KoushikNavuluri/Claude-API/assets/103725723/385fa539-e725-4c20-86ff-0864e6ffab82" width="400">



#### Current Version == 1.0.17 ( Added Timeouts,Faster Requests,File handling Fixed.. )

## Table of contents

  * [Use Cases](#use-cases)
  * [Prerequisites](#prerequisites)
  * [Installation](#installation)
  * [Usage](#usage)
  * [List All Conversations](#list-all-conversations)
  * [Send Message](#send-message)
  * [Send Message with attachment](#send-message-with-attachment)
  * [Delete Conversation](#delete-conversation)
  * [Chat Conversation History](#chat-conversation-history)
  * [Create New Chat](#create-new-chat)
  * [Reset All Conversations](#reset-all-conversations)
  * [Rename Chat](#rename-chat)
  * [Disclaimer](#disclaimer)


## Use Cases 

    1. Python Console ChatBot ( Check in usecases folder for sample console chatbot )

    2. Discord Chatbot   
    
    3. Many more can be done....
    

## Prerequisites

To use this API, you need to have the following:

Python installed on your system
requests library installed 
```bash
  pip install requests

```

## Installation

To use the Claude AI Unofficial API, you can either clone the GitHub repository or directly download the Python file.

Terminal :

    pip install claude-api
    
or

Clone the repository:

    git clone https://github.com/KoushikNavuluri/Claude-API.git

## Usage


Import the claude_api module in your Python script:

    from claude_api import Client

* Next, you need to create an instance of the Client class by providing your Claude AI cookie:

* You can get cookie from the browser's developer tools network tab ( see for any claude.ai requests check out cookie ,copy whole value ) or storage tab ( You can find cookie of claude.ai ,there will be four values )

* (Checkout below image for the format of cookie ,It is Better to Use from network tab to grab cookie easily )

   ![Screenshot (8)](https://github.com/KoushikNavuluri/Claude-API/assets/103725723/355971e3-f46c-47fc-a3cf-008bb55bb4c6)


      cookie = os.environ.get('cookie')
      claude_api = Client(cookie)

## List All Conversations

To list all the conversation Id's you had with Claude , you can use the list_all_conversations method:

    conversations = claude_api.list_all_conversations()
    for conversation in conversations:
        conversation_id = conversation['uuid']
        print(conversation_id)

## Send Message

To send a message to Claude, you can use the send_message method. You need to provide the prompt and the conversation ID:



    prompt = "Hello, Claude!"
    conversation_id = "<conversation_id>" or claude_api.create_new_chat()['uuid']
    response = claude_api.send_message(prompt, conversation_id)
    print(response)

## Send Message with attachment

You can send any type of attachment to claude to get responses using attachment argument in send_message().
Note: Claude currently supports only some file types.

{ You can also add timeout if you need ,using timeout parameter[default set to 500] }

    prompt = "Hey,Summarize me this document.!"
    conversation_id = "<conversation_id>" or claude_api.create_new_chat()['uuid']
    response = claude_api.send_message(prompt, conversation_id,attachment="path/to/file.pdf",timeout=600)
    print(response)


## Delete Conversation

To delete a conversation, you can use the delete_conversation method:


    conversation_id = "<conversation_id>"
    deleted = claude_api.delete_conversation(conversation_id)
    if deleted:
        print("Conversation deleted successfully")
    else:
        print("Failed to delete conversation")

## Chat Conversation History

To get the chat conversation history, you can use the chat_conversation_history method:    

    conversation_id = "<conversation_id>"
    history = claude_api.chat_conversation_history(conversation_id)
    print(history)

## Create New Chat

To create a new chat conversation (id), you can use the create_new_chat method:


    new_chat = claude_api.create_new_chat()
    conversation_id = new_chat['uuid']
    print(conversation_id)

## Reset All Conversations

To reset all conversations, you can use the reset_all method:


    reset = claude_api.reset_all()
    if reset:
        print("All conversations reset successfully")
    else:
        print("Failed to reset conversations")   

## Rename Chat

To rename a chat conversation, you can use the rename_chat method:

    conversation_id = "<conversation_id>"
    title = "New Chat Title"
    renamed = claude_api.rename_chat(title, conversation_id)
    if renamed:
        print("Chat conversation renamed successfully")
    else:
        print("Failed to rename chat conversation")

## Disclaimer

This project provides an unofficial API for Claude AI and is not affiliated with or endorsed by Claude AI or Anthropic. Use it at your own risk.

Please refer to the official Claude AI documentation[https://claude.ai/docs] for more information on how to use Claude AI.
        
    




    

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/KoushikNavuluri/Claude-API/",
    "name": "claude-api-temp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "claude,ai,claude-ai,API,requests,chatbot",
    "author": "Koushik",
    "author_email": "koushikk@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/60/e2ffc146a9652bf4d5869e2e0764163003a1e55ddaefc505d4629934084f/claude-api-temp-1.0.18.tar.gz",
    "platform": null,
    "description": "# Claude AI-API ( Unofficial )\nThis project provides an unofficial API for Claude AI, allowing users to access and interact with Claude AI .\n\n<img src=\"https://github.com/KoushikNavuluri/Claude-API/assets/103725723/385fa539-e725-4c20-86ff-0864e6ffab82\" width=\"400\">\n\n\n\n#### Current Version == 1.0.17 ( Added Timeouts,Faster Requests,File handling Fixed.. )\n\n## Table of contents\n\n  * [Use Cases](#use-cases)\n  * [Prerequisites](#prerequisites)\n  * [Installation](#installation)\n  * [Usage](#usage)\n  * [List All Conversations](#list-all-conversations)\n  * [Send Message](#send-message)\n  * [Send Message with attachment](#send-message-with-attachment)\n  * [Delete Conversation](#delete-conversation)\n  * [Chat Conversation History](#chat-conversation-history)\n  * [Create New Chat](#create-new-chat)\n  * [Reset All Conversations](#reset-all-conversations)\n  * [Rename Chat](#rename-chat)\n  * [Disclaimer](#disclaimer)\n\n\n## Use Cases \n\n    1. Python Console ChatBot ( Check in usecases folder for sample console chatbot )\n\n    2. Discord Chatbot   \n    \n    3. Many more can be done....\n    \n\n## Prerequisites\n\nTo use this API, you need to have the following:\n\nPython installed on your system\nrequests library installed \n```bash\n  pip install requests\n\n```\n\n## Installation\n\nTo use the Claude AI Unofficial API, you can either clone the GitHub repository or directly download the Python file.\n\nTerminal :\n\n    pip install claude-api\n    \nor\n\nClone the repository:\n\n    git clone https://github.com/KoushikNavuluri/Claude-API.git\n\n## Usage\n\n\nImport the claude_api module in your Python script:\n\n    from claude_api import Client\n\n* Next, you need to create an instance of the Client class by providing your Claude AI cookie:\n\n* You can get cookie from the browser's developer tools network tab ( see for any claude.ai requests check out cookie ,copy whole value ) or storage tab ( You can find cookie of claude.ai ,there will be four values )\n\n* (Checkout below image for the format of cookie ,It is Better to Use from network tab to grab cookie easily )\n\n   ![Screenshot (8)](https://github.com/KoushikNavuluri/Claude-API/assets/103725723/355971e3-f46c-47fc-a3cf-008bb55bb4c6)\n\n\n      cookie = os.environ.get('cookie')\n      claude_api = Client(cookie)\n\n## List All Conversations\n\nTo list all the conversation Id's you had with Claude , you can use the list_all_conversations method:\n\n    conversations = claude_api.list_all_conversations()\n    for conversation in conversations:\n        conversation_id = conversation['uuid']\n        print(conversation_id)\n\n## Send Message\n\nTo send a message to Claude, you can use the send_message method. You need to provide the prompt and the conversation ID:\n\n\n\n    prompt = \"Hello, Claude!\"\n    conversation_id = \"<conversation_id>\" or claude_api.create_new_chat()['uuid']\n    response = claude_api.send_message(prompt, conversation_id)\n    print(response)\n\n## Send Message with attachment\n\nYou can send any type of attachment to claude to get responses using attachment argument in send_message().\nNote: Claude currently supports only some file types.\n\n{ You can also add timeout if you need ,using timeout parameter[default set to 500] }\n\n    prompt = \"Hey,Summarize me this document.!\"\n    conversation_id = \"<conversation_id>\" or claude_api.create_new_chat()['uuid']\n    response = claude_api.send_message(prompt, conversation_id,attachment=\"path/to/file.pdf\",timeout=600)\n    print(response)\n\n\n## Delete Conversation\n\nTo delete a conversation, you can use the delete_conversation method:\n\n\n    conversation_id = \"<conversation_id>\"\n    deleted = claude_api.delete_conversation(conversation_id)\n    if deleted:\n        print(\"Conversation deleted successfully\")\n    else:\n        print(\"Failed to delete conversation\")\n\n## Chat Conversation History\n\nTo get the chat conversation history, you can use the chat_conversation_history method:    \n\n    conversation_id = \"<conversation_id>\"\n    history = claude_api.chat_conversation_history(conversation_id)\n    print(history)\n\n## Create New Chat\n\nTo create a new chat conversation (id), you can use the create_new_chat method:\n\n\n    new_chat = claude_api.create_new_chat()\n    conversation_id = new_chat['uuid']\n    print(conversation_id)\n\n## Reset All Conversations\n\nTo reset all conversations, you can use the reset_all method:\n\n\n    reset = claude_api.reset_all()\n    if reset:\n        print(\"All conversations reset successfully\")\n    else:\n        print(\"Failed to reset conversations\")   \n\n## Rename Chat\n\nTo rename a chat conversation, you can use the rename_chat method:\n\n    conversation_id = \"<conversation_id>\"\n    title = \"New Chat Title\"\n    renamed = claude_api.rename_chat(title, conversation_id)\n    if renamed:\n        print(\"Chat conversation renamed successfully\")\n    else:\n        print(\"Failed to rename chat conversation\")\n\n## Disclaimer\n\nThis project provides an unofficial API for Claude AI and is not affiliated with or endorsed by Claude AI or Anthropic. Use it at your own risk.\n\nPlease refer to the official Claude AI documentation[https://claude.ai/docs] for more information on how to use Claude AI.\n        \n    \n\n\n\n\n    \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An unofficial API for Claude AI, allowing users to access and interact with Claude AII",
    "version": "1.0.18",
    "project_urls": {
        "Homepage": "https://github.com/KoushikNavuluri/Claude-API/"
    },
    "split_keywords": [
        "claude",
        "ai",
        "claude-ai",
        "api",
        "requests",
        "chatbot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d260e2ffc146a9652bf4d5869e2e0764163003a1e55ddaefc505d4629934084f",
                "md5": "0cd6ba559287a1e0e92bbb64caee5149",
                "sha256": "3670669e0cae4df7b75c7ec76ec2bd57a2255accf7330c4d461ddb570625f951"
            },
            "downloads": -1,
            "filename": "claude-api-temp-1.0.18.tar.gz",
            "has_sig": false,
            "md5_digest": "0cd6ba559287a1e0e92bbb64caee5149",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6067,
            "upload_time": "2023-11-24T16:51:14",
            "upload_time_iso_8601": "2023-11-24T16:51:14.310904Z",
            "url": "https://files.pythonhosted.org/packages/d2/60/e2ffc146a9652bf4d5869e2e0764163003a1e55ddaefc505d4629934084f/claude-api-temp-1.0.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-24 16:51:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KoushikNavuluri",
    "github_project": "Claude-API",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "claude-api-temp"
}
        
Elapsed time: 0.14329s