Integration

    Four steps to agents inside your product

    Configuration takes 15–30 minutes. The snippet is a few lines.

    Architecture

    Three levels, one runtime.

    GTWYAgent runtime, isolation, metering
    Your platformYour brand, your pricing, your usage data
    Your customersIsolated agents, keys and knowledge
    cus_4127cus_4128cus_4129cus_4130cus_4131+413 more

    GTWY runs the agent infrastructure. You run your product. Each of your customers gets their own isolated environment inside it.

    The four steps

    What you actually do.

    Step 01

    Configure your embed

    In the GTWY panel you decide what your users can reach: which models they may select, which tools are available to them, how the builder is themed, and what limits apply per customer.

    • Available models and the fallback for each
    • Tool catalogue exposed to your users
    • Theme tokens — colour, type, radius, logo
    • Per-customer run and spend limits
    GTWY panel · Embed configuration
    Modelsclaude-sonnet-4-6, gpt-4o
    Tools2,000+ enabled
    ThemeCustom — your tokens
    Run cap5,000 / customer / month
    PublishDisabled — embedded account
    Step 02

    Sign a token with your JWT secret

    Once your embed is configured we share a JWT secret with you. You sign a token with it on your own backend, one per user, and hand that token back to us — the secret never leaves your server and we never see your users’ credentials.

    The user_id you sign into the token is the identity everything else hangs off: it decides which agents and documents that session can reach, and it is what usage and cost are attributed to later.

    Your backend
    import jwt from "jsonwebtoken";
    
    // GTWY_JWT_SECRET is shared with you after configuration
    const token = jwt.sign(
      {
        "org_id": "GTWY org id",
        "folder_id": "GTWY folder id",
        "user_id": "Your_user_id"
      },
      process.env.GTWY_JWT_SECRET,
      { expiresIn: "1h" }
    );
    Step 03

    Add the script with that token

    This is the whole integration. Drop the script into the page where the builder should appear and pass the token you just signed. It renders inside your product, themed with the configuration from step one.

    Your app
    <script
      id="gtwy-main-script"
      embedToken="Add your embed token here"
      src="https://gtwy.ai/gtwy_dev.js"
      parentId="Your_parent_id"
    ></script>
    Step 04

    Get the cost back

    Every agent run returns its total cost with the response — the run fee and the token cost, itemised. You don’t have to reconcile anything at the end of the month to know what a run cost you.

    There is also a usage API keyed on the same user_id you signed into the token, so you can pull a period total per user. That is what you bill your customers against.

    Returned with every run
     "response": {
            "data": {
                "id": "resp_0b7dbf081a577dbe006a952eddfb1887d19c7cb80c32260e77",
                "image_urls": [],
                "content": "Hi there",
                "reasoning": null,
                "model": "gpt-5-nano",
                "role": "assistant",
                "finish_reason": "completed",
                "tools_data": {},
                "images": [],
                "annotations": null,
                "fallback": false,
                "firstAttemptError": "",
                "message_id": "99dc0d94-a50e-11f1-bb30-caab87060bcf"
            },
            "usage": {
                "total_tokens": 11113,
                "input_tokens": 7999,
                "output_tokens": 3114,
                "cached_tokens": 0,
                "cache_read_input_tokens": 0,
                "cache_creation_input_tokens": 0,
                "reasoning_tokens": 2176,
                "audio_duration_seconds": 0,
                "audio_duration_minutes": 0.0,
                "cost": 0.0016455500000000002
            }
        }
    Usage by user
    GET /v1/usage?user_id=cus_4127&month=2026-08
    
    {
      "user_id":   "cus_4127",
      "runs":      1284,
      "total_usd": 82.60
    }

    AI-assisted setup

    Or hand it to your coding agent.

    The four steps above are written up as an agent skill — the token signing, both script variants, the window.GtwyEmbed calls, the event payloads and the configuration options. Drop it into your repo and your coding agent does the integration with the real API shapes in front of it, instead of guessing.

    Install the skill

    Run this at the root of the project you want GTWY embedded in. It works with Claude Code and any agent that reads skill files from the repo.

    • Knows which script variant to use — and asks rather than guessing
    • Keeps the signing key server-side by default
    • Wires the drafted/published events back to your database

    Download SKILL.md

    Your project root
    mkdir -p .claude/skills/gtwy-embed-integration
    
    curl -o .claude/skills/gtwy-embed-integration/SKILL.md \
      https://gtwy.ai/gtwy-embed-skill.md
    Then just ask
    "Add the GTWY embed to my app — sign the token
     on my backend and open it from the Agents button."

    Inside one run

    All of this is one run.

    A run is one complete agent task. Everything the agent does to finish that task happens inside it — you are not charged per step.

    1. 01Request inYour user’s input arrives with their tenant token
    2. 02Model callThe agent decides what to do next
    3. 03Tool callsAny number of them, with retries and fallbacks
    4. 04Knowledge lookupRetrieval against that customer’s documents
    5. 05GuardrailsPII checks and output policy before anything leaves
    6. 06Response outReturned to your user inside your product

    One run. Model calls, tool calls, agent-to-agent hops, knowledge lookups, fallbacks and retries are all included.

    Tools

    2,000+ integrations, via ViaSocket.

    Your users’ agents can act in the software they already run on. Nothing to build per integration, nothing to maintain when an API changes.

    Custom tools

    Register your own endpoints as tools and they appear in the builder alongside the rest. Your users never know which came from where.

    Knowledge

    What the agent knows.

    Your customers upload their own documents; we handle chunking, embedding, re-indexing and retrieval. Lookups happen inside the run — it is not a separate purchase.

    refund-policy.pdf41 pages · indexed
    shipping-terms.md6 pages · indexed
    faq-export.csv1,204 rows · indexed
    Scoped to customer cus_4127 — no other customer can retrieve from it.

    Observability

    What you see as the platform.

    Runs

    Every run, per customer, with the full step trace.

    Latency

    Time per step, so you can see what is slow and why.

    Failures

    Failure reason, which step, and whether a fallback recovered it.

    Per-customer usage

    Run counts attributed to each of your customers.

    Logs

    Exportable per customer for their own compliance requests.

    Spend

    Run cost and token cost, separated, against each customer’s cap.

    See it running on your stack.

    Bring a staging environment and we’ll integrate it live.

    Read the docs