agentic-ai-engineering/site/.vitepress/dist/assets/api-keys.md.D2Kyj8T3.js

13 lines
10 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{c as t,Q as s,j as a,m as i}from"./chunks/framework.BPKcPtvA.js";const c=JSON.parse('{"title":"API Key Setup Guide","description":"","frontmatter":{},"headers":[],"relativePath":"api-keys.md","filePath":"api-keys.md","lastUpdated":1780488472000}'),n={name:"api-keys.md"};function r(o,e,h,l,p,d){return s(),a("div",null,[...e[0]||(e[0]=[i(`<h1 id="api-key-setup-guide" tabindex="-1">API Key Setup Guide <a class="header-anchor" href="#api-key-setup-guide" aria-label="Permalink to &quot;API Key Setup Guide&quot;"></a></h1><p>Every lab needs at least one LLM API key. If you don&#39;t have one, the mock LLM handles everything offline.</p><hr><h2 id="quick-start-use-the-mock-llm-no-key-needed" tabindex="-1">Quick Start: Use the Mock LLM (No Key Needed) <a class="header-anchor" href="#quick-start-use-the-mock-llm-no-key-needed" aria-label="Permalink to &quot;Quick Start: Use the Mock LLM (No Key Needed)&quot;"></a></h2><p>All labs include automatic mock LLM fallback. Run without any setup:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">python</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> labs/L1-first-agent/solution.py</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> test.txt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Summarize this file&quot;</span></span></code></pre></div><p>The mock client returns realistic responses. Your code runs identically with real or mock LLM.</p><hr><h2 id="provider-keys" tabindex="-1">Provider Keys <a class="header-anchor" href="#provider-keys" aria-label="Permalink to &quot;Provider Keys&quot;"></a></h2><h3 id="anthropic-claude-—-recommended" tabindex="-1">Anthropic (Claude) — Recommended <a class="header-anchor" href="#anthropic-claude-—-recommended" aria-label="Permalink to &quot;Anthropic (Claude) — Recommended&quot;"></a></h3><p><strong>Best for</strong>: All course labs. Claude Sonnet is the default model used throughout.<br><strong>Cost</strong>: Free credits available on signup. Labs cost ~$0.01-0.05 each with Sonnet.<br><strong>Get key</strong>: <a href="https://console.anthropic.com/settings/keys" target="_blank" rel="noreferrer">console.anthropic.com</a><br><strong>Set it</strong>:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Windows PowerShell</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$env:ANTHROPIC_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sk-ant-...&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Mac/Linux</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ANTHROPIC_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sk-ant-...&quot;</span></span></code></pre></div><h3 id="openai-gpt" tabindex="-1">OpenAI (GPT) <a class="header-anchor" href="#openai-gpt" aria-label="Permalink to &quot;OpenAI (GPT)&quot;"></a></h3><p><strong>Best for</strong>: Labs using the OpenAI SDK.<br><strong>Cost</strong>: Free credits on signup. GPT-4o costs ~$0.02-0.10 per lab.<br><strong>Get key</strong>: <a href="https://platform.openai.com/api-keys" target="_blank" rel="noreferrer">platform.openai.com/api-keys</a><br><strong>Set it</strong>:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OPENAI_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sk-...&quot;</span></span></code></pre></div><h3 id="google-gemini" tabindex="-1">Google Gemini <a class="header-anchor" href="#google-gemini" aria-label="Permalink to &quot;Google Gemini&quot;"></a></h3><p><strong>Best for</strong>: Cost-sensitive experimentation. Gemini Flash is $0.15/M tokens.<br><strong>Cost</strong>: Free tier available (60 requests/minute).<br><strong>Get key</strong>: <a href="https://aistudio.google.com/apikey" target="_blank" rel="noreferrer">aistudio.google.com/apikey</a><br><strong>Set it</strong>:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> GEMINI_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;...&quot;</span></span></code></pre></div><h3 id="openrouter-multi-provider" tabindex="-1">OpenRouter (Multi-Provider) <a class="header-anchor" href="#openrouter-multi-provider" aria-label="Permalink to &quot;OpenRouter (Multi-Provider)&quot;"></a></h3><p><strong>Best for</strong>: Accessing multiple models from one key.<br><strong>Cost</strong>: Pay-as-you-go. Free tier available for some models.<br><strong>Get key</strong>: <a href="https://openrouter.ai/keys" target="_blank" rel="noreferrer">openrouter.ai/keys</a><br><strong>Set it</strong>:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OPENROUTER_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sk-or-...&quot;</span></span></code></pre></div><hr><h2 id="which-key-should-you-get" tabindex="-1">Which Key Should You Get? <a class="header-anchor" href="#which-key-should-you-get" aria-label="Permalink to &quot;Which Key Should You Get?&quot;"></a></h2><table tabindex="0"><thead><tr><th>If you...</th><th>Get</th></tr></thead><tbody><tr><td>Want the simplest setup</td><td><strong>None</strong> (use mock LLM)</td></tr><tr><td>Want to follow the course exactly</td><td><strong>Anthropic</strong> (Claude Sonnet)</td></tr><tr><td>Already have OpenAI access</td><td><strong>OpenAI</strong> (GPT-4o or o3-mini)</td></tr><tr><td>Want the cheapest option</td><td><strong>Gemini</strong> (Flash is $0.15/M)</td></tr><tr><td>Want to try different models</td><td><strong>OpenRouter</strong> (one key for everything)</td></tr></tbody></table><hr><h2 id="testing-your-key" tabindex="-1">Testing Your Key <a class="header-anchor" href="#testing-your-key" aria-label="Permalink to &quot;Testing Your Key&quot;"></a></h2><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Anthropic</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">python</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -c</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;from anthropic import Anthropic; c=Anthropic(); print(c.messages.create(model=&#39;claude-sonnet-4&#39;, max_tokens=50, messages=[{&#39;role&#39;:&#39;user&#39;,&#39;content&#39;:&#39;hi&#39;}]).content)&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># OpenAI</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">python</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -c</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;from openai import OpenAI; c=OpenAI(); print(c.chat.completions.create(model=&#39;gpt-4o&#39;, messages=[{&#39;role&#39;:&#39;user&#39;,&#39;content&#39;:&#39;hi&#39;}]).choices[0].message.content)&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Mock (no key needed)</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">python</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -c</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;from mock_llm import MockAnthropic; c=MockAnthropic(); print(c.messages.create(messages=[{&#39;role&#39;:&#39;user&#39;,&#39;content&#39;:&#39;hi&#39;}]).content[0].text)&quot;</span></span></code></pre></div><hr><h2 id="free-tier-limits" tabindex="-1">Free Tier Limits <a class="header-anchor" href="#free-tier-limits" aria-label="Permalink to &quot;Free Tier Limits&quot;"></a></h2><table tabindex="0"><thead><tr><th>Provider</th><th>Free Credits</th><th>Rate Limit</th></tr></thead><tbody><tr><td>Anthropic</td><td>$5-10 signup credit</td><td>Varies by model</td></tr><tr><td>OpenAI</td><td>$5-18 signup credit</td><td>Varies by tier</td></tr><tr><td>Gemini</td><td>Free tier (60 req/min)</td><td>60 requests/minute</td></tr><tr><td>OpenRouter</td><td>Varies by model</td><td>Varies</td></tr></tbody></table><p>The course uses ~$0.50-2.00 in API costs total with Anthropic, or $0 with the mock LLM.</p>`,31)])])}const g=t(n,[["render",r]]);export{c as __pageData,g as default};