Claude API Não-Oficial
Nipun1212/Claude_api
Acesso a Claude 2 via cookies de sessão em Python
Ver no GitHubPacote Python que fornece acesso à Claude 2 através de cookies de sessão, permitindo interação com o modelo sem usar a API oficial. Útil para prototipagem rápida e testes, mas requer gerenciamento manual de autenticação via sessão do navegador.
Instalação
npx convez-ai Nipun1212/Claude_api1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Prototipagem rápida com Claude sem API oficial
- Testes e experimentos com modelos de IA
- Integração de Claude em scripts Python existentes
Veredito

Solução não-oficial com utilidade limitada dado que a API oficial Claude agora está disponível e mantida pela Anthropic. Adequada apenas para casos legados ou testes pontuais, com risco de quebra por mudanças nas cookies de sessão. Prefira usar a API oficial.
README
A tradução para o português deste README ainda está na fila.
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 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=
- Visit https://claude.ai/
- F12 for console
- Session: Network → Request Header → Cookie header → Copy the value of
__SessionKey=cookie.
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
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.
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
claude.create_new_conversation()
and it automatically updates your conversation ID, allowing you yo easily chat with the model again using
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.