1import { bitlyAPI } from "https://esm.town/v/galligan/bitlyAPI";
2
3export let bitlyShortenLink = async ({ long_url, token, domain, group_guid }) =>
4 bitlyAPI({
5 token,
6 endpoint: "shorten",
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
212 } catch (error) {
213 Toastify({
214 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
215 position: "center",
216 duration: 3000,
1024 };
1025 } else {
1026 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1027 const completion = await client.chat.completions.create({
1028 messages: [
1149 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1150 <title>CerebrasCoder</title>
1151 <link rel="preconnect" href="https://fonts.googleapis.com" />
1152 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1153 <link
1154 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1155 rel="stylesheet"
1156 />
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1168
1169
2 import { floatingQuotaTracker } from 'https://esm.town/v/rozek/floatingQuotaTracker'
3
4/**** free, but rate-limited access to the OpenRouter API ****/
5
6 export default async function (Request:Request):Promise<Response> {
63
64 try {
65 const APIKey = process.env.OpenRouter_APIKey
66
67 if (stream == true) {
68 const OpenRouterStream = await fetch(
69 'https://openrouter.ai/api/v1/chat/completions',{
70 method:'POST',
71 headers:{
72 'Authorization':`Bearer ${APIKey}`,
73 'Content-Type': 'application/json',
74 },
89 } else {
90 const OpenRouterCompletion = await fetch(
91 'https://openrouter.ai/api/v1/chat/completions',{
92 method:'POST',
93 headers:{
94 'Authorization':`Bearer ${APIKey}`,
95 'Content-Type': 'application/json'
96 },
4
5[LastLogin](https://lastlogin.io/) is a decentralized hosted auth provider
6that enables login to any app through email, Google, Github, etc without API keys.
7
8This val exports middleware that can be added to any HTTP val.
68) {
69 return async (req: Request) => {
70 const { api } = await import("https://esm.town/v/pomdtr/api");
71 const { deleteCookie, getCookies, setCookie } = await import("jsr:@std/http/cookie");
72
20 try {
21 // Use a more reliable, free TikTok video download service
22 const response = await fetch(`https://api.tikmate.app/api/lookup`, {
23 method: 'POST',
24 headers: {
5
6const app = new Hono();
7const openai = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY_VOICE") });
8
9class TranscriptionService {
18 return transcription;
19 } catch (error) {
20 console.error("OpenAI API error:", error);
21 throw error;
22 }
421 return c.text(translation);
422 } catch (error) {
423 console.error("OpenAI API error:", error);
424 return c.text("Error occurred during translation", 500);
425 }
448 });
449 } catch (error) {
450 console.error("OpenAI API error:", error);
451 return c.text("Error occurred during speech generation", 500);
452 }
3The app is set up so you can easily have a conversation between two people. The app will translate between the two selected languages, in each voice, as the speakers talk.
4
5Add your OpenAI API Key, and make sure to open in a separate window for Mic to work.
9To use it on your own Val Town SQLite database, [fork it](https://www.val.town/v/stevekrouse/sqlite_admin/fork) to your account.
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).