Quickstart

    Your first agent run in five minutes

    Step 01

    Configure the agent

    Build the agent in the panel first — its instructions, which model it runs on, which tools it can call and what it knows. None of this is passed at call time; the agent already holds it.

    GTWY panel · New agent
    NameSupport agent
    InstructionsCheck the order, apply the refund policy
    Modelclaude-sonnet-4-6 · fallback gpt-4o
    Toolsorders.lookup · stripe.refund
    Knowledgerefund-policy.pdf

    Test it in the panel before you publish. It is a much faster loop than testing through the API.

    Step 02

    Publish and get your auth key

    Publishing is what makes the agent callable. You get an agent ID and an auth key — the key is shown once, so store it somewhere your server can read and nowhere else.

    GTWY panel · Published
    Agent IDagt_4127
    Auth keygtwy_live_9f4c…a17e
    StatusLive

    Keep the auth key on your server. Never ship it to a browser — that is what embed tokens are for.

    Step 03

    Make the first call

    Name the agent, send an input. Everything the agent needs it already has — the snippet below fills in a real prompt with two variables, so you can see the variables block populate.

    First call
    curl --location 'https://api.gtwy.ai/api/v2/model/chat/completion' \
      --header 'pauthkey: YOUR_GENERATED_PAUTHKEY' \
      --header 'Content-Type: application/json' \
      --data '{
      "user": "YOUR_USER_QUESTION",
      "agent_id": "agt_4127",
      "thread_id": "YOUR_THREAD_ID",
      "response_type": "text",
      "variables": {
        "order_id": "YOUR_ORDER_ID_VALUE",
        "customer_name": "YOUR_CUSTOMER_NAME_VALUE"
      }
    }'
    Response
    {
      "success": true,
      "response": {
        "data": {
          "id": "chatcmpl-d7a6874d-a82f-4cb5-8a40-1c899722c64f",
          "content": "Response from the AI assistant",
          "model": "your-model-name",
          "role": "assistant",
          "tools_data": {},
          "fallback": false,
          "finish_reason": "completed",
          "message_id": "abdd920a-ec69-11f0-b14a-928ade59a1ee"
        },
        "usage": {
          "total_tokens": 500,
          "input_tokens": 300,
          "output_tokens": 200,
          "cached_tokens": 0,
          "cache_read_input_tokens": 0,
          "cache_creation_input_tokens": 0,
          "reasoning_tokens": 0,
          "cost": 0.0025
        }
      }
    }
    id
    Identifies this run in logs, traces and the usage API.
    content / output_text
    What the agent produced. A string unless you asked for structured output.
    role
    Always assistant on success — useful when parsing generically.
    model
    Which model actually served it — useful when fallback fired.
    usage.cost
    The run fee, deducted from your wallet as it executed.

    What just happened

    That last call was one run.

    You sent one input. The agent you configured called a model, ran its tool, retrieved from its knowledge, checked the output and returned it. Five things, one run, one charge.

    1. 01Request inYour input, your auth key, the agent ID
    2. 02Model callThe agent decides what to do
    3. 03Tool callorders.lookup, with retries
    4. 04KnowledgeRetrieval over your documents
    5. 05GuardrailsChecked before it leaves
    6. 06Response outWith its trace and its cost

    Get your API key.

    Free tier, no card. You can be running against it in five minutes.