> ## Documentation Index
> Fetch the complete documentation index at: https://university.gumloop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tokens, Costs & How to Pay for Gumloop | AI Fundamentals

> What tokens are, why output costs more than input, how streaming works, and the practical ways to pay for and optimize your Gumloop usage.

<div id="gumloop-auth" data-token={user?.accessToken || ''} data-email={user?.email || ''} style={{display: 'none'}} />

<div className="lesson-page">
  <div className="lesson-breadcrumb">
    <a href="/">University</a>

    <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="chevron">
      <path d="m9 18 6-6-6-6" />
    </svg>

    <a href="/ai-fundamentals/what-is-an-ai-model">AI Fundamentals</a>

    <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="chevron">
      <path d="m9 18 6-6-6-6" />
    </svg>

    <span className="current">Tokens & Costs</span>
  </div>

  <div className="lesson-card">
    <h1 className="lesson-title">Tokens, Costs & How to Pay for Gumloop</h1>

    <p className="lesson-desc">AI doesn't process words the way you read them. Understanding tokens — the actual unit of AI — helps you understand costs and optimize usage.</p>

    <div className="lesson-content">
      <h2>Understanding Tokens</h2>

      <p>AI models don't read words. They read <strong>tokens</strong> — small chunks of text that are usually part of a word, a whole word, or a punctuation mark. Think of tokens as the "syllables" that AI understands.</p>

      <p>As a rough rule of thumb: <strong>1 token is about 3/4 of a word</strong>. A 100-word paragraph is roughly 130 tokens. A short email might be 200 tokens. A long document could be tens of thousands.</p>

      <div className="tokenizer-widget">
        <span className="tokenizer-label">Type something to see how it splits into tokens:</span>
        <div id="tokenizer-input" className="tokenizer-input" contentEditable="true">Gumloop connects AI to the tools you already use and gets work done.</div>

        <div className="tokenizer-output" id="tokenizer-output" />

        <div className="tokenizer-count" id="tokenizer-count" />

        <p className="tokenizer-note">This is a simplified visualization. Real tokenizers (like GPT's BPE) split text differently, but the idea is the same: AI reads chunks, not whole words.</p>
      </div>

      <p>There are two types of tokens in every AI interaction:</p>

      <table>
        <thead>
          <tr><th>Token type</th><th>What it is</th><th>Cost</th></tr>
        </thead>

        <tbody>
          <tr><td><strong>Input tokens</strong></td><td>Everything you send to the model — your message, conversation history, tool definitions, tool results</td><td>Lower cost</td></tr>
          <tr><td><strong>Output tokens</strong></td><td>Everything the model generates — its response, tool calls, reasoning</td><td>2-4x more expensive</td></tr>
        </tbody>
      </table>

      <p>Why the difference? Generating text is harder than reading it. The model has to predict each word one at a time, which requires more computation than simply processing input.</p>

      <h2>How Gumloop Credits Work</h2>

      <p>Gumloop credits are calculated based on two things:</p>

      <ul>
        <li><strong>Tokens analyzed</strong>: every input and output token the AI processes costs credits. Output tokens cost more than input tokens because generation is more compute-intensive.</li>
        <li><strong>Tool calls</strong>: tools that connect to external data sources (like Firecrawl, Apollo, or web search) have their own credit cost. Tools that stay within Gumloop (like sending a Slack message or reading a Google Doc) are free. See the <a href="https://gumloop.com/mcp" target="_blank">exact cost of each tool</a>.</li>
      </ul>

      <p>There's a hidden cost to watch for: when a tool returns data, the model has to <strong>read the entire response</strong> to use it. A tool that returns a large JSON payload (company profiles, scraped web pages, database results) can generate thousands of input tokens just from the result. Sometimes analyzing the response costs more than the tool call itself.</p>

      <p>Here's how all of this adds up in a real interaction:</p>
    </div>

    <div className="tc-walkthrough credit-walkthrough" data-step="0">
      <div className="tc-header">
        <p className="tc-subtitle">You ask an agent to check a deal in Salesforce and enrich the contact.</p>
      </div>

      <div className="tc-chat">
        <div className="tc-msg tc-msg-user tc-s0">
          <div className="tc-avatar tc-avatar-user">You</div>
          <div className="tc-bubble tc-bubble-user">What's the status of the Acme deal? Enrich their contact info.</div>
        </div>

        <div className="credit-line tc-s0">
          <span className="credit-label">Input tokens</span>
          <span className="credit-detail">Your message + agent instructions + tool definitions</span>
          <span className="credit-amount">\~1,100 tokens</span>
          <span className="credit-gumloop">2 credits</span>
        </div>

        <div className="tc-msg tc-msg-ai tc-s1">
          <div className="tc-avatar tc-avatar-ai">AI</div>

          <div className="tc-bubble tc-bubble-ai">
            <div className="tc-thinking">I should look up "Acme" in <strong>Salesforce</strong></div>
          </div>
        </div>

        <div className="credit-line tc-s1">
          <span className="credit-label">Output tokens</span>
          <span className="credit-detail">AI reasoning + tool selection</span>
          <span className="credit-amount">\~115 tokens</span>
          <span className="credit-gumloop">1 credit</span>
        </div>

        <div className="tc-msg tc-msg-system tc-s2">
          <div className="tc-system-label">Tool call</div>

          <div className="tc-tool-call">
            <div className="tc-call-header">
              <span className="tc-call-fn">salesforce\_lookup</span>
              <span className="tc-call-arrow">→</span>
              <span className="tc-call-server">Salesforce</span>
            </div>

            <div className="tc-call-params">query: "Acme"</div>

            <div className="tc-call-result">
              <span className="tc-result-label">Result:</span> Acme Corp — Stage: Negotiation, Value: \$48K, Next step: Contract review Thursday
            </div>
          </div>
        </div>

        <div className="credit-line credit-line-tool credit-line-free tc-s2">
          <span className="credit-label">Tool credit</span>
          <span className="credit-detail">Salesforce lookup</span>
          <span className="credit-gumloop credit-gumloop-free">0 credits</span>
        </div>

        <div className="credit-line tc-s2">
          <span className="credit-label">Input tokens</span>
          <span className="credit-detail">Tool result fed back to the model</span>
          <span className="credit-amount">\~500 tokens</span>
          <span className="credit-gumloop">1 credit</span>
        </div>

        <div className="tc-msg tc-msg-ai tc-s3">
          <div className="tc-avatar tc-avatar-ai">AI</div>

          <div className="tc-bubble tc-bubble-ai">
            <div className="tc-thinking">Now I'll enrich the contact using <strong>Apollo</strong></div>
          </div>
        </div>

        <div className="credit-line tc-s3">
          <span className="credit-label">Output tokens</span>
          <span className="credit-detail">AI reasoning + tool selection</span>
          <span className="credit-amount">\~110 tokens</span>
          <span className="credit-gumloop">1 credit</span>
        </div>

        <div className="tc-msg tc-msg-system tc-s3">
          <div className="tc-system-label">Tool call</div>

          <div className="tc-tool-call">
            <div className="tc-call-header">
              <span className="tc-call-fn">apollo\_enrich</span>
              <span className="tc-call-arrow">→</span>
              <span className="tc-call-server">Apollo</span>
            </div>

            <div className="tc-call-params">company: "Acme Corp"</div>

            <div className="tc-call-result">
              <span className="tc-result-label">Result:</span> John Smith, VP Sales, [john@acme.com](mailto:john@acme.com), LinkedIn, phone, company details, funding history, tech stack, employee count ...
            </div>
          </div>
        </div>

        <div className="credit-line credit-line-tool credit-line-paid tc-s3">
          <span className="credit-label">Tool credit</span>
          <span className="credit-detail">Apollo enrichment</span>
          <span className="credit-gumloop credit-gumloop-paid">5 credits</span>
        </div>

        <div className="credit-line tc-s3">
          <span className="credit-label">Input tokens</span>
          <span className="credit-detail">Full JSON response analyzed by the model</span>
          <span className="credit-amount">\~4,000 tokens</span>
          <span className="credit-gumloop">7 credits</span>
        </div>

        <div className="tc-msg tc-msg-ai tc-s4">
          <div className="tc-avatar tc-avatar-ai">AI</div>
          <div className="tc-bubble tc-bubble-ai">The Acme Corp deal is in Negotiation, valued at \$48K with a contract review Thursday. The key contact is John Smith (VP Sales) at [john@acme.com](mailto:john@acme.com).</div>
        </div>

        <div className="credit-line tc-s4">
          <span className="credit-label">Output tokens</span>
          <span className="credit-detail">Final response to you</span>
          <span className="credit-amount">\~110 tokens</span>
          <span className="credit-gumloop">1 credit</span>
        </div>

        <div className="credit-total tc-s5">
          <div className="credit-total-header">Total for this interaction</div>

          <div className="credit-total-rows">
            <div className="credit-total-row"><span>Input tokens (\~5,600)</span><span>10 credits</span></div>
            <div className="credit-total-row"><span>Output tokens (\~335)</span><span>3 credits</span></div>
            <div className="credit-total-row"><span>Salesforce lookup</span><span>0 credits</span></div>
            <div className="credit-total-row"><span>Apollo enrichment</span><span>5 credits</span></div>
            <div className="credit-total-row credit-total-sum"><span>Total</span><span>18 credits</span></div>
          </div>
        </div>
      </div>

      <div className="tc-controls">
        <button type="button" className="pf-nav-btn tc-prev" style={{opacity: '0.3'}}>
          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <path d="M19 12H5" />

            <path d="m12 19-7-7 7-7" />
          </svg>
        </button>

        <div className="tc-step-pills">
          <button type="button" className="tc-pill tc-pill-0 active">Ask</button>
          <button type="button" className="tc-pill tc-pill-1">Reason</button>
          <button type="button" className="tc-pill tc-pill-2">Salesforce</button>
          <button type="button" className="tc-pill tc-pill-3">Enrich</button>
          <button type="button" className="tc-pill tc-pill-4">Respond</button>
          <button type="button" className="tc-pill tc-pill-5">Total</button>
        </div>

        <button type="button" className="pf-nav-btn tc-next">
          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <path d="M5 12h14" />

            <path d="m12 5 7 7-7 7" />
          </svg>
        </button>
      </div>
    </div>

    <div className="lesson-content">
      <h2>Paying for Gumloop</h2>

      <p>Gumloop offers two ways to handle AI costs:</p>

      <h3>Gumloop Credits</h3>

      <p>The simplest option. You buy credits, and Gumloop handles the model provider relationship. Credits cover two things: <strong>inference</strong> (the tokens the AI reads and generates) and <strong>tool calls</strong> (actions like looking up data in Salesforce, sending an email, or scraping a website). This is the right choice for most teams. No API keys to manage, no billing complexity.</p>

      <h3>Bring Your Own API Key (BYOK)</h3>

      <p>If you already have an account with Anthropic, OpenAI, or another provider, you can plug in your own API key. You pay the provider directly for model usage and Gumloop separately for platform features. This is useful if you have negotiated enterprise rates or need to keep billing centralized.</p>

      <h3>Choosing the Right Model</h3>

      <p>Remember from Lesson 1: start with a capable model, then move down. The same principle applies to costs:</p>

      <ol>
        <li>Build your workflow with a strong model (e.g., Claude Sonnet) to get the quality right</li>
        <li>Once it works, try a faster, cheaper model (e.g., Claude Haiku) and compare results</li>
        <li>If the output quality is still good enough, you've just cut your costs significantly</li>
      </ol>

      <div className="lesson-tip">
        <div className="lesson-tip-header">
          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" />

            <path d="m9 12 2 2 4-4" />
          </svg>

          <span>The biggest cost lever</span>
        </div>

        <p>Model choice is the single biggest factor in cost. The difference between a top-tier model and a mid-tier one can be 10x or more per token. Always test whether a cheaper model can handle your use case.</p>
      </div>

      <h2>Optimizing Token Usage</h2>

      <p>Since you pay per token, being smart about token usage directly affects cost:</p>

      <ul>
        <li><strong>Caching</strong> — if you ask the same question repeatedly (or similar questions), some providers offer prompt caching that reuses previously processed input tokens at a discount</li>
        <li><strong>Context management</strong> — every message in a conversation gets re-sent to the model. Long conversations accumulate tokens fast. Starting a new conversation for a new topic keeps costs down.</li>
        <li><strong>Be intentional about prompt size</strong> — a 50-word instruction often works as well as a 500-word one. Shorter prompts mean fewer input tokens and lower costs.</li>
        <li><strong>Choose the right model</strong> — a smaller, faster model costs less per token. If the task doesn't need the most capable model, don't pay for it.</li>
      </ul>

      <form className="quiz-widget">
        <h3>Quiz: Why do output tokens cost more than input tokens?</h3>

        <input type="radio" name="q-quiz" id="q-q0" className="quiz-input" />

        <input type="radio" name="q-quiz" id="q-q1" className="quiz-input" />

        <input type="radio" name="q-quiz" id="q-q2" className="quiz-input" />

        <input type="checkbox" id="q-check" className="quiz-check-input" />

        <label htmlFor="q-q0" className="quiz-option">
          <span className="quiz-circle" />

          <span>Output tokens are longer and contain more information than input tokens.</span>
        </label>

        <label htmlFor="q-q1" className="quiz-option quiz-correct">
          <span className="quiz-circle" />

          <span>Generating text requires more computation than reading it — the model predicts each word one at a time.</span>
        </label>

        <label htmlFor="q-q2" className="quiz-option">
          <span className="quiz-circle" />

          <span>Output tokens are stored permanently, while input tokens are discarded after processing.</span>
        </label>

        <div className="quiz-explain-correct quiz-explanation">
          Correct! Generation is harder than comprehension. The model has to predict each word sequentially, which requires more compute than simply processing the input.
        </div>

        <div className="quiz-explain-wrong quiz-explanation">
          Not quite. Input and output tokens are the same size — the cost difference comes from how much computation each requires.
        </div>

        <div className="quiz-actions">
          <label htmlFor="q-check" className="quiz-check-btn">Check</label>
          <button type="reset" className="quiz-reset-btn">↺ Reset</button>
        </div>
      </form>
    </div>
  </div>

  <div className="lesson-nav-grid">
    <a href="/ai-fundamentals/hallucinations" className="lesson-nav-card">
      <span className="nav-label">
        <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <path d="M19 12H5" />

          <path d="m12 19-7-7 7-7" />
        </svg>

        Previous Lesson
      </span>

      <span className="nav-title">Hallucinations</span>
    </a>

    <a href="/ai-fundamentals/context" className="lesson-nav-card lesson-nav-next">
      <span className="nav-label">
        Next Lesson

        <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <path d="M5 12h14" />

          <path d="m12 5 7 7-7 7" />
        </svg>
      </span>

      <span className="nav-title">Context</span>
    </a>
  </div>
</div>
