{"openapi":"3.1.0","info":{"title":"Byte AI API","version":"1.1.0","summary":"GPT Gray chat with web search, link reading, task detection and vision.","description":"Authenticate with a key from https://platform.byteai.in/dashboard as `Authorization: Bearer <key>`. Every response carries `x-request-id`; errors return `{ error, message, request_id }`.","contact":{"name":"Byte AI support","email":"hello@byteai.in","url":"https://byteai.in/contact"},"termsOfService":"https://byteai.in/terms"},"servers":[{"url":"https://platform.byteai.in"}],"security":[{"bearer":[]}],"paths":{"/v1/models":{"get":{"summary":"List models","security":[],"responses":{"200":{"description":"Available models","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"default":{"type":"string"},"data":{"type":"array","items":{"type":"object"}}}}}}}}}},"/v1/chat/completions":{"post":{"summary":"Chat completion (OpenAI-compatible)","description":"Send `stream: true` for server-sent events ending in `data: [DONE]`. Byte AI extras arrive in a `byteai` field: the detected `task`, whether it `searched`, and numbered `sources` that answers cite as [n].","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"},"example":{"model":"gpt-gray","messages":[{"role":"user","content":"What changed in the latest Next.js release?"}],"web_search":"auto","specialization":"auto"}}}},"responses":{"200":{"description":"Completion, or an SSE stream when stream is true","headers":{"x-request-id":{"description":"Id for this request. Include it when contacting support.","schema":{"type":"string"}},"x-ratelimit-limit":{"description":"Requests allowed per UTC day for this key.","schema":{"type":"integer"}},"x-ratelimit-remaining":{"description":"Requests left today.","schema":{"type":"integer"}},"x-ratelimit-reset":{"description":"Unix time when the daily count resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Daily limit reached. See x-ratelimit-* and retry-after headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Busy or temporarily unavailable. Retry with backoff.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/search":{"post":{"summary":"Web search","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","minLength":2,"maxLength":1024}}}}}},"responses":{"200":{"description":"Search results","headers":{"x-request-id":{"description":"Id for this request. Include it when contacting support.","schema":{"type":"string"}},"x-ratelimit-limit":{"description":"Requests allowed per UTC day for this key.","schema":{"type":"integer"}},"x-ratelimit-remaining":{"description":"Requests left today.","schema":{"type":"integer"}},"x-ratelimit-reset":{"description":"Unix time when the daily count resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"grounded":{"type":"boolean"},"cached":{"type":"boolean"},"sources":{"type":"array","items":{"$ref":"#/components/schemas/Source"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Daily limit reached. See x-ratelimit-* and retry-after headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Busy or temporarily unavailable. Retry with backoff.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/vision":{"post":{"summary":"Describe or transcribe an image","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["image","prompt"],"properties":{"image":{"type":"string","description":"Base64 or data: URL (jpeg, png, webp), up to about 4 MiB"},"prompt":{"type":"string","maxLength":8000}}}}}},"responses":{"200":{"description":"Text result","headers":{"x-request-id":{"description":"Id for this request. Include it when contacting support.","schema":{"type":"string"}},"x-ratelimit-limit":{"description":"Requests allowed per UTC day for this key.","schema":{"type":"integer"}},"x-ratelimit-remaining":{"description":"Requests left today.","schema":{"type":"integer"}},"x-ratelimit-reset":{"description":"Unix time when the daily count resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Daily limit reached. See x-ratelimit-* and retry-after headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Busy or temporarily unavailable. Retry with backoff.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/shares/{id}":{"get":{"summary":"Read a shared chat","description":"Public, read-only snapshot created by a signed-in user from byteai.in.","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{22}$"}}],"responses":{"200":{"description":"The shared chat","content":{"application/json":{"schema":{"type":"object","properties":{"share":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"specialization":{"type":"string"},"createdAt":{"type":"integer"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/StoredMessage"}}}}}}}}},"404":{"description":"No such share","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/openapi.json":{"get":{"summary":"This document","security":[],"responses":{"200":{"description":"OpenAPI 3.1 document"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Byte AI API key"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Stable machine-readable code"},"message":{"type":"string"},"request_id":{"type":"string"}}},"Message":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string","maxLength":6000}}},"StoredMessage":{"type":"object","properties":{"role":{"enum":["user","assistant"]},"content":{"type":"string"},"sources":{"type":"array","items":{"$ref":"#/components/schemas/Source"}}}},"Source":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"url":{"type":"string","format":"uri"},"snippet":{"type":"string"},"kind":{"enum":["page","search"]}}},"ChatRequest":{"type":"object","required":["messages"],"properties":{"model":{"enum":["gpt-gray","gpt-gray-1.0"],"default":"gpt-gray"},"messages":{"type":"array","minItems":1,"maxItems":32,"items":{"$ref":"#/components/schemas/Message"},"description":"The last message must be from the user. https:// links in it are read automatically."},"stream":{"type":"boolean","default":false},"web_search":{"oneOf":[{"type":"boolean"},{"enum":["auto","always","never"]}],"default":"never","description":"\"auto\" searches when the question is time-sensitive, and retries with a search if the first answer admits not knowing."},"specialization":{"enum":["auto","general","study","writing","email","research","exam-paper","coding","business"],"default":"auto","description":"\"auto\" (or omitted) detects the task from the message."},"connector_ids":{"type":"array","maxItems":3,"uniqueItems":true,"items":{"type":"string","format":"uuid"},"description":"Optional owner-scoped RushDB connector IDs. Requires an API key associated with the connector owner. Only configured labels and fields are read."},"connector_queries":{"type":"array","maxItems":3,"description":"Optional fixed RushDB SearchQuery inputs, one per connector id. Only allowlisted labels and equality filters on allowlisted fields are accepted; no SQL/Cypher is executed.","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid"},"label":{"type":"string"},"filters":{"type":"object","additionalProperties":{"oneOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"},{"type":"null"}]}},"limit":{"type":"integer","minimum":1,"maximum":10}},"additionalProperties":false}}}},"ChatResponse":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"chat.completion"},"created":{"type":"integer"},"model":{"type":"string"},"model_version":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"$ref":"#/components/schemas/Message"},"finish_reason":{"type":"string"}}}},"usage":{"type":"object","properties":{"completion_tokens":{"type":"integer"}}},"byteai":{"type":"object","properties":{"task":{"enum":["general","study","writing","email","research","exam-paper","coding","business"]},"searched":{"type":"boolean"},"search_provider":{"type":"string"},"grounded":{"type":"boolean"},"sources":{"type":"array","items":{"$ref":"#/components/schemas/Source"}}}}}}}}}