Git Product home page Git Product logo

claude-revert-api's Introduction

claude-revert-api

A wrapper of the claude 2. Basicly use the axios mock a sdk. For my project switch to claude2. Code will be open source. I still test for it. If you have more requirement just send email to [email protected] or follow my twitter

And feel free open an issue or PR.

Document: https://parsedark.github.io/claude-revert-api/

NPM version NPM downloads

Install

// npm 
npm install claude-revert-api

// pnpm 
pnpm install claude-revert-api

Develop

pnpm install
$ npm run dev
$ npm run build

Usage 1: only use the sdk

// baseURL?: string
// uuid: string;
// organization_uuid: organizationType;
// sessionKey: string;
// name?: string;
createConversationSDK
// baseURL?: string
// sessionKey: string;
// prompt: string;
// metadata: IMetadata;
appendMessageSDK
// baseURL?: string
// organization_uuid: organizationType;
// sessionKey: string;
conversationListSDK
// baseURL?: string
// sessionKey: string;
// organization_uuid: organizationType;
// conversation_uuid: conversationType;
deleteConversationSDK
//   baseURL?: string
//   sessionKey: string;
//   organization_uuid: organizationType;
//   conversation_uuid: conversationType;
getConversationSDK
// baseURL?: string
// organization_uuid: organizationType;
// conversation_uuid: conversationType;
// sessionKey: string;
// title: string;
renameConversationSDK

Usage 2: if need to customize the base_url or token

for this usage i think your are not the claude api support region. So we need to do a proxy. When use the proxy will change the base url. So you need to use this OOP style.

// ClaudeRevertAPI(baseURL: string, sessionKey: string)
const claude = new ClaudeRevertAPI("https://claude.ai", "sessionKey");

// create a new chat session
claude.createConversation(organization_uuid: string)
// post a new message session
claude.appendMessage(prompt: string, metadata: IMetadata)
// get all chat session
claude.conversationList(organization_uuid: string)
// delete chat session
claude.deleteConversation(organization_uuid: organizationType, conversation_uuid: conversationType)
// get history message 
claude.getConversation(organization_uuid: organizationType, conversation_uuid: conversationType)
// rename your session
claude.renameConversation(title: string,organization_uuid: organizationType, conversation_uuid: conversationType)

Pending issue

  1. axios browser call streaming issue. If you use the sdk to the browser. The appendMessage SDK can't be a stream response. Only return all of thing one time. It's will cause long response time.

Have fun for it.

LICENSE

MIT

claude-revert-api's People

Contributors

parsedark avatar kewanfr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.