Giter Club home page Giter Club logo

anthropic-claude-demo's Introduction

Anthropic-API Demo

English | 简体中文

A demo repo based on Anthropic API. Just for Personal test.

Fork

Origin Auther's repo Chatgpt-demo

KNOWN BUG: 1. No stream function; 2. Some bugs unfixed(no continuous dialog, reponse no format...); 3. Unfinished readme.

chat-logo

Running Locally

Pre environment

  1. Node: Check that both your development environment and deployment environment are using Node v18 or later. You can use nvm to manage multiple node versions locally。
     node -v
  2. PNPM: We recommend using pnpm to manage dependencies. If you have never installed pnpm, you can install it with the following command:
     npm i -g pnpm
  3. ANTHROPIC_API_KEY: Before running this application, you need to obtain the API key from Anthropic.

Getting Started

  1. Install dependencies
     pnpm install
  2. Copy the .env.example file, then rename it to .env, and add your Anthropic API key to the .env file.
     ANTHROPIC_API_KEY=sk-xxx...
  3. Run the application, the local project runs on http://localhost:3000/
     pnpm run dev

Deploy

Deploy With Vercel

Deploy with Vercel

🔒 Need website password?

Deploy with the SITE_PASSWORD

Deploy with Vercel

image

Deploy With Netlify

Deploy with Netlify

Step-by-step deployment tutorial:

  1. Fork this project,Go to https://app.netlify.com/start new Site, select the project you forked done, and connect it with your GitHub account.

image

image

  1. Select the branch you want to deploy, then configure environment variables in the project settings.

image

  1. Select the default build command and output directory, Click the Deploy Site button to start deploying the site。

image

Deploy with Docker

Before deploying the app, please make sure .env is configured normally.

Environment variables refer to the documentation below. Docker Hub address.

Direct run

docker run --name=Anthropic-Claude-demo --volume=/path/.env:/usr/src/.env:rw -p 3000:3000 -d snekkenull/Anthropic-Claude-demo:latest

/path/.env represents the path to the local environment variable.

Docker compose

version: '3'

services:
  Anthropic-Claude-demo:
    image: snekkenull/Anthropic-Claude-demo:latest
    container_name: Anthropic-Claude-demo
    restart: always
    ports:
      - '3000:3000'
    volumes:
      - .env:/usr/src/.env
# start
docker compose up -d
# down
docker-compose down

Deploy on more servers

Please refer to the official deployment documentation:https://docs.astro.build/en/guides/deploy

Environment Variables

You can control the website through environment variables.

Name Description Default
ANTHROPIC_API_KEY Your API Key for Anthropic. null
HEAD_SCRIPTS Inject analytics or other scripts before </head> of the page null
SITE_PASSWORD Set password for site, support multiple password separated by comma. If not set, site will be public null
ANTHROPIC_API_MODEL ID of the model to use. List models claude-v1

Frequently Asked Questions

Q: TypeError: fetch failed (can't connect to Anthropic Api)

A: Configure environment variables HTTPS_PROXY,reference: https://github.com/snekkenull/Anthropic-Claude-demo/issues/34

Q: throw new TypeError(${context} is not a ReadableStream.)

A: The Node version needs to be v18 or later,reference: https://github.com/snekkenull/Anthropic-Claude-demo/issues/65

Q: Accelerate domestic access without the need for proxy deployment tutorial?

A: You can refer to this tutorial: https://github.com/snekkenull/Anthropic-Claude-demo/discussions/270

Q: PWA is not working?

A: Current PWA does not support deployment on Netlify, you can choose vercel or node deployment.

Contributing

Thanks ddiu8081 Chatgpt-demo

License

MIT © snekkenull

anthropic-claude-demo's People

Contributors

ddiu8081 avatar snekkenull avatar yzh990918 avatar robin021 avatar whatqiu avatar quzard avatar hswmartin avatar 1wkk avatar lxxxv5 avatar st6091741 avatar youhunwl avatar galaxyscitech avatar pedoc avatar liusishan avatar huandu avatar curitis-tk avatar cnseniorious000 avatar curly210102 avatar jeffrey-mu avatar likui628 avatar loo2k avatar miguelgargallo avatar boysusu avatar waterlemons2k avatar ljnchn avatar iwestlin avatar lonr avatar shitoujianzibu avatar v2less avatar zhangnew 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.