Skip to content

Argy API Overview

Base URLs, Bearer authentication, headers, error envelopes, codes, limits and conventions of the public Argy APIs: LLM Gateway and platform.

This page covers the conventions of Argy's public APIs: where to call them, how to authenticate, which headers to send, and which limits apply. Field and error formats differ per API: each section distinguishes the LLM Gateway from the platform API. Use it as the entry point before the detailed references for the LLM Gateway, the RAG API, the platform API and IAM authentication.

Base URLs

Argy's public APIs are exposed on two hosts, depending on what you call:

APIBase URLUsage
LLM Gatewayhttps://llm.argy.cloud/v1Inference: chat, completions, Anthropic messages, responses, models, usage, images, OCR
Platformhttps://api.argy.cloudRAG, projects, modules, PATs and public IAM endpoints

The public configuration schema is published at https://argy.cloud/config.json. For the portal and Argy Chat, use the URLs provided for your deployment.

Request and response bodies are JSON (application/json). Only the LLM Gateway inference routes can stream, and they then use text/event-stream; the platform API always answers in JSON. The LLM Gateway names its JSON fields in snake_case and ignores unknown fields; the platform API uses camelCase fields (for example deviceCode, topK).

Authentication

All Argy public APIs use Bearer token authentication:

Authorization: Bearer $ARGY_PAT
  • Argy PAT: a signed personal access token, prefixed pat_, created from your user session (see IAM authentication). This is the recommended method for integrations and scripts. To use it inside Argy Code, see Argy Code configuration.
  • Argy JWT: a signed token issued by the platform, used by Argy components themselves and advanced integrations.

The token identifies your tenant and organizations. Without a valid Authorization header, every request is rejected with a 401 status; the exact error code depends on the API (see the Error envelope section).

Never hardcode your token in a script or repository: use an environment variable (e.g. ARGY_PAT) or a secrets manager.

Request headers

Each API recognises its own headers.

LLM Gateway

HeaderRequiredDescription
Authorization: Bearer ...YesArgy PAT or JWT token
Content-Type: application/jsonYes (POST with body)JSON body; invalid JSON gives 400 INVALID_REQUEST
x-request-idNoRequest identifier reused in the trace; generated (UUID) if absent
X-Tenant-IdNoMust match the token's tenant, otherwise the request is rejected (400)
X-Org-IdNoMust belong to the token's organizations, otherwise the request is rejected (400)
X-Argy-Agent-IdNoAudit label (calling client); grants no permission

Platform API

HeaderRequiredDescription
Authorization: Bearer ...YesArgy PAT or JWT token
Content-Type: application/jsonYes (POST with body)JSON body
x-correlation-idNoCorrelation identifier returned in the error response

Error envelope

The two APIs do not use the same error format.

LLM Gateway

On every route except /v1/messages (which follows the Anthropic error format), an error is returned in an OpenAI-style envelope (the Anthropic format is shown in the LLM Gateway reference):

{
  "error": {
    "message": "…",
    "type": "invalid_request_error",
    "param": null,
    "code": "INVALID_REQUEST"
  },
  "trace_id": "…",
  "request_id": "…"
}
  • message: human-readable error description.
  • type: category derived from the HTTP status: 400/404 → invalid_request_error, 401/403 → authentication_error, 429 → rate_limit_error, other statuses → server_error.
  • param: offending field for validation errors (e.g. tools[0].type), otherwise null.
  • code: stable, machine-readable Argy error code (for example UNAUTHENTICATED for a 401).
  • trace_id / request_id: traceability identifiers, derived from x-request-id.

Useful error response headers: x-request-id, x-argy-trace-id, x-argy-error-code.

Platform API

The platform API returns its errors in its own envelope:

{
  "code": "UNAUTHORIZED",
  "message": "Authentication required",
  "reasonCode": "ORG_SELECTION_FORBIDDEN",
  "correlationId": "…"
}
  • code: machine-readable error code. For errors emitted by the API itself, a 401 carries UNAUTHORIZED, a 403 carries FORBIDDEN and an internal error INTERNAL; otherwise the code is the HTTP status name (for example BAD_REQUEST). Some endpoints return their own code (for example PAT_MANAGEMENT_REQUIRES_SESSION): see the error table of each reference.
  • message: human-readable error description.
  • reasonCode: complementary reason, present only for certain rejections (for example ORG_SELECTION_FORBIDDEN or WEBHOOK_PAT_REQUIRED on a 403, IDEMPOTENCY_KEY_REUSED on a 409); absent otherwise.
  • correlationId: taken from your request's x-correlation-id header, generated when absent; also returned in the x-correlation-id response header.

On a 403 emitted by the API itself, the body returns code: "FORBIDDEN" with message: "Access denied": the precise reason, when exposed, lives in reasonCode.

Error codes

Most frequent LLM Gateway error codes:

StatusCodeWhen
400INVALID_REQUESTInvalid JSON, missing required field, failed validation
400PII_DETECTED, SECRET_DETECTED, PROMPT_INJECTION_DETECTEDInput blocked by the security policy
401UNAUTHENTICATEDMissing, invalid, expired or revoked token
402CREDITS_EXHAUSTEDTenant AI credits exhausted
402ORG_QUOTA_EXCEEDED, USER_QUOTA_EXCEEDEDMonthly quota reached (organization or user)
403FORBIDDENToken used outside its allowed scope
403MODEL_NOT_ALLOWEDModel not allowed for the tenant
404NOT_FOUNDUnknown route
413-Request body too large; on /v1/messages the Anthropic error.type is request_too_large
422POLICY_BLOCKED_OUTPUTOutput blocked by the security policy
429RATE_LIMITEDRate limit reached; Retry-After header present
500INTERNAL_ERRORUnexpected internal error
503QUOTA_VERIFICATION_UNAVAILABLEQuota verification unavailable (distinct from an exhausted quota)

Platform API codes follow the envelope described above: errors emitted by the API itself use UNAUTHORIZED, FORBIDDEN or INTERNAL (or the HTTP status name), and endpoints that return their own code (for example PAT_MANAGEMENT_REQUIRES_SESSION) document it in their reference.

Monthly credit quotas and top-up packs are managed from the portal: see Portal billing.

Pagination and limits

Catalog APIs do not paginate by default: GET /v1/models returns the list of models allowed for your tenant in a single response. For the platform's list endpoints, the response structure is described in each reference.

Main operational limits:

LimitValueScope
Request body sizeDefault limit, configurable per deploymentLLM Gateway routes
Requests per minuteLimit per (tenant, user), configurableLLM Gateway inference routes; 429 with Retry-After beyond it
Output token ceilingDefault ceiling, configurableChat, completions, responses; exceeding values are capped without an error
Monthly credit quotaDepends on your planInference; 402 when exhausted

These limits apply to the LLM Gateway: their values depend on your deployment's configuration and are not a contractual commitment; ask your administrator for them. The platform API enforces its own limits, distinct from the Gateway's: a smaller JSON body size and per-client throttling, without the Gateway's quota headers.

When the LLM Gateway rate limit is exceeded, the response is 429 RATE_LIMITED with a Retry-After header stating how many seconds to wait before retrying. On the platform API, exceeding the limit also returns 429 with Retry-After, but not the Gateway's code error envelope.

Versioning

Inference routes live under the /v1 prefix. Argy extensions (trace_id, model_effective, billing, etc.) are additive: they complement the response without breaking standard clients.

AI agents and MCP

The conventions above are designed for AI agents as much as for humans:

  • Explicit, stable route and parameter descriptions anchored in section titles: agents can rely on page structure.
  • Machine-readable error codes and correlation identifiers on both APIs (x-argy-error-code and trace_id on the LLM Gateway side, code and correlationId on the platform side).
  • The X-Argy-Agent-Id header labels the caller without granting extra rights.
  • The LLM Gateway's auto model delegates model selection: an agent does not need to hardcode a model identifier. This is what Argy Code and Argy Chat use.

See also