Cloudflare 免费 AI接口服务 AI Worker

Cloudflare上线了AI Worker,可以通过调用CF的接口来接入以下主流的开源AI模型,例如千问、llama2、llama3、deepseek、stabe-diffusion1.5等等,非常丰富:

模型名称模型任务描述
0@hf/google/gemma-7b-itText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
1@cf/qwen/qwen1.5-14b-chat-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
2@cf/openchat/openchat-3.5-0106Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
3@cf/baai/bge-large-en-v1.5Text EmbeddingsFeature extraction models transform raw data into numerical features that can be processed while preserving the information in the original dataset. These models are ideal as part of building vector search applications or Retrieval Augmented Generation workflows with Large Language Models (LLM).
4@cf/qwen/qwen1.5-0.5b-chatText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
5@hf/meta-llama/meta-llama-3-8b-instructText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
6@cf/huggingface/distilbert-sst-2-int8Text ClassificationSentiment analysis or text classification is a common NLP task that classifies a text input into labels or classes.
7@cf/google/gemma-2b-it-loraText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
8@hf/nexusflow/starling-lm-7b-betaText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
9@cf/meta/llama-3-8b-instructText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
10@hf/thebloke/llamaguard-7b-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
11@hf/thebloke/neural-chat-7b-v3-1-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
12@cf/facebook/detr-resnet-50Object DetectionObject detection models can detect instances of objects like persons, faces, license plates, or others in an image. This task takes an image as input and returns a list of detected objects, each one containing a label, a probability score, and its surrounding box coordinates.
13@cf/meta/llama-2-7b-chat-fp16Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
14@cf/mistral/mistral-7b-instruct-v0.1Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
15@cf/mistral/mistral-7b-instruct-v0.2-loraText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
16@cf/openai/whisperAutomatic Speech RecognitionAutomatic speech recognition (ASR) models convert a speech signal, typically an audio input, to text.
17@cf/tinyllama/tinyllama-1.1b-chat-v1.0Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
18@hf/mistral/mistral-7b-instruct-v0.2Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
19@cf/fblgit/una-cybertron-7b-v2-bf16Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
20@cf/llava-hf/llava-1.5-7b-hfImage-to-Text
21@hf/thebloke/codellama-7b-instruct-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
22@cf/runwayml/stable-diffusion-v1-5-inpaintingText-to-ImageGenerates images from input text. These models can be used to generate and modify images based on text prompts.
23@cf/thebloke/discolm-german-7b-v1-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
24@cf/meta/llama-2-7b-chat-int8Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
25@hf/thebloke/mistral-7b-instruct-v0.1-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
26@hf/thebloke/openchat_3.5-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
27@cf/qwen/qwen1.5-7b-chat-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
28@hf/thebloke/llama-2-13b-chat-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
29@cf/microsoft/resnet-50Image ClassificationImage classification models take an image input and assigns it labels or classes.
30@cf/bytedance/stable-diffusion-xl-lightningText-to-ImageGenerates images from input text. These models can be used to generate and modify images based on text prompts.
31@hf/thebloke/deepseek-coder-6.7b-base-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
32@cf/meta-llama/llama-2-7b-chat-hf-loraText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
33@cf/lykon/dreamshaper-8-lcmText-to-ImageGenerates images from input text. These models can be used to generate and modify images based on text prompts.
34@cf/stabilityai/stable-diffusion-xl-base-1.0Text-to-ImageGenerates images from input text. These models can be used to generate and modify images based on text prompts.
35@cf/meta/detr-resnet-50Object DetectionObject detection models can detect instances of objects like persons, faces, license plates, or others in an image. This task takes an image as input and returns a list of detected objects, each one containing a label, a probability score, and its surrounding box coordinates.
36@hf/thebloke/openhermes-2.5-mistral-7b-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
37@cf/meta/m2m100-1.2bTranslationTranslation models convert a sequence of text from one language to another.
38@hf/thebloke/deepseek-coder-6.7b-instruct-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
39@cf/mistral/mixtral-8x7b-instruct-v0.1-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
40@cf/baai/bge-small-en-v1.5Text EmbeddingsFeature extraction models transform raw data into numerical features that can be processed while preserving the information in the original dataset. These models are ideal as part of building vector search applications or Retrieval Augmented Generation workflows with Large Language Models (LLM).
41@cf/deepseek-ai/deepseek-math-7b-instructText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
42@cf/tiiuae/falcon-7b-instructText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
43@hf/nousresearch/hermes-2-pro-mistral-7bText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
44@cf/baai/bge-base-en-v1.5Text EmbeddingsFeature extraction models transform raw data into numerical features that can be processed while preserving the information in the original dataset. These models are ideal as part of building vector search applications or Retrieval Augmented Generation workflows with Large Language Models (LLM).
45@cf/unum/uform-gen2-qwen-500mImage-to-Text
46@hf/thebloke/zephyr-7b-beta-awqText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
47@cf/google/gemma-7b-it-loraText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
48@cf/qwen/qwen1.5-1.8b-chatText GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
49@cf/openai/whisper-tiny-enAutomatic Speech RecognitionAutomatic speech recognition (ASR) models convert a speech signal, typically an audio input, to text.
50@cf/defog/sqlcoder-7b-2Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
51@cf/microsoft/phi-2Text GenerationFamily of generative text models, such as large language models (LLM), that can be adapted for a variety of natural language tasks.
52@cf/facebook/bart-large-cnnSummarizationSummarization is the task of producing a shorter version of a document while preserving its important information. Some models can extract text from the original input, while other models can generate entirely new text.
53@cf/runwayml/stable-diffusion-v1-5-img2imgText-to-ImageGenerates images from input text. These models can be used to generate and modify images based on text prompts.

使用 Workers AI REST API

本指南将指导您设置并部署您的第一个 Workers AI 项目。您将使用 Workers AI REST API 来试验一个大型语言模型(LLM)。

前提条件

如果您还没有,那么请注册一个 Cloudflare 账户。

1. 获取 API 令牌和账户 ID

您需要您的 API 令牌和账户 ID 来使用 REST API。

获取这些值的步骤:

  • 登录到 Cloudflare 控制面板并选择您的账户。
  • 转到 AI > Workers AI。
  • 选择使用 Workers AI API。
  • 获取您的 API 令牌:
    • 选择获取 API 令牌。
    • 审查预填信息。
    • 选择继续到摘要。
    • 选择创建令牌。
    • 复制令牌值以备后用。
  • 获取您的账户 ID:
    • 回到使用 Workers AI API 的屏幕(您最初的标签页)。
    • 在获取账户 ID 下,复制账户 ID 的值。

如果您选择创建一个 API 令牌而不使用模板,该令牌将需要 Workers AI - 读取 和 Workers AI - 编辑 的权限。

2. 通过 API 运行模型

创建您的 API 令牌后,使用您的 API 令牌在请求中进行身份验证并向 API 发出请求。

您将使用执行 AI 模型端点来运行 @cloudflare/meta-llama/llama-2-7b-chat-int8 模型:

$ curl https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/@cf/meta/llama-2-7b-chat-int8 \
  -H 'Authorization: Bearer {API_TOKEN}' \
  -d '{ "prompt": "Where did the phrase Hello World come from" }'

可以参考cloudflare的接口页面:
Cloudflare AI rest API接口说明
Cloudflare AI rest API 具体文档

  • 13
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值