https://aigateway-usw.agentuity.cloudAuthentication
Most requests require a Bearer token. Pass your API or SDK key in the Authorization header. Public endpoints are noted below and do not require authentication.
| Header | Value |
|---|---|
Authorization | Bearer YOUR_SDK_KEY |
You can find your SDK key in the Agentuity Console under your project settings.
List Models
List model metadata for LLM providers available through AI Gateway, grouped by provider.
/modelshttps://aigateway-usw.agentuity.cloud/modelsAuthentication: Public. No auth required.
Response
JSON response with provider keys mapped to arrays of supported model metadata under the data envelope.
| Status | Description |
|---|---|
| 200 | Model catalog returned. Public — no auth required. |
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | |
data | object | (optional) |
message | string | (optional) |
error | string | (optional) |
Example
curl -X GET 'https://aigateway-usw.agentuity.cloud/models' \
-H 'Authorization: Bearer $AGENTUITY_SDK_KEY'Create Completion
Create a completion through the AI Gateway auto-router. The gateway routes by model and request shape, so chat messages and legacy prompt payloads are both supported.
/https://aigateway-usw.agentuity.cloud/Request Body
Completion request. Use messages for chat-compatible models and prompt for legacy OpenAI completions-compatible models. Additional provider-specific fields are passed through.
| Field | Type | Description |
|---|---|---|
model | string | Model to use for the completion. |
input | any | Responses-compatible input payload for models using the Responses API. (optional) |
contents | array | Google Generative AI contents payload. (optional) |
messages | object[] | Messages to complete. (optional) |
messages[].role | string | |
messages[].content | string | object[] | null | (optional) |
messages[].name | string | (optional) |
messages[].tool_call_id | string | (optional) |
messages[].tool_calls | array | (optional) |
prompt | string | string[] | Prompt to complete. (optional) |
temperature | number | (optional) |
top_p | number | (optional) |
max_tokens | number | (optional) |
stream | boolean | (optional) |
stop | string | string[] | (optional) |
Response
Provider-compatible completion response.
| Status | Description |
|---|---|
| 200 | Completion created |
| 400 | Invalid completion request |
| 401 | Unauthorized — invalid or missing API key |
| 402 | Payment required — upgrade to a paid plan |
Response Headers
| Header | Description |
|---|---|
X-Gateway-Cost | Estimated total gateway cost in USD, when billing metadata is available. |
X-Gateway-Prompt-Tokens | Prompt token count used for gateway billing. |
X-Gateway-Completion-Tokens | Completion token count used for gateway billing. |
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | |
created | number | |
model | string | |
choices | array | |
usage | any | |
agentuity | object | Agentuity AI Gateway metadata. |
agentuity.headers | object | AI Gateway response headers captured from the HTTP response. |
agentuity.cost | object | Parsed AI Gateway cost information when available. |
agentuity.cost.total | number | Total estimated gateway cost in USD. |
agentuity.cost.unit | string | Gateway billing unit. |
agentuity.cost.inputQuantity | number | Input quantity used for non-token gateway billing. |
agentuity.cost.outputQuantity | number | Output quantity used for non-token gateway billing. |
agentuity.cost.promptTokens | number | Prompt token count used for gateway billing. |
agentuity.cost.completionTokens | number | Completion token count used for gateway billing. |
agentuity.cost.reasoningTokens | number | Reasoning token count reported by the model provider when available. |
Example
curl -X POST 'https://aigateway-usw.agentuity.cloud/' \
-H 'Authorization: Bearer $AGENTUITY_SDK_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Say hello in one sentence."
}
],
"max_tokens": 64
}'Stream Completion
Create a streaming completion through the AI Gateway auto-router. Set stream: true to receive Server-Sent Events token deltas.
/https://aigateway-usw.agentuity.cloud/Request Body
Completion request with stream set to true.
| Field | Type | Description |
|---|---|---|
model | string | Model to use for the completion. |
input | any | Responses-compatible input payload for models using the Responses API. (optional) |
contents | array | Google Generative AI contents payload. (optional) |
messages | object[] | Messages to complete. (optional) |
messages[].role | string | |
messages[].content | string | object[] | null | (optional) |
messages[].name | string | (optional) |
messages[].tool_call_id | string | (optional) |
messages[].tool_calls | array | (optional) |
prompt | string | string[] | Prompt to complete. (optional) |
temperature | number | (optional) |
top_p | number | (optional) |
max_tokens | number | (optional) |
stream | true | Enable Server-Sent Events streaming. |
stop | string | string[] | (optional) |
Response
Server-Sent Events stream. Each data: frame contains a provider-compatible delta payload. The stream ends with data: [DONE].
| Status | Description |
|---|---|
| 200 | Streaming completion started |
| 400 | Invalid completion request |
| 401 | Unauthorized — invalid or missing API key |
| 402 | Payment required — upgrade to a paid plan |
Response Headers
| Header | Description |
|---|---|
Trailer | Declares billing trailers such as X-Gateway-Cost, X-Gateway-Prompt-Tokens, and X-Gateway-Completion-Tokens for streamed responses. |
X-Gateway-Cost | Estimated total gateway cost in USD. For streaming responses this may be delivered as an HTTP trailer after the body completes. |
X-Gateway-Prompt-Tokens | Prompt token count used for gateway billing. For streaming responses this may be delivered as an HTTP trailer. |
X-Gateway-Completion-Tokens | Completion token count used for gateway billing. For streaming responses this may be delivered as an HTTP trailer. |
Response Fields
| Field | Type | Description |
|---|---|---|
choices | object[] | Streamed completion choices. |
choices[].delta | object | Incremental assistant message content. |
choices[].delta.role | string | Role for the streamed message delta. |
choices[].delta.content | string | Token or text delta. |
choices[].finish_reason | string | null | Reason the model stopped generating, when available. |
Example
curl -X POST 'https://aigateway-usw.agentuity.cloud/' \
-H 'Authorization: Bearer $AGENTUITY_SDK_KEY' \
-H 'Accept: text/event-stream' \
-H 'Content-Type: application/json' \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Count to three."
}
],
"stream": true
}'