定制 pj8912/php-bard-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pj8912/php-bard-api

最新稳定版本:1.0.1

Composer 安装命令:

composer require pj8912/php-bard-api

包简介

A PHP package for interacting with the Bard API

README 文档

README

❗This repo is archived❗

Use Official Gemini API

https://ai.google.dev/

PHP composer bard package bard api composer version

A package that returns Response of Google Bard through API

Install

composer require pj8912/php-bard-api

Get Your Keys

  • Open bard.google.com
  • Open developer tools, click Application tab
  • In Application under the Storage you will find cookies dropdown
  • Under cookies click on https://bard.google.com which will show you all the cookies being used as Name and Value
  • Copy the values the cookies__Secure-1PSID and __Secure-1PSIDTS

Run

the value of __Secure-1PSIDTS will have to be changed frequently (Google changes it)

require_once 'vendor/autoload.php';
use Pj8912\PhpBardApi\Bard;
//two keys are required which are two cookies values
$_ENV['BARD_API_KEY_X'] = " value of cookie '__Secure-1PSID' ";
$_ENV['BARD_API_KEY_Y'] = " value of cookie '__Secure-1PSIDTS' "
$bard = new Bard();
$input_text = "Hello, Bard!";  // Input text for the conversation
$result = $bard->get_answer($input_text);  // Get the response from Bard

// bard reply
print($result['choices'][0]['content'][0]);

License

This project is licensed under the MIT License

Reference

Important Notice

The user assumes all legal responsibilities associated with using the BardAPI package. This PHP package merely facilitates easy access to Google Bard for developers. Users are solely responsible for managing data and using the package appropriately. For further information, please consult the Google Bard Official Document.

统计信息

  • 总下载量: 26.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 36
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 35
  • Watchers: 7
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-17