Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Nipun1212/Claude_api
Claude_api is a Python package that provides a convenient way to interact with Claude 2 from Anthropic.
https://github.com/Nipun1212/Claude_api
anthropic anthropic-claude claude claude-ai claude-api nlp
Last synced: 3 months ago
JSON representation
Claude_api is a Python package that provides a convenient way to interact with Claude 2 from Anthropic.
- Host: GitHub
- URL: https://github.com/Nipun1212/Claude_api
- Owner: Nipun1212
- License: mit
- Created: 2023-07-20T07:59:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-02T15:59:28.000Z (4 months ago)
- Last Synced: 2024-07-12T23:34:58.342Z (4 months ago)
- Topics: anthropic, anthropic-claude, claude, claude-ai, claude-api, nlp
- Language: Python
- Homepage: https://pypi.org/project/claude2/1.0.1/
- Size: 43 KB
- Stars: 108
- Watchers: 2
- Forks: 5
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Claude 2 API ( Unofficial )
This project provides an unofficial API for Claude AI from Anthropic, allowing users to access and interact with Claude AI and trying out experiments with the same.
Current Version == 1.1.5
> The python package that returns response of [Claude 2](https://claude.ai/) through value of session cookies.
**Please exercise caution and use this package responsibly.**
## Installation
To use the Claude AI Unofficial API, you can either clone the GitHub repository or directly download the Python file.
Terminal :
```
$ pip install claude2```
or
Clone the repository:
```
git clone [https://github.com/Nipun1212/Claude_api.git]
```
## Authentication
> **Warning** Do not expose the `_SessionKey=`
1. Visit [https://claude.ai/](https://claude.ai/)
2. F12 for console
3. Session: Network → Request Header → Cookie header → Copy the value of `__SessionKey=` cookie.![Screenshot (8)](https://github.com/KoushikNavuluri/Claude-API/assets/103725723/355971e3-f46c-47fc-a3cf-008bb55bb4c6)
Note that while I referred to `__SessionKey=` value as an API key for convenience, it is not an officially provided API key.
Cookie value subject to frequent changes. Verify the value again if an error occurs. Most errors occur when an invalid cookie value is entered.
## Usage
```python
from claude import Claude
cookie = "sessionKey=..."
claude = Claude(cookie)
```After initalising the claude object, it automatically takes your most recent conversation, without facing the hassle of choosing your conversation ID, allowing you to simply chat with the model.
```python
prompt = "Hello, Claude!"
response=claude.get_answer(prompt)
print(response)
```## Create New Chat
If you want to start a new convewrsation you can just run
```python
claude.create_new_conversation()
```
and it automatically updates your conversation ID, allowing you yo easily chat with the model again using
```python
prompt = "Hello, Claude!"
response=claude.get_answer(prompt)
print(response)
```## 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.
The package was created to support developers in testing functionalities due to delays in the official Claude API package. However, it should not be misused or abused. Please be cautious and refer to the Readme for more information.
*Copyright (c) 2023 Nipun Bhatia*Please refer to the official Claude AI documentation[https://claude.ai/docs] for more information on how to use Claude AI.