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`
10
11# Todos
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: [
1148 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1149 <title>CerebrasCoder</title>
1150 <link rel="preconnect" href="https://fonts.googleapis.com" />
1151 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1152 <link
1153 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"
1154 rel="stylesheet"
1155 />
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`
10
11# Todos
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: [
1148 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1149 <title>CerebrasCoder</title>
1150 <link rel="preconnect" href="https://fonts.googleapis.com" />
1151 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1152 <link
1153 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"
1154 rel="stylesheet"
1155 />
51**The "InvocationTracker" is designed to be accessed simultaneously from multiple concurrently running vals without interfering with each other.**
52
53## API Reference ##
54
55- `static async new (Name:string, Granularity:number = 15*60*1000):Promise<InvocationTracker>`<br>
26 * DO NOT use the alert(), prompt(), or confirm() methods.
27
28 * If the user's app needs weather data, use open-meteo unless otherwise specified because it doesn't require any API keys.
29
30 * Tastefully add a view source link back to the user's val if there's a natural spot for it. Generate the val source url via `import.meta.url.replace("esm.town", "val.town")`. This link element should include a target="_top" attribute.
38 Val Town's client-side catch script automatically catches client-side errors to aid in debugging.
39
40 * Don't use any environment variables unless strictly necessary. For example use APIs that don't require a key.
41 If you need environment variables use `Deno.env.get('keyname')`
42
10## Getting Started
11
121. Create a [Val Town API token](https://www.val.town/settings/api) with Val read and write permissions
132. Paste the token into the input box and get started
14
15## Forking the Project
16
17You'll need to get an **Open Router API key**.
18We choose Open Router so we could easily switch between
19all models. We soon want to make it so you can choose your
20model from a dropdown, but we're having trouble formatting the api calls such that they work on all providers. Maybe we need to switch to the vercel sdk
21To run it:
22
231. Get your free Steel API key at https://app.steel.dev/settings/api-keys
242. Add it to your [Val Town Environment Variables](https://www.val.town/settings/environment-variables) as `STEEL_API_KEY`
253. Click `Fork` on this val
264. Click `Run` on this val
72
73- [Steel Documentation](https://docs.steel.dev)
74- [API Reference](https://docs.steel.dev/api-reference)
75- [Discord Community](https://discord.gg/gPpvhNvc5R)
6});
7
8const STEEL_API_KEY = process.env.STEEL_API_KEY;
9// Initialize Steel client with the API key from environment variables
10const client = new Steel({
11 steelAPIKey: STEEL_API_KEY,
12});
13
36 // Connect Puppeteer to the Steel session
37 browser = await puppeteer.connect({
38 browserWSEndpoint: `wss://connect.steel.dev?apiKey=${STEEL_API_KEY}&sessionId=${session.id}`,
39 });
40
6});
7
8const STEEL_API_KEY = process.env.STEEL_API_KEY;
9// Initialize Steel client with the API key from environment variables
10const client = new Steel({
11 steelAPIKey: STEEL_API_KEY,
12});
13
36 // Connect Puppeteer to the Steel session
37 browser = await puppeteer.connect({
38 browserWSEndpoint: `wss://connect.steel.dev?apiKey=${STEEL_API_KEY}&sessionId=${session.id}`,
39 });
40