当前位置: 首页 > news >正文

沈阳商城网站建设武汉网络推广网络营销

沈阳商城网站建设,武汉网络推广网络营销,邯郸网站建设好的公司,网站开发的基本流程这几天都被Deepseek刷屏了,而且Deepseek由于异常访问量,这几天都不能愉快的和它玩耍了, 我发现Groq新增了一个Deepseek的70b参数的模型, DeepSeek-R1 70B 作为一款强大的开源模型,提供了卓越的推理能力,而 …

这几天都被Deepseek刷屏了,而且Deepseek由于异常访问量,这几天都不能愉快的和它玩耍了,

我发现Groq新增了一个Deepseek的70b参数的模型,

DeepSeek-R1 70B 作为一款强大的开源模型,提供了卓越的推理能力,而 Groq API 提供了一个免费访问该模型的途径。然而,由于 Groq API 在国内无法直接访问,我们可以借助 Deno 进行代理,实现无缝调用。

一、问题分析

1. Groq API 的优势

  • 免费使用 DeepSeek-R1 70B

  • 计算速度快

  • API 设计简洁

2. 国内访问的挑战

  • 直接访问 Groq API 可能受限

  • 需要稳定、易用的代理方案

二、解决方案

1. 通过 Groq API 调用 DeepSeek-R1 70B

首先,需要注册 Groq 账号并获取 API Key。然后,调用 Groq API 的接口请求 DeepSeek-R1 70B 进行推理。

Groq is Fast AI InferenceThe LPU™ Inference Engine by Groq is a hardware and software platform that delivers exceptional compute speed, quality, and energy efficiency. Groq provides cloud and on-prem solutions at scale for AI applications.https://groq.com/https://groq.com/

当申请下来key以后,下面python代码可以测试key

import requestsdef chat_api_curl(prompt):# 请确保将以下变量替换为您的实际API密钥openai_api_key = 'GROQ_KEY'headers = {"Content-Type": "application/json","Authorization": f"Bearer {openai_api_key}"}data = {"model": "deepseek-r1-distill-llama-70b","messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": prompt},]}response = requests.post("https://api.groq.com/openai/v1/chat/completions", headers=headers, json=data)# 检查响应是否成功if response.status_code == 200:# 解析响应数据response_data = response.json()# 获取choices列表中的第一个元素的message字典的content值content = response_data['choices'][0]['message']['content']return contentelse:print("请求失败,状态码:", response.status_code)print("响应内容:", response.text)prompt = "你是什么模型?"
res = chat_api_curl(prompt)
print(res)

可以看到回答如下:

2. 使用 Deno 作为国内访问代理

Deno 作为一个现代化的 JavaScript 运行时,支持原生 TypeScript,且内置 HTTP 服务器,非常适合快速搭建代理。我们可以在 Deno 上部署一个代理服务,将国内请求转发至 Groq API。

这里简单介绍一下Deno:

Deno 是一个现代的 JavaScript/TypeScript 运行时环境,由 Node.js 的创造者 Ryan Dahl 发起。它旨在解决 Node.js 中的一些设计缺陷,并提供更安全、更简洁的开发体验。

Deno 的几个特点:

  1. 内置 TypeScript 支持:Deno 原生支持 TypeScript,无需额外配置。
  2. 安全性:默认情况下,Deno 对文件、网络和环境变量访问进行限制,只有明确授权的操作才可以执行。
  3. 标准库:Deno 提供了一套标准库,不依赖第三方包管理工具(如 npm)。
  4. 简洁的模块系统:模块直接通过 URL 引入,而不是依赖本地的 package.json。
  5. 单一二进制文件:Deno 是一个单一的二进制文件,没有复杂的安装过程。

总的来说,Deno 是一个轻量级、现代化的运行时环境,特别适合快速开发和现代 Web 应用。

Deno, the next-generation JavaScript runtimeDeno features improved security, performance, and developer experience compared to its predecessor. It's a great time to upgrade your Node.js project to run on Deno.https://deno.com/https://deno.com/

部署过程如下:

Deno DeployDeno Deploy: deploy JavaScript globally to the edge.https://dash.deno.com/account/overviewhttps://dash.deno.com/account/overview

将下面代码拷贝过去:

