[PR #5209] [MERGED] OpenAI: v1/completions compatibility #11716

Closed
opened 2026-04-12 23:36:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/5209
Author: @royjhan
Created: 6/22/2024
Status: Merged
Merged: 7/2/2024
Merged by: @royjhan

Base: mainHead: royh-completions


📝 Commits (10+)

📊 Changes

3 files changed (+353 additions, -3 deletions)

View changed files

📝 openai/openai.go (+222 -1)
📝 openai/openai_test.go (+130 -2)
📝 server/routes.go (+1 -0)

📄 Description

curl http://localhost:11434/v1/completions \ -H "Content-Type: application/json" \ -d '{ "model": "llama3", "prompt": "Say this is a test", "temperature": 0 }' | jq

{
  "id": "cmpl-210",
  "object": "text_completion",
  "created": 1719010238,
  "model": "llama3",
  "system_fingerprint": "fp_ollama",
  "choices": [
    {
      "text": "It looks like you're testing to see if I'm paying attention! Well, I am! You said \"Say this is a test\" - that's a classic phrase often used in tests or assessments. Am I right?",
      "index": 0,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 46,
    "total_tokens": 46
  }
}

Resolves #3027


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/5209 **Author:** [@royjhan](https://github.com/royjhan) **Created:** 6/22/2024 **Status:** ✅ Merged **Merged:** 7/2/2024 **Merged by:** [@royjhan](https://github.com/royjhan) **Base:** `main` ← **Head:** `royh-completions` --- ### 📝 Commits (10+) - [`cb6d5b0`](https://github.com/ollama/ollama/commit/cb6d5b0310ae2c245c7e4f0cf3f85676789b9c7e) OpenAI v1 models - [`1114d96`](https://github.com/ollama/ollama/commit/1114d9661bc0cee5aaa1e9f7f6e24aee12e6c6fe) Refactor Writers - [`e57f0d1`](https://github.com/ollama/ollama/commit/e57f0d19f389d46e88441466ed6e1fc3870f9020) Add Test - [`310940d`](https://github.com/ollama/ollama/commit/310940d11e56232d7c6220dc809fef894b0c0618) Credit Co-Author - [`691e448`](https://github.com/ollama/ollama/commit/691e44869e3f463a79be6137b11e8780fde3d24d) Merge branch 'main' into royh-openai - [`65c0850`](https://github.com/ollama/ollama/commit/65c08507cb55839709da2db0f7dad65bb2133485) Empty List Testing - [`c826421`](https://github.com/ollama/ollama/commit/c826421f17ea2a3b351a9da18e36a993b0856a33) Use Namespace for Ownedby - [`fe1a625`](https://github.com/ollama/ollama/commit/fe1a625fee3c2b663c7814042392135fc9bdd973) Update Test - [`3cf19d9`](https://github.com/ollama/ollama/commit/3cf19d95880cbd16073733622c9fe505050baf02) Add back envconfig - [`c037616`](https://github.com/ollama/ollama/commit/c037616d6bbecf91ec87a84336bac45f07846fe5) v1/models docs ### 📊 Changes **3 files changed** (+353 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `openai/openai.go` (+222 -1) 📝 `openai/openai_test.go` (+130 -2) 📝 `server/routes.go` (+1 -0) </details> ### 📄 Description `curl http://localhost:11434/v1/completions \ -H "Content-Type: application/json" \ -d '{ "model": "llama3", "prompt": "Say this is a test", "temperature": 0 }' | jq` ``` { "id": "cmpl-210", "object": "text_completion", "created": 1719010238, "model": "llama3", "system_fingerprint": "fp_ollama", "choices": [ { "text": "It looks like you're testing to see if I'm paying attention! Well, I am! You said \"Say this is a test\" - that's a classic phrase often used in tests or assessments. Am I right?", "index": 0, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 0, "completion_tokens": 46, "total_tokens": 46 } } ``` Resolves #3027 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:36:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#11716