SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
13 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
8.7 KB · 179 lines json
Raw Blame History
1[2 {3  "provider": "xai",4  "http_status": 400,5  "type": "invalid-argument",6  "code": "invalid-argument",7  "category": "client",8  "message_semantics": "Bad request body/URL, unsupported parameter for the model, or an incorrect API key (xAI returns 400 not 401 for a malformed/unknown key). Body shape: {\"code\": \"invalid-argument\", \"error\": \"<message>\"}. Some 400s are a bare JSON string (multi-agent on chat completions).",9  "retryable": false,10  "recommended_action": "Fix the request; check the model page for supported parameters (e.g. reasoning_effort only on grok-4.6/4.5/4.3, multi-agent only on /v1/responses).",11  "source": "https://docs.x.ai/developers/debugging",12  "observed_live": true,13  "live_examples": [14   "POST /v1/chat/completions grok-4.20-0309-non-reasoning reasoning_effort=low -> {\"code\":\"invalid-argument\",\"error\":\"Model grok-4.20-0309-non-reasoning does not support parameter reasoningEffort.\"}",15   "same for grok-4.20-0309-reasoning and grok-build-0.1",16   "POST /v1/chat/completions grok-4.20-multi-agent-0309 -> \"Multi Agent requests are not allowed on chat completions\" (plain JSON string body)",17   "GET /v1/models with bogus bearer -> {\"code\":\"invalid-argument\",\"error\":\"Incorrect API key provided. You can obtain an API key from https://console.x.ai.\"}"18  ]19 },20 {21  "provider": "xai",22  "http_status": 401,23  "type": "unauthenticated",24  "code": "unauthenticated:no-credentials",25  "category": "auth",26  "message_semantics": "No Authorization header. Note: an INVALID key yields 400 invalid-argument on the inference API, while the Management API returns 401 with a gRPC-style body {\"code\": 16, \"message\": \"Invalid bearer token. Please ensure you use a valid management key.\", \"details\": []} (16 = UNAUTHENTICATED).",27  "retryable": false,28  "recommended_action": "Send Authorization: Bearer <XAI_API_KEY>; use a Management key on management-api.x.ai.",29  "source": "https://docs.x.ai/developers/debugging",30  "observed_live": true,31  "live_examples": [32   "GET /v1/models (no auth) -> {\"code\":\"unauthenticated:no-credentials\",\"error\":\"No credentials presented.\"}",33   "GET https://management-api.x.ai/auth/management-keys/validation with inference key -> 401 {code:16}"34  ]35 },36 {37  "provider": "xai",38  "http_status": 403,39  "type": "forbidden",40  "code": "permission-denied (assumed)",41  "category": "auth",42  "message_semantics": "Key lacks an ACL (api-key:endpoint:<name> / api-key:model:<name>), key disabled/blocked, team blocked, or ZDR/feature restriction. Docs: 'Ask your team admin for permission.'",43  "retryable": false,44  "recommended_action": "Check GET /v1/api-key (acls, api_key_blocked, api_key_disabled, team_blocked); have an admin fix ACLs via console or Management API.",45  "source": "https://docs.x.ai/developers/debugging",46  "observed_live": false,47  "live_examples": []48 },49 {50  "provider": "xai",51  "http_status": 404,52  "type": "not-found",53  "code": "not-found",54  "category": "client",55  "message_semantics": "Unknown path, or model 'does not exist or your team <team_id> does not have access to it' (the same message covers non-existent and restricted models -> never conclude non-existence). Regional endpoints return 404 for models they do not serve (e.g. grok-latest on us.api.x.ai).",56  "retryable": false,57  "recommended_action": "Check the id against GET /v1/models on the SAME base URL; contact support with team id + model name if access is expected.",58  "source": "https://docs.x.ai/developers/debugging",59  "observed_live": true,60  "live_examples": [61   "GET /v1/models/grok-2-image -> {\"code\":\"not-found\",\"error\":\"The model grok-2-image does not exist or your team c5cb…7d93 does not have access to it. If you believe this is a mistake, please contact support and quote your team ID and the model name.\"}",62   "GET /v1/models/grok-voice-think-fast-2.0 -> 404 (voice models are not in the catalogue)",63   "GET /v1/embedding-models/grok-embedding-small -> 404",64   "POST /v1/chat/completions model=grok-2-image -> 404 same body"65  ]66 },67 {68  "provider": "xai",69  "http_status": 405,70  "type": "method-not-allowed",71  "code": null,72  "category": "client",73  "message_semantics": "HTTP method not supported by the path (e.g. POST to a GET-only endpoint). Empty body observed.",74  "retryable": false,75  "recommended_action": "Check the method in the REST reference.",76  "source": "https://docs.x.ai/developers/debugging",77  "observed_live": true,78  "live_examples": [79   "DELETE /v1/models -> 405 with empty body"80  ]81 },82 {83  "provider": "xai",84  "http_status": 415,85  "type": "unsupported-media-type",86  "code": null,87  "category": "client",88  "message_semantics": "Wrong Content-Type on a POST endpoint.",89  "retryable": false,90  "recommended_action": "Send application/json (or multipart/form-data where required).",91  "source": "https://docs.x.ai/developers/debugging",92  "observed_live": false,93  "live_examples": []94 },95 {96  "provider": "xai",97  "http_status": 422,98  "type": "unprocessable-entity",99  "code": null,100  "category": "client",101  "message_semantics": "A field of the POST body has an invalid format/type. Body is a plain JSON string from the deserializer (serde-style), not the {code,error} object.",102  "retryable": false,103  "recommended_action": "Fix field types (message names the field, line and column).",104  "source": "https://docs.x.ai/developers/debugging",105  "observed_live": true,106  "live_examples": [107   "POST /v1/tokenize-text {text: 123} -> \"Failed to deserialize the JSON body into the target type: text: invalid type: integer `123`, expected a string at line 1 column 33\""108  ]109 },110 {111  "provider": "xai",112  "http_status": 429,113  "type": "too-many-requests",114  "code": "resource-exhausted (gRPC RESOURCE_EXHAUSTED)",115  "category": "rate_limit",116  "message_semantics": "Per-model RPS or TPM limit of the team exceeded, or per-key qps/qpm/tpm cap set via the Management API, or prepaid credits depleted with a $0 invoiced-billing limit (requests 'automatically rejected' - status code for this case not documented).",117  "retryable": true,118  "backoff": "exponential (docs example: 2**attempt seconds, 5 retries); no Retry-After documented",119  "recommended_action": "Back off; spread load; raise tier via spend or console request; move bulk work to the Batch API (does not count towards rate limits).",120  "source": "https://docs.x.ai/developers/rate-limits",121  "observed_live": false,122  "live_examples": []123 },124 {125  "provider": "xai",126  "http_status": 500,127  "type": "internal",128  "code": null,129  "category": "server",130  "message_semantics": "Server-side failure (not enumerated in docs; check https://status.x.ai and the RSS feed https://status.x.ai/feed.xml).",131  "retryable": true,132  "backoff": "exponential with jitter",133  "recommended_action": "Retry; report persistent failures to support@x.ai with x-request-id.",134  "source": "https://docs.x.ai/developers/debugging",135  "observed_live": false,136  "live_examples": []137 },138 {139  "provider": "xai",140  "http_status": 202,141  "type": "accepted (not an error)",142  "code": null,143  "category": "async",144  "message_semantics": "GET /v1/chat/deferred-completion/{request_id}: result not ready yet (empty body). Deferred results can be fetched exactly once within 24 h.",145  "retryable": true,146  "recommended_action": "Poll with backoff.",147  "source": "https://docs.x.ai/developers/advanced-api-usage/deferred-chat-completions",148  "observed_live": false,149  "live_examples": []150 },151 {152  "provider": "xai",153  "http_status": 200,154  "type": "usage-guideline-violation (billing event, not an HTTP error)",155  "code": null,156  "category": "policy",157  "message_semantics": "Requests judged to violate usage guidelines are still charged; violations caught before generation on the Responses API incur a flat $0.05 fee.",158  "retryable": false,159  "recommended_action": "Review content policy.",160  "source": "https://docs.x.ai/developers/pricing",161  "observed_live": false,162  "live_examples": []163 },164 {165  "provider": "xai",166  "http_status": null,167  "type": "grpc-status-mapping",168  "code": "gRPC codes",169  "category": "reference",170  "message_semantics": "gRPC API (api.x.ai:443, xai_api.* services) surfaces canonical gRPC status codes; the Management API's REST error body {code, message, details} uses the same numbering. Mapping used by the SDK/docs: 3 INVALID_ARGUMENT -> 400; 16 UNAUTHENTICATED -> 401; 7 PERMISSION_DENIED -> 403; 5 NOT_FOUND -> 404; 8 RESOURCE_EXHAUSTED -> 429 (rate limit; xai-sdk docs catch grpc.StatusCode.RESOURCE_EXHAUSTED); 13 INTERNAL -> 500; 14 UNAVAILABLE -> 503; 4 DEADLINE_EXCEEDED -> 504 (SDK default timeout 1620 s).",171  "retryable": null,172  "recommended_action": "In xai-sdk, catch grpc.RpcError and inspect e.code().",173  "source": "https://docs.x.ai/developers/rate-limits",174  "observed_live": true,175  "live_examples": [176   "management-api 401 body {\"code\": 16, \"message\": \"Invalid bearer token…\", \"details\": []}"177  ]178 }179]