Skip to content
Skip to Content
Coder Docs

List AI Gateway sessions

GET
/api/v2/ai-gateway/sessions

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

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Query Parameters

q?string

Search query in the format key:value. Available keys are: initiator, provider, provider_name, model, client, session_id, started_after, started_before.

limit?integer

Page limit

after_session_id?string

Cursor pagination after session ID (cannot be used with offset)

offset?integer

Offset pagination (cannot be used with after_session_id)

Response Body

OK

application/json
  1. response
count?integer
sessions?array<>

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

curl -X GET \	"$CODER_URL/api/v2/ai-gateway/sessions" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
Example Response200
{  "count": 0,  "sessions": [    {      "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"      },      "last_active_at": "2019-08-24T14:15:22Z",      "last_prompt": "string",      "metadata": {        "property1": null,        "property2": null      },      "models": [        "string"      ],      "network_calls": {        "blocked": 0,        "total": 0      },      "providers": [        "string"      ],      "started_at": "2019-08-24T14:15:22Z",      "threads": 0,      "token_usage_summary": {        "cache_read_input_tokens": 0,        "cache_write_input_tokens": 0,        "input_tokens": 0,        "output_tokens": 0      }    }  ]}