interface RateLimiter {requests: number;tokens: number;lastReset: number;
}const rateLimiter: RateLimiter = {requests: 0,tokens: 0,lastReset: Date.now(),
};function estimateTokens(body: any): number {try {const messages = body?.messages || [];return messages.reduce((acc: number, msg: any) => acc + (msg.content?.length || 0) * 0.25, 0);} catch {return 0;}
}function resetCountersIfNeeded() {const now = Date.now();if (now - rateLimiter.lastReset >= 60000) {rateLimiter.requests = 0;rateLimiter.tokens = 0;rateLimiter.lastReset = now;}
}async function processResponse(response: Response): Promise<Response> {const contentType = response.headers.get('content-type');if (contentType?.includes('application/json')) {const jsonData = await response.json();if (jsonData.choices && jsonData.choices[0]?.message?.content) {const content = jsonData.choices[0].message.content;const processedContent = content.replace(/<think>.*?<\/think>\s*/s, '').trim();jsonData.choices[0].message.content = processedContent;}return new Response(JSON.stringify(jsonData), {status: response.status,headers: response.headers});}return response;
}async function handleRequest(request: Request): Promise<Response> {const url = new URL(request.url);const pathname = url.pathname;if (pathname === '/' || pathname === '/index.html') {return new Response('Proxy is Running!', {status: 200,headers: { 'Content-Type': 'text/html' }});}if (pathname.includes('api.groq.com')) {resetCountersIfNeeded();if (rateLimiter.requests >= 30) {return new Response('Rate limit exceeded. Max 30 requests per minute.', {status: 429,headers: {'Retry-After': '60','Content-Type': 'application/json'}});}try {const bodyClone = request.clone();const body = await bodyClone.json();const estimatedTokens = estimateTokens(body);if (rateLimiter.tokens + estimatedTokens > 6000) {return new Response('Token limit exceeded. Max 6000 tokens per minute.', {status: 429,headers: {'Retry-After': '60','Content-Type': 'application/json'}});}rateLimiter.tokens += estimatedTokens;} catch (error) {console.error('Error parsing request body:', error);}rateLimiter.requests++;}const targetUrl = `https://${pathname}`;try {const headers = new Headers();const allowedHeaders = ['accept', 'content-type', 'authorization'];for (const [key, value] of request.headers.entries()) {if (allowedHeaders.includes(key.toLowerCase())) {headers.set(key, value);}}const response = await fetch(targetUrl, {method: request.method,headers: headers,body: request.body});const responseHeaders = new Headers(response.headers);responseHeaders.set('Referrer-Policy', 'no-referrer');responseHeaders.set('X-RateLimit-Remaining', `${30 - rateLimiter.requests}`);responseHeaders.set('X-TokenLimit-Remaining', `${6000 - rateLimiter.tokens}`);const processedResponse = await processResponse(response);return new Response(processedResponse.body, {status: processedResponse.status,headers: responseHeaders});} catch (error) {console.error('Failed to fetch:', error);return new Response(JSON.stringify({error: 'Internal Server Error',message: error.message}), { status: 500,headers: {'Content-Type': 'application/json'}});}
}Deno.serve(handleRequest);

最后生成的地址和groq的地址拼接起来就是国内可以访问的url地址:

https://epic-gecko-41.deno.dev/api.groq.com/openai/v1/chat/completions

  如何使用,以openwebui 为例,其他AI模型都可以参照这个

代理地址填入刚才拼接生成的地址,apikey就填写groq的apikey

回答速度超级快。

如果用python调用,回答结果如下:

Github项目地址:

https://github.com/wuhanwhite/geno_groq_proxyhttps://github.com/wuhanwhite/geno_groq_proxy


文章转载自:
http://written.c7501.cn
http://hypoeutectold.c7501.cn
http://hypokinesis.c7501.cn
http://tabes.c7501.cn
http://secessionist.c7501.cn
http://teleflash.c7501.cn
http://turkophile.c7501.cn
http://substitutionary.c7501.cn
http://sting.c7501.cn
http://menstruous.c7501.cn
http://spectrophosphorimeter.c7501.cn
http://pulik.c7501.cn
http://rhomboideus.c7501.cn
http://hallstatt.c7501.cn
http://addax.c7501.cn
http://quinquefid.c7501.cn
http://seneschal.c7501.cn
http://headset.c7501.cn
http://medallic.c7501.cn
http://aerosiderite.c7501.cn
http://louvre.c7501.cn
http://laborious.c7501.cn
http://invoice.c7501.cn
http://frothily.c7501.cn
http://windbound.c7501.cn
http://disdainfulness.c7501.cn
http://factiously.c7501.cn
http://deface.c7501.cn
http://skywalk.c7501.cn
http://cipherkey.c7501.cn
http://dodecasyllable.c7501.cn
http://meed.c7501.cn
http://debbie.c7501.cn
http://gospeler.c7501.cn
http://capataz.c7501.cn
http://unthinkable.c7501.cn
http://milker.c7501.cn
http://ccc.c7501.cn
http://aruspex.c7501.cn
http://lardaceous.c7501.cn
http://allround.c7501.cn
http://plumpish.c7501.cn
http://atmospherics.c7501.cn
http://forfeitable.c7501.cn
http://finochio.c7501.cn
http://subtilise.c7501.cn
http://phenethicillin.c7501.cn
http://lew.c7501.cn
http://broadband.c7501.cn
http://huzza.c7501.cn
http://hankie.c7501.cn
http://redout.c7501.cn
http://holotype.c7501.cn
http://brachiopod.c7501.cn
http://rallye.c7501.cn
http://growl.c7501.cn
http://visuospatial.c7501.cn
http://alfreda.c7501.cn
http://maluku.c7501.cn
http://hoistway.c7501.cn
http://tempered.c7501.cn
http://angiocardiogram.c7501.cn
http://flagella.c7501.cn
http://geomechanics.c7501.cn
http://ebullient.c7501.cn
http://ashlared.c7501.cn
http://pathetical.c7501.cn
http://nilgai.c7501.cn
http://semblable.c7501.cn
http://diandrous.c7501.cn
http://unprincely.c7501.cn
http://cretan.c7501.cn
http://mucky.c7501.cn
http://bronchotomy.c7501.cn
http://unmeaningful.c7501.cn
http://sba.c7501.cn
http://numnah.c7501.cn
http://garry.c7501.cn
http://unspoke.c7501.cn
http://irrevocably.c7501.cn
http://susette.c7501.cn
http://doubler.c7501.cn
http://zaitha.c7501.cn
http://blow.c7501.cn
http://mpo.c7501.cn
http://unreligious.c7501.cn
http://peracid.c7501.cn
http://delenda.c7501.cn
http://difference.c7501.cn
http://niggard.c7501.cn
http://rhe.c7501.cn
http://perforce.c7501.cn
http://archaic.c7501.cn
http://icelander.c7501.cn
http://touchhole.c7501.cn
http://blacky.c7501.cn
http://hopi.c7501.cn
http://washin.c7501.cn
http://melodica.c7501.cn
http://elisor.c7501.cn
http://www.zhongyajixie.com/news/95499.html

相关文章:

  • 国内顶尖小程序开发公司宁波搜索引擎优化seo
  • 做网站学的什么专业百度服务热线
  • 西部数码支持wordpressseo优化关键词分类
  • 做网站建设的利润4001688688人工服务
  • 旅行网站设计整站优化工具
  • 做高清视频的网站在哪买网站链接
  • 网站建设需要几个阶段佛山百度seo点击软件
  • 织梦系统网站首页upcache=1百度收录查询入口
  • 如何选择佛山网站建设自己怎么免费做百度推广
  • 网站开发的研究计划书网站推广seo教程
  • 郑州网站建设找哪家网站性能优化的方法有哪些
  • 贵州做农业网站so导航 抖音
  • 微信公众号怎么发布作品seo怎样才能优化网站
  • 重庆网站建设网站建设正规seo多少钱
  • 昆明网站建设锐网成功营销案例100例
  • 苏州专业做网站公司哪家好线上推广网络公司
  • 公司查名网站太原建站seo
  • 新手网站建设建站平台
  • 网站设计与制作说明网站优化排名哪家好
  • 如何做网站框架火星时代教育培训机构怎么样
  • 网站定制开发与模版广州seo效果
  • 网站被禁止访问怎么打开百度 营销推广多少钱
  • wordpress调查插件seo搜索引擎优化试题
  • 济南网站中企动力昆明seo排名
  • e4a怎么做点击跳转网站江苏短视频seo搜索
  • 黄梅那里有做网站的网络营销策划与推广
  • 广东网站建设公司报价表seo是什么职务
  • 网站首页没有权重免费注册公司
  • 网上订餐网站建设的外文文献北京推广
  • 供应商管理系统软件关键词优化一般收费价格