# LLMs & AI (https://dev.cosmospay.lat/docs/ai/)

> Feed the Cosmos Pay docs and SDK to your LLM or coding agent with ready-made llms.txt files, per-page Markdown, and "Open in ChatGPT/Claude".

These docs are built to be consumed by LLMs and coding agents (Cursor, Claude, ChatGPT…), not
just by humans. Copying the Markdown of a page is one option, but there's a lot more.

## Ready-made context files

Two endpoints expose the whole documentation as plain text an LLM can ingest in one shot:

- `/docs/llms.txt`: a compact index of every page with its title, URL and description.
- `/docs/llms-full.txt`: the full text of every page, concatenated.

```bash
# the index
curl https://dev.cosmospay.lat/docs/llms.txt

# everything, in one file (great for a single prompt or a RAG ingest)
curl https://dev.cosmospay.lat/docs/llms-full.txt
```

## Any single page as Markdown

Every page has an actions menu (top-right of the page) with:

- **Copy Markdown** / **View as Markdown**: the raw Markdown source of that page.
- **Open in ChatGPT** / **Open in Claude**: opens the assistant pre-loaded with that page.

You can also fetch a page's Markdown directly by appending `/content.md` under `/docs/llms.mdx`:

```bash
# the quickstart page, as Markdown
curl https://dev.cosmospay.lat/docs/llms.mdx/sdk/server/quickstart/content.md
```

> **Use it in a prompt**
>
> Paste `llms-full.txt` (or a single page's Markdown) into your assistant and let it write the
> integration, for example *"Using this, create a Cosmos Pay checkout that charges 10 USDC and verifies
> the payment with a webhook."*

## The Payments API as OpenAPI

The [API reference](https://dev.cosmospay.lat/docs/api/) is generated from an OpenAPI 3.0 document, and that document is
published with these docs. Hand it to a coding agent, an API client or a code generator for the
whole contract: every endpoint with its parameters, request body and responses.

```bash
curl https://dev.cosmospay.lat/docs/openapi.json
```

## The SDK ships its own LLM docs

The `@cosmosapp/pay_sdk` package bundles an AI-readable `llms/` folder, so once you install it
the docs are right there in `node_modules`, with no network needed:

```text
node_modules/@cosmosapp/pay_sdk/llms/
├─ llms.txt          # index
├─ llms-full.txt     # everything in one file
└─ NN-*.md           # one atomic topic per file
```

```bash
# point your agent at the installed SDK docs
cat node_modules/@cosmosapp/pay_sdk/llms/llms-full.txt
```

## Runnable examples

The SDK repository keeps one runnable example per feature (payment intents, webhooks, the web
client, customers, products, analytics, error handling). They make ideal few-shot material for an agent.

- [SDK examples](https://github.com/CosmosPay/CosmosJS_SDK/tree/main/examples): One runnable example per feature, in the SDK repo.
- [Quickstart](https://dev.cosmospay.lat/docs/sdk/server/quickstart/): The shortest end-to-end integration.
