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

# API Overview

> OpenAI-compatible API basics: base URL, headers, auth, models, and endpoint map.

The API follows the OpenAI chat completions format. If you have existing code that calls OpenAI, you can point it at dottxt by changing `base_url` and `api_key`. See the [migration guide](/migrate-from-other-providers) for details.

This documentation covers the OpenAI-compatible `chat/completions` API surface. If an SDK defaults to the newer OpenAI Responses API, configure it to use chat completions instead.

## Base URL

`https://api.dottxt.ai/v1`

## Required headers

```http theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
Authorization: Bearer <DOTTXT_API_KEY>
Content-Type: application/json
```

## Structured output request

Pass your JSON Schema in `response_format`

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
curl https://api.dottxt.ai/v1/chat/completions \
  -H "Authorization: Bearer $DOTTXT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-20b",
    "messages": [
      { "role": "user", "content": "Extract: John Smith <john@acme.com>, VP Engineering" }
    ],
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "contact",
        "schema": {
          "type": "object",
          "properties": {
            "name": { "type": "string", "minLength": 1 },
            "email": { "type": "string", "pattern": "^[^@]+@[^@]+$" },
            "role": { "type": "string" }
          },
          "required": ["name", "email"],
          "additionalProperties": false
        }
      }
    }
  }'
```

The schema is compiled and enforced:

```json Response theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1703187200,
  "model": "openai/gpt-oss-20b",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "{\"name\": \"John Smith\", \"email\": \"john@acme.com\", \"role\": \"VP Engineering\"}"
      }
    }
  ]
}
```

`name` is guaranteed non-empty via `minLength`. `email` matches the pattern. `role` is not in `required`, so the model may omit it entirely when the input doesn't contain a job title.

See endpoint-specific details in:

* [Create Chat Completion](/api/chat-completions)
* [List Models](/api/list-models)

For migration and integration workflows, see [Integrations overview](/integrations/overview).

## Inference partners

Our generation technology runs on top of a production inference stack operated by our launch partner, Doubleword.

<a href="https://doubleword.ai" target="_blank" rel="noopener">
  <img className="block dark:hidden h-8" src="https://mintcdn.com/txt/oGiUvPskM13cbsmq/images/doubleword-logo-black.svg?fit=max&auto=format&n=oGiUvPskM13cbsmq&q=85&s=f0c79a70f35321f864f2395a270f81d0" alt="Doubleword" width="466" height="102" data-path="images/doubleword-logo-black.svg" />

  <img className="hidden dark:block h-8" src="https://mintcdn.com/txt/oGiUvPskM13cbsmq/images/doubleword-logo-white.svg?fit=max&auto=format&n=oGiUvPskM13cbsmq&q=85&s=eb5b01210618727dc4b5ceb148215323" alt="Doubleword" width="466" height="103" data-path="images/doubleword-logo-white.svg" />
</a>
