# OpenAPI spec A machine-readable OpenAPI description of the API, and the interactive explorer built from it. The PrivateMind API is published as an [OpenAPI 3.1](https://spec.openapis.org/oas/v3.1.0) document. It describes the request and response shapes, authentication and error codes of every endpoint in this reference: chat completions, the Messages API, the Responses API, embeddings, rerank, models, audio, image generation, files, batches, message batches, sandboxes and usage. The [Model servers API](https://docs.privatemind.com/model-servers-api.html) has its own document, [`/openapi-model-servers.yaml`](https://docs.privatemind.com/openapi-model-servers.yaml). The [Kubernetes API](https://docs.privatemind.com/kubernetes-api.html) is in neither. - **Explore it:** the [interactive API explorer](https://docs.privatemind.com/api-explorer.html) shows the spec with a built-in "Try it" console. - **Download it:** [`/openapi.yaml`](https://docs.privatemind.com/openapi.yaml). ## What you can do with it - **Import into Postman, Insomnia, or Bruno.** Point the tool at `https://docs.privatemind.com/openapi.yaml` and the whole API loads as a collection you can call. - **Generate client stubs.** Give the spec to [`openapi-generator`](https://openapi-generator.tech/) to build a typed client in your language. - **Use it in your own tooling.** The spec is plain YAML, so contract tests, mock servers and API gateways can read it. ```bash # Generate a typed client from the published spec npx @openapitools/openapi-generator-cli generate \ -i https://docs.privatemind.com/openapi.yaml \ -g python \ -o ./privatemind-client ``` ## Two response shapes on shared paths `/models` and `/files` answer in the OpenAI shape, or in the Anthropic shape when the request carries the optional `anthropic-version` header. The spec lists both schemas on each. The same header switches any endpoint's errors to the Anthropic envelope. For the Messages API, the official Anthropic SDKs are easier to use than generated code. See [Anthropic SDK](https://docs.privatemind.com/anthropic-sdk.html). ## For chat and embeddings, prefer the OpenAI SDK The API is OpenAI-compatible, so for chat completions and embeddings the official `openai` client needs only our base URL. See the [OpenAI SDK guide](https://docs.privatemind.com/openai-sdk.html). ```python from openai import OpenAI client = OpenAI(base_url="https://api.privatemind.com/v1", api_key=PMIND_KEY) ``` Use the spec for what the OpenAI SDK doesn't cover: the [rerank](https://docs.privatemind.com/rerank.html) and [voices](https://docs.privatemind.com/audio.html) endpoints, and languages with no official OpenAI SDK. > [!NOTE] > We maintain the spec by hand alongside these docs. If it and an endpoint's behaviour disagree, trust the endpoint and tell us. ## Authentication in the explorer To authorise calls in the explorer, paste a key into the **Auth** panel. The "Try it" console sends requests from your browser straight to `https://api.privatemind.com/v1`. Never paste a production key into a browser you don't trust. ## Where next - [Authentication](https://docs.privatemind.com/authentication.html) for the bearer-token format. - [Errors](https://docs.privatemind.com/errors.html) for the status-code and error-envelope contract the spec encodes. - [OpenAI SDK](https://docs.privatemind.com/openai-sdk.html) for chat and embeddings without generated code.