Skip to content

Add Ollama-compatible API endpoints and model capability support#450

Merged
CJackHwang merged 1 commit intodevfrom
codex/add-json-tag-for-ollama-model-id
May 7, 2026
Merged

Add Ollama-compatible API endpoints and model capability support#450
CJackHwang merged 1 commit intodevfrom
codex/add-json-tag-for-ollama-model-id

Conversation

@CJackHwang
Copy link
Copy Markdown
Owner

Motivation

  • Expose an Ollama-compatible surface so clients can query version, model tags and model capabilities via /api/version, /api/tags, and /api/show.
  • Ensure Ollama responses use lowercase id and include capabilities for compatibility with strict schemas and Ollama-style clients.

Description

  • Added Ollama docs to API.en.md and API.md describing the new endpoints and example payloads for POST /api/show.
  • Implemented Ollama HTTP handlers in internal/httpapi/ollama/handler_routes.go providing GetVersion, ListOllamaModels, and GetOllamaModel and improved request body closing with a slog warning on failure.
  • Extended model configuration types in internal/config/models.go by adding JSON tags for Ollama capability objects and ensured mapping to Ollama model structs via mapToOllamaModels and appendNoThinkingVariants.
  • Updated tests in internal/httpapi/ollama/handler_routes_test.go to assert valid JSON responses and that the response exposes a lowercase id (and does not expose uppercase ID).

Testing

  • Ran the Ollama handler tests with go test ./internal/httpapi/ollama and they succeeded.
  • Ran package-level unit tests for the modified handlers and model mapping which also passed.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment May 7, 2026 5:12pm

@CJackHwang CJackHwang merged commit fa48924 into dev May 7, 2026
8 checks passed
@CJackHwang CJackHwang deleted the codex/add-json-tag-for-ollama-model-id branch May 7, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant