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:
| API | Base URL | Usage |
|---|---|---|
| LLM Gateway | https://llm.argy.cloud/v1 | Inference: chat, completions, Anthropic messages, responses, models, usage, images, OCR |
| Platform | https://api.argy.cloud | RAG, 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
| Header | Required | Description |
|---|---|---|
Authorization: Bearer ... | Yes | Argy PAT or JWT token |
Content-Type: application/json | Yes (POST with body) | JSON body; invalid JSON gives 400 INVALID_REQUEST |
x-request-id | No | Request identifier reused in the trace; generated (UUID) if absent |
X-Tenant-Id | No | Must match the token's tenant, otherwise the request is rejected (400) |
X-Org-Id | No | Must belong to the token's organizations, otherwise the request is rejected (400) |
X-Argy-Agent-Id | No | Audit label (calling client); grants no permission |
Platform API
| Header | Required | Description |
|---|---|---|
Authorization: Bearer ... | Yes | Argy PAT or JWT token |
Content-Type: application/json | Yes (POST with body) | JSON body |
x-correlation-id | No | Correlation 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), otherwisenull.code: stable, machine-readable Argy error code (for exampleUNAUTHENTICATEDfor a401).trace_id/request_id: traceability identifiers, derived fromx-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, a401carriesUNAUTHORIZED, a403carriesFORBIDDENand an internal errorINTERNAL; otherwise the code is the HTTP status name (for exampleBAD_REQUEST). Some endpoints return their own code (for examplePAT_MANAGEMENT_REQUIRES_SESSION): see the error table of each reference.message: human-readable error description.reasonCode: complementary reason, present only for certain rejections (for exampleORG_SELECTION_FORBIDDENorWEBHOOK_PAT_REQUIREDon a403,IDEMPOTENCY_KEY_REUSEDon a409); absent otherwise.correlationId: taken from your request'sx-correlation-idheader, generated when absent; also returned in thex-correlation-idresponse 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:
| Status | Code | When |
|---|---|---|
| 400 | INVALID_REQUEST | Invalid JSON, missing required field, failed validation |
| 400 | PII_DETECTED, SECRET_DETECTED, PROMPT_INJECTION_DETECTED | Input blocked by the security policy |
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token |
| 402 | CREDITS_EXHAUSTED | Tenant AI credits exhausted |
| 402 | ORG_QUOTA_EXCEEDED, USER_QUOTA_EXCEEDED | Monthly quota reached (organization or user) |
| 403 | FORBIDDEN | Token used outside its allowed scope |
| 403 | MODEL_NOT_ALLOWED | Model not allowed for the tenant |
| 404 | NOT_FOUND | Unknown route |
| 413 | - | Request body too large; on /v1/messages the Anthropic error.type is request_too_large |
| 422 | POLICY_BLOCKED_OUTPUT | Output blocked by the security policy |
| 429 | RATE_LIMITED | Rate limit reached; Retry-After header present |
| 500 | INTERNAL_ERROR | Unexpected internal error |
| 503 | QUOTA_VERIFICATION_UNAVAILABLE | Quota 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:
| Limit | Value | Scope |
|---|---|---|
| Request body size | Default limit, configurable per deployment | LLM Gateway routes |
| Requests per minute | Limit per (tenant, user), configurable | LLM Gateway inference routes; 429 with Retry-After beyond it |
| Output token ceiling | Default ceiling, configurable | Chat, completions, responses; exceeding values are capped without an error |
| Monthly credit quota | Depends on your plan | Inference; 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-codeandtrace_idon the LLM Gateway side,codeandcorrelationIdon the platform side). - The
X-Argy-Agent-Idheader labels the caller without granting extra rights. - The LLM Gateway's
automodel delegates model selection: an agent does not need to hardcode a model identifier. This is what Argy Code and Argy Chat use.
See also
- LLM Gateway reference: chat, completions, messages, responses, models, usage, images, OCR
- RAG API: collections and augmented retrieval
- Platform API: projects, modules, runs
- IAM authentication: PATs, JWTs, sessions
- Argy Chat: the Argy web conversation application
- Security model