> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sharemy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API overview

> OpenAI-compatible endpoints for chat, pictures, speech and transcripts, run on shared GPUs.

The API takes OpenAI's request shapes and returns OpenAI's response shapes. The OpenAI SDKs work with the base URL set to `https://sharemy.ai/v1`.

| Method | Path | What it does |
| - | - | - |
| `GET` | [`/v1/models`](https://docs.sharemy.ai/api-reference/models) | List the models |
| `HEAD` | [`/v1/models`](https://docs.sharemy.ai/api-reference/models) | Get catalogue headers |
| `GET` | [`/v1/models/{id}`](https://docs.sharemy.ai/api-reference/models) | Look up one model by id |
| `POST` | [`/v1/chat/completions`](https://docs.sharemy.ai/api-reference/chat-completions) | Chat, whole or streamed |
| `POST` | [`/v1/images/generations`](https://docs.sharemy.ai/api-reference/image-generations) | Pictures, as base64 PNG |
| `POST` | [`/v1/images/edits`](https://docs.sharemy.ai/api-reference/image-edits) | Remove a masked area and return a full-resolution PNG |
| `GET` | [`/v1/jobs/{id}`](https://docs.sharemy.ai/api-reference/jobs) | Check an image job and retrieve its result |
| `POST` | [`/v1/jobs/{id}/cancel`](https://docs.sharemy.ai/api-reference/jobs#cancel-a-job) | Cancel an unfinished image job |
| `POST` | [`/v1/audio/speech`](https://docs.sharemy.ai/api-reference/audio-speech) | Speech, as WAV or raw PCM |
| `POST` | [`/v1/audio/transcriptions`](https://docs.sharemy.ai/api-reference/audio-transcriptions) | Audio to text or subtitles |
| `POST` | [`/v1/audio/translations`](https://docs.sharemy.ai/api-reference/audio-translations) | Audio in any language to English text |

## Basics

* Use `https://sharemy.ai/v1` as the SDK base URL. Calling `/v1` itself returns a 404 that lists the endpoints.
* The catalogue is public. Job requests use `Authorization: Bearer smai_...`. Each account shares four job slots across its tokens. See [Authentication](https://docs.sharemy.ai/authentication.md).
* Send JSON for chat and speech. Image generations take JSON or multipart form data. Top-level JSON fields set to `null` are treated as omitted. Image edits and audio uploads take `multipart/form-data`.
* Browsers can call from any origin. The API allows `GET`, `HEAD`, `POST` and `OPTIONS`, and echoes the request headers named in a CORS preflight.
* Catalogue and job responses use `Cache-Control: no-store`.
* Job prices depend on the request. Failed or cancelled jobs are refunded. See [Credits and pricing](https://docs.sharemy.ai/credits-and-pricing.md).
* An unknown path gets `404 not_found`. A wrong method on a known path gets `405 method_not_allowed` with an `Allow` header. See [Errors and limits](https://docs.sharemy.ai/errors-and-limits.md).

## Response headers

Browser JavaScript can read these headers across origins.

| Header | When to use it |
| - | - |
| `x-request-id` | Identifies every API response, including errors. Include it when reporting a failed call. |
| `x-ratelimit-limit-concurrent`, `x-ratelimit-remaining-concurrent` | The account limit and the slots remaining when headers are sent. |
| `Location` | Relative polling path on a 202 for an async image job. |
| `Retry-After` | Seconds to wait. A 429 gives `1`, a 202 or unfinished job lookup gives `2`, and `503 no_provider` gives `30`. |
| `x-should-retry` | `false` on HTTP errors for insufficient credits, a content policy violation or no provider. See [Retrying](https://docs.sharemy.ai/errors-and-limits.md#retrying). |
| `X-ShareMyAI-Cost-Credits`, `X-ShareMyAI-Balance-Credits` | When a job has a quote, its price and the balance just after the hold. A Janus batch reports the total for completed pictures. |
| `X-ShareMyAI-Max-Tokens` | The effective chat token limit when the requested value was capped. |
| `X-Sample-Rate` | Samples per second for speech audio. |

## Differences from OpenAI's API

ShareMyAI runs small open models on people's own machines, so it covers part of OpenAI's API.

* The API omits OpenAI's embeddings, moderations, files, assistants, responses and realtime endpoints.
* Each model id works only on its own endpoint. `GET /v1/models` gives each model's `kind`.
* Chat is text only. Use one completion per call. Chat supports stop strings. JSON mode and required or named tool calls return `400 unsupported_value`.
* Generated and edited pictures come back as `b64_json`. Image URLs and variations are unsupported.
* Speech comes back only as WAV or raw PCM, and Kokoro accepts OpenAI voice aliases.
* Transcripts have segment timestamps only, not word timestamps.
* Chat pricing uses the requested output budget after capping. Token counts in `usage` can be estimates.

Each endpoint page lists its own differences.

## Things only ShareMyAI has

* `reasoning_content` on chat replies from models that think.
* `seed` on image generation requests and responses.
* `grow` on image edits. [Image jobs](https://docs.sharemy.ai/api-reference/jobs.md) let you poll or cancel edits and generations.
* `diarize` on transcriptions and translations, to label who spoke.
* Model pricing, machine counts and chat token limits in the catalogue.
* `usage.cost_credits` on chat completions and on the optional final usage chunk.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.