ollama/docs
Devon Rifkin 9f7822851c
docs: add docs for v1/responses and rework openai compat section (#13416)
* docs: add docs for v1/responses and rework openai compat section

I reworked the examples to be separated by topic and to be fully
runnable (i.e., they now log output instead of just suggesting how a
call might be made).

We now use `<CodeGroup>`s so that each example has a dropdown on the
docs site for users to choose, which makes the examples a lot more
digestible (since you only see approx 1/3 of the code you used to).

I also added a new tool to extract code examples into files so that it's
easier to actually run them and check that they work.

## Example

```shell
go run docs/tools/extract-examples/main.go docs/api/openai-compatibility.mdx
```

Output:

```
Extracting code examples to: /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368

  - 01_basic.py
  - 01_basic.js
  - 01_basic.sh
  - 02_responses.py
  - 02_responses.js
  - 02_responses.sh
  - 03_vision.py
  - 03_vision.js
  - 03_vision.sh

Extracted 9 file(s) to /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368

To run examples:

  cd /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368
  npm install   # for JS examples

then run individual files with `node file.js`, `python file.py`, `bash file.sh`
```

In the future we should consider actually running the examples in CI and
having some sort of acceptance test so we can automatically detect when
our examples break. So this is just a start in that direction.

* Update docs/api/openai-compatibility.mdx

Co-authored-by: Parth Sareen <parth.sareen@ollama.com>

* Update docs/api/openai-compatibility.mdx

Co-authored-by: Parth Sareen <parth.sareen@ollama.com>

---------

Co-authored-by: Parth Sareen <parth.sareen@ollama.com>
2025-12-11 17:39:40 -08:00
..
api docs: add docs for v1/responses and rework openai compat section (#13416) 2025-12-11 17:39:40 -08:00
capabilities Update user message format for temperature query (#13256) 2025-12-02 15:08:39 -08:00
images docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
integrations docs: fix typo in vscode.mdx (#13116) 2025-11-18 13:18:42 -08:00
tools/extract-examples docs: add docs for v1/responses and rework openai compat section (#13416) 2025-12-11 17:39:40 -08:00
README.md docs: fix 404 link to modelfile documentation (#12996) 2025-11-07 10:06:46 -08:00
api.md docs: fix link to modelfile.mdx (#13220) 2025-12-11 16:14:45 -08:00
cli.mdx embeddings: added embedding command for cl (#12795) 2025-11-05 11:58:03 -08:00
cloud.mdx docs: link to ollama.com instead of hardcoding list of cloud models (#13110) 2025-11-16 20:56:09 -08:00
context-length.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
development.md Add Vulkan GPU support instructions in development.md (#13265) 2025-12-02 13:37:32 -08:00
docker.mdx Enable Vulkan with a temporary opt-in setting (#12931) 2025-11-12 08:40:38 -08:00
docs.json docs: rename api-reference.md back to api.md since redirect stopped working (#13056) 2025-11-11 15:53:06 -08:00
examples.md docs: update readme and links (#12809) 2025-10-28 16:20:02 -07:00
faq.mdx docs: fix output formatting in faq.mdx (#13231) 2025-11-28 19:19:21 -05:00
favicon-dark.svg docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
favicon.svg docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
gpu.mdx Enable Vulkan with a temporary opt-in setting (#12931) 2025-11-12 08:40:38 -08:00
import.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
index.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
linux.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
logo.svg docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
macos.mdx docs: update readme and links (#12809) 2025-10-28 16:20:02 -07:00
modelfile.mdx docs: remove deprecated parameters (#13237) 2025-11-26 11:03:09 +09:00
ollama-logo.svg docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
ollama.png docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
openapi.yaml docs: add logprobs to openapi (#13090) 2025-11-14 14:14:58 -08:00
quickstart.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
styling.css docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
template.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
troubleshooting.md docs: add new cloud model + fix openai redirect (#12812) 2025-10-28 19:09:07 -07:00
troubleshooting.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
windows.mdx docs: update readme and links (#12809) 2025-10-28 16:20:02 -07:00