Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
antergone committed Dec 18, 2023
1 parent 596a54c commit b8d0c2d
Show file tree
Hide file tree
Showing 9 changed files with 471 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

node_modules/
.next/
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@

# palm-proxy
Palm API proxy on Vercel Edge
Google PaLM API proxy on Vercel Edge

## Deploy

### Deploy With Vercel

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fantergone%2Fpalm-proxy)
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
19 changes: 19 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @type {import('next').NextConfig} */
const config = {
async rewrites() {
return [
{
source: "/:path*",
"has": [
{
"type": "query",
"key": "key",
}
],
destination: "/api/proxy"
},
];
},
};

export default config;
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "palm-proxy",
"version": "0.0.0",
"devDependencies": {
"@types/node": "latest",
"@types/react": "latest",
"typescript": "^5.3.3"
},
"private": true,
"scripts": {
"next": "next",
"build": "next build"
},
"dependencies": {
"next": "canary",
"react": "latest",
"react-dom": "latest"
}
}
20 changes: 20 additions & 0 deletions pages/api/proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import handleRequest from "../../src/handle-request";

export const config = {
runtime: "edge",
// Available languages and regions for Google AI Studio and Gemini API
// https://ai.google.dev/available_regions
// https://vercel.com/docs/concepts/edge-network/regions
regions: [
"cle1",
"iad1",
"pdx1",
"sfo1",
"sin1",
"syd1",
"hnd1",
"kix1",
],
};

export default handleRequest;
311 changes: 311 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b8d0c2d

Please sign in to comment.