{"openapi":"3.1.0","info":{"title":"str.ing gateway","description":"Send a token in the `Authorization` header: `Authorization: Bearer <token>`. The gateway accepts the same tokens as the str.ing API. A missing, invalid, expired or revoked token gets `401 UNAUTHENTICATED` on every route.\nAuthentication for stored credentials is cached for up to five seconds.\n\nErrors use the OpenAI shape, so OpenAI SDKs read them: `{\"error\": {\"type\", \"code\", \"message\", \"param\"}}`. Branch on `code`; each operation lists the codes it can return.","license":{"name":""},"version":"2"},"paths":{"/health":{"get":{"tags":["health"],"summary":"Check that the gateway is up","description":"Answers without reading any data.","operationId":"live","responses":{"200":{"description":"The gateway is up","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/health/db":{"get":{"tags":["health"],"summary":"Check that the gateway can read its data","operationId":"db","responses":{"200":{"description":"The gateway can read its data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"503":{"description":"`DATABASE_UNAVAILABLE`: the gateway is up but can't read its data. Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}}}}},"/{org_slug}/chat/completions":{"post":{"tags":["inference"],"summary":"Create a chat completion","description":"Takes an OpenAI Chat Completions request and returns the model's response,\nstreamed as server-sent events when `stream` is `true`. Point an OpenAI SDK\nat `https://gateway.str.ing/{org_slug}` and use it as usual.\n\n`model` is a model id or alias from `GET /{org_slug}/models`. Send\n`X-String-Tag` to group requests in usage reports.\n\nSuccessful completions are cached for 24 hours: a request whose body is\nidentical to an earlier one from your organization, after its model is\nresolved, gets the stored response, whatever its `temperature`. A cached\nresponse costs nothing. `X-String-Cache` controls this per request, and the\n`x-string-cache-status` response header says what happened: `hit`, `miss`,\nor `bypass` when the cache wasn't read. On a hit the body's `cost` is all\nzeros and `x-string-cache-avoided-cost` is the USD price of the original call.","operationId":"create_chat_completion","parameters":[{"name":"org_slug","in":"path","description":"The organization's slug, such as `acme`.","required":true,"schema":{"type":"string"}},{"name":"X-String-Tag","in":"header","description":"A label for usage reports, up to 128 bytes.","required":false,"schema":{"type":["string","null"]}},{"name":"X-String-Cache","in":"header","description":"`enabled` (the default) reads and writes the response cache, `read-only` and `write-only` do one, `disabled` neither.","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"description":"An OpenAI Chat Completions request.","content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"description":"The completion: a JSON body, or an event stream when `stream` is `true`. Other statuses from the model provider are passed through unchanged.","headers":{"x-string-cache-avoided-cost":{"schema":{"type":"string"},"description":"Only on a cache hit: what the original call cost, in USD, such as `0.000038`."},"x-string-cache-status":{"schema":{"type":"string"},"description":"`hit`, `miss`, or `bypass` when the cache wasn't read."}}},"400":{"description":"`INVALID_REQUEST`: the body isn't a JSON object with a string `model`, or `stream` or `stream_options` has the wrong type. `INVALID_MODEL_ALIAS`: `model` matches more than one model. `INVALID_TAG`: `X-String-Tag` is longer than 128 bytes. `INVALID_CACHE_POLICY`: `X-String-Cache` isn't one of its values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"401":{"description":"`UNAUTHENTICATED`: the token is missing, invalid, expired or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"404":{"description":"`ORG_NOT_FOUND`: your token doesn't reach this organization. `MODEL_NOT_FOUND`: `model` isn't in the catalog.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"502":{"description":"`UPSTREAM_UNREACHABLE`: the model provider couldn't be reached. `INFERENCE_UNAVAILABLE`: the provider refused the gateway's credentials. Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"503":{"description":"`CATALOG_UNAVAILABLE`: the model catalog can't be read right now. Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}}},"security":[{"bearer":[]}]}},"/{org_slug}/models":{"get":{"tags":["inference"],"summary":"List models","description":"Every model the gateway accepts as `model`.","operationId":"list_models","parameters":[{"name":"org_slug","in":"path","description":"The organization's slug, such as `acme`.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The models","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelList"}}}},"401":{"description":"`UNAUTHENTICATED`: the token is missing, invalid, expired or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"404":{"description":"`ORG_NOT_FOUND`: your token doesn't reach this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"503":{"description":"`CATALOG_UNAVAILABLE`: the model catalog can't be read right now. Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}}},"security":[{"bearer":[]}]}},"/{org_slug}/models/{model}":{"get":{"tags":["inference"],"summary":"Read a model's catalog facts","description":"Resolves the same IDs and aliases as inference. Returns native catalog\nmetadata without converting prices or combining provider capabilities.\nRates are published estimates, not a quote or the billed request charge.","operationId":"read_model","parameters":[{"name":"org_slug","in":"path","description":"Organization slug or ID","required":true,"schema":{"type":"string"}},{"name":"model","in":"path","description":"Model ID or alias; URL-encode author-prefixed names","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Native model metadata and catalog snapshot time","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelDetail"}}}},"400":{"description":"`INVALID_MODEL_ALIAS`: use a canonical ID because this alias is ambiguous.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"401":{"description":"`UNAUTHENTICATED`: the token is missing, invalid, expired or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"404":{"description":"`ORG_NOT_FOUND` or `MODEL_NOT_FOUND`: organization inaccessible, or model unknown/retired/not a completion model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}},"503":{"description":"`CATALOG_UNAVAILABLE`: no catalog snapshot can be read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceErrorBody"}}}}},"security":[{"bearer":[]}]}}},"components":{"schemas":{"HealthResponse":{"type":"object","required":["status"],"properties":{"status":{"type":"string","description":"Always `ok`."}}},"InferenceErrorBody":{"type":"object","description":"The body of every error on the inference routes.","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/InferenceErrorDetail"}}},"InferenceErrorDetail":{"type":"object","required":["type","code","message"],"properties":{"code":{"type":"string","description":"A stable identifier such as `MODEL_NOT_FOUND`. Branch on this."},"message":{"type":"string","description":"A human-readable explanation; the wording can change."},"param":{"type":["string","null"],"description":"Always `null`."},"type":{"type":"string","description":"`server_error` for a 5xx, `invalid_request_error` otherwise."}}},"ModelDetail":{"type":"object","description":"Native catalog facts for one served completion model.","required":["fetched_at_ms","model"],"properties":{"fetched_at_ms":{"type":"integer","format":"int64","description":"When this catalog snapshot was fetched, in Unix milliseconds. Normally\ncached for five minutes; upstream failures can leave it older."},"model":{"type":"object","description":"Concentrate metadata, including provider-specific `pricing`, `supports`,\n`context_window` and `max_output_tokens`. Each price maps currency to an\namount per `units` of its resource. Tiers retain their `condition`.\nMissing/null/empty pricing means unknown, never free. Zero is a known rate.\nModel-level capabilities can aggregate providers: use one provider's\n`supports` for combined requirements. Catalog presence is not live health."}}},"ModelEntry":{"type":"object","required":["id","object","created","owned_by"],"properties":{"created":{"type":"integer","format":"int64","description":"When the model was released, in Unix seconds; `0` if unknown."},"id":{"type":"string","description":"The model's id, accepted as `model` on the completion routes."},"object":{"type":"string","description":"Always `model`."},"owned_by":{"type":"string","description":"Who makes the model, such as `openai`."}}},"ModelList":{"type":"object","description":"The models an organization can call, in the OpenAI list shape.","required":["object","data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ModelEntry"}},"object":{"type":"string","description":"Always `list`."}}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}}}