Coder Social home page Coder Social logo

leafyeexyz / myapis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 130 KB

My personal API repository

License: GNU General Public License v3.0

TypeScript 100.00%
cloudflare-ai cloudflare-workers clouflare hono honojs huggingface qweather javascript typescript

myapis's Introduction

δΈ­ζ–‡ | English

Introduction

My personal API repository

Usage

Configure Environment Variables

Please Fork this repository, manually create the wrangler.toml file, and add the following content:

name = "api"
main = "dist/index.js"
compatibility_date = "2024-04-05"

[vars]
KEY = "VALUE"
# See Environment Variables

# Only used for counting visits, can be omitted
[[kv_namespaces]]
binding = "count"
id = "YOUR_KV_NAMESPACE_ID"

Environment Variables

  • CF_USER: Cloudflare user ID, for PainterLeaf and CounselorLeaf
  • CF_AI_API_KEY: Cloudflare AI API key, for PainterLeaf and CounselorLeaf
  • HF_API_KEY: Hugging Face API key, for PainterLeaf
  • WEATHER_API_KEY: qWeather API key, for MyHomepage

If you don't need to use a certain feature, it's okay not to set the corresponding environment variable.

Deployment

# Install dependencies
npm i -g pnpm
pnpm i
# Login to Cloudflare
pnpm loi
# Deploy
pnpm dep

API Reference

Category Function Path Method Query Parameters Request Body Response
PainterLeaf Get model list /painter/models GET - - application/json
PainterLeaf Generate image /painter/generate POST - prompt: prompt words
model: model name
If img2img: image: Array.from(uint8Array)
image/png
PainterLeaf Translate prompt words /painter/translate POST - text: text
source_lang: source language
target_lang: target language
application/json
MyHomepage qWeather (Beijing) /weather GET - - application/json
CounselorLeaf Chat /counselor/chat POST - messages: message list, excluding system messages application/json
PainterLeaf Generate text from image /painter/genprompt POST - image: Array.from(uint8Array) application/json
Others Count visits /count GET - - text/javascript
Others Count visits /count POST - hostname: domain name
unique: whether to count as unique visitors
application/json

myapis's People

Contributors

leafyeexyz avatar

Watchers

 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.