Skip to content
Skip to Content
Coder Docs

Get AI Gateway session threads

GET
/api/v2/ai-gateway/sessions/{session_id}

Alias: also available at /api/v2/aibridge/sessions/{session_id} for backward compatibility.

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

session_id*string

Session ID (client_session_id or interception UUID)

Query Parameters

after_id?string

Thread pagination cursor (forward/older)

before_id?string

Thread pagination cursor (backward/newer)

limit?integer

Number of threads per page (default 50)

Response Body

OK

application/json
  1. response
client?string
ended_at?string
Formatdate-time
id?string
initiator?
metadata?
models?array<string>
network_call_logs?array<>

NetworkCallLogs is the chronological list of individual network calls made during the session, holding the earliest calls up to a server-side cap. NetworkCalls remains authoritative for whole-session totals, so a shorter list than NetworkCalls.Total means the list was truncated. Empty when the session did not pass through Agent Firewall.

network_calls?

NetworkCalls summarizes the Agent Firewall network calls made during the session. A nil value means the session did not pass through Agent Firewall, so network call monitoring was not active, which the UI surfaces as "Disabled".

network_domain_count?integer
network_top_domains?array<>

NetworkTopDomains lists the most contacted destination hosts, ordered by call count descending. NetworkDomainCount is the total number of distinct domains, used to render a "+N more" overflow beyond the listed domains.

page_ended_at?string
Formatdate-time
page_started_at?string
Formatdate-time
providers?array<string>
started_at?string
Formatdate-time
threads?array<>
token_usage_summary?

The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.

curl -X GET \	"$CODER_URL/api/v2/ai-gateway/sessions/{session_id}" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
Example Response200
{  "client": "string",  "ended_at": "2019-08-24T14:15:22Z",  "id": "string",  "initiator": {    "avatar_url": "http://example.com",    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "username": "string"  },  "metadata": {    "property1": null,    "property2": null  },  "models": [    "string"  ],  "network_call_logs": [    {      "allowed": true,      "captured_at": "2019-08-24T14:15:22Z",      "created_at": "2019-08-24T14:15:22Z",      "detail": "string",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "matched_rule": "string",      "method": "string",      "proto": "string",      "sequence_number": 0,      "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82"    }  ],  "network_calls": {    "blocked": 0,    "total": 0  },  "network_domain_count": 0,  "network_top_domains": [    {      "count": 0,      "domain": "string"    }  ],  "page_ended_at": "2019-08-24T14:15:22Z",  "page_started_at": "2019-08-24T14:15:22Z",  "providers": [    "string"  ],  "started_at": "2019-08-24T14:15:22Z",  "threads": [    {      "agent_firewall_sequence_number": 0,      "agent_firewall_session_id": "3735294f-18b1-4e7a-a269-99c30f0b30e7",      "agentic_actions": [        {          "attribution": {            "property1": "string",            "property2": "string"          },          "interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",          "model": "string",          "priced_model": {            "cache_read_price": 0,            "cache_write_price": 0,            "input_price": 0,            "model": "string",            "output_price": 0          },          "thinking": [            {              "text": "string"            }          ],          "token_usage": {            "cache_read_input_tokens": 0,            "cache_write_input_tokens": 0,            "cost_micros": 0,            "has_unpriced_usage": true,            "input_tokens": 0,            "metadata": {              "property1": null,              "property2": null            },            "output_tokens": 0          },          "tool_calls": [            {              "created_at": "2019-08-24T14:15:22Z",              "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",              "injected": true,              "input": "string",              "interception_id": "34d9b688-63ad-46f4-88b5-665c1e7f7824",              "metadata": {                "property1": null,                "property2": null              },              "provider_response_id": "string",              "server_url": "string",              "tool": "string"            }          ]        }      ],      "attribution": {        "property1": "string",        "property2": "string"      },      "credential_hint": "string",      "credential_kind": "string",      "ended_at": "2019-08-24T14:15:22Z",      "error_message": "string",      "error_type": "string",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "model": "string",      "priced_model": {        "cache_read_price": 0,        "cache_write_price": 0,        "input_price": 0,        "model": "string",        "output_price": 0      },      "prompt": "string",      "provider": "string",      "started_at": "2019-08-24T14:15:22Z",      "token_usage": {        "cache_read_input_tokens": 0,        "cache_write_input_tokens": 0,        "cost_micros": 0,        "has_unpriced_usage": true,        "input_tokens": 0,        "metadata": {          "property1": null,          "property2": null        },        "output_tokens": 0      }    }  ],  "token_usage_summary": {    "cache_read_input_tokens": 0,    "cache_write_input_tokens": 0,    "cost_micros": 0,    "has_unpriced_usage": true,    "input_tokens": 0,    "metadata": {      "property1": null,      "property2": null    },    "output_tokens": 0  }}