5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>CerebrasCoder</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com" />
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9 <link
10 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"
11 rel="stylesheet"
12 />
21 <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."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
24
25
211 } catch (error) {
212 Toastify({
213 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
214 position: "center",
215 duration: 3000,
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [
71. Create a [Val Town account](https://www.val.town/auth/signup)
82. Fork this project
93. Create a [Replicate API token](https://replicate.com/accounts/api-tokens).
104. Click on **Environment variables** on the Val Town project and add your token.
115. Click on the name of the project at the top of the page.
18 const { prompt } = await c.req.json();
19
20 const replicate = new Replicate({ auth: Deno.env.get("REPLICATE_API_TOKEN") });
21 const model = "black-forest-labs/flux-schnell";
22 const output = await replicate.run(model, {
19 const { prompt } = await c.req.json();
20
21 const replicate = new Replicate({ auth: Deno.env.get("REPLICATE_API_TOKEN") });
22 const model = "black-forest-labs/flux-schnell";
23 const output = await replicate.run(model, {
70 setError("");
71 try {
72 const response = await fetch("/api/adopt", {
73 method: "POST",
74 headers: {
24This is the main bussiness logic unit where we get stars, get entry data from feedbin for each star and then add those to an RSS feed object and convert that RSS feed object to an string full of XML.
25
26### feedbinAPI
27
28This is a helper for working with the feedbin API and its auth. You can think of it as the Feedbin Service.
2
3export async function getStars() {
4 return await feedbinFetch("https://api.feedbin.com/v2/starred_entries.json", {});
5}
6
7export function getEntry(entryId: number) {
8 return feedbinFetch(`https://api.feedbin.com/v2/entries/${entryId}.json`, {});
9}
10
24 - Ensure the token has read/write access to _Contents_ for the repo
25 - Copy the access token and add that as the `GITHUB_TOKEN` env var in this val
261. Add a new [Val Town API token][] with read/write permissions. Add that token to the val's env vars as `VALTOWN_TOKEN`
271. Add a `VAL_SECRET` env var to the val. Use this secret to sign the webhook POST request to the `/push` endpoint. Use this endpoint to commit vals from Val Town to your GitHub repo.
28
68
69- `GITHUB_TOKEN`: Read/write GitHub personal access token for reading and writing repo contents
70- `VALTOWN_TOKEN`: ValTown API token (with read/write Vals permissions) for writing updates from GitHub
71- `GITHUB_WEBHOOK_SECRET`: secret for verifying webhooks from GitHub
72- `VAL_SECRET`: secret for verifying requests to the `/push` endpoint
98[github oauth app]: https://github.com/settings/developers
99[access token]: https://github.com/settings/tokens
100[val town api token]: https://www.val.town/settings/api
101[troubleshooting]: #troubleshooting
102