[GH-ISSUE #13374] Basic tool calling support (OpenAI compatibility) #8831

Closed
opened 2026-04-12 21:36:56 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @cornusandu on GitHub (Dec 8, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/13374

I know that tool calling might be a little difficult to add, but even basic things like being able to read/write to/from files would still be great.
I'd appreciate it if you could implement even some basic tools on the OpenAI compatibility API (/v1).
Thank you!

Originally created by @cornusandu on GitHub (Dec 8, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/13374 I know that tool calling might be a little difficult to add, but even basic things like being able to read/write to/from files would still be great. I'd appreciate it if you could implement even some basic tools on the OpenAI compatibility API (`/v1`). Thank you!
GiteaMirror added the feature request label 2026-04-12 21:36:56 -05:00
Author
Owner

@rick-github commented on GitHub (Dec 8, 2025):

Tool calls are available via the OpenAI compatibility endpoint.

$ curl -s localhost:11434/v1/chat/completions -d '{
  "model":"qwen3-coder",
  "messages":[
    {"role":"user","content":"what is in main.go?"}
  ],
  "tools":[{
    "type":"function",
    "function":{
      "name":"read_file",
      "description":"Read the contents of a file",
      "parameters":{"type":"object","properties":{}}
    }
  }],"stream":false}' | jq
{
  "id": "chatcmpl-523",
  "object": "chat.completion",
  "created": 1765198478,
  "model": "qwen3-coder",
  "system_fingerprint": "fp_ollama",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "",
        "tool_calls": [
          {
            "id": "call_51qx96al",
            "index": 0,
            "type": "function",
            "function": {
              "name": "read_file",
              "arguments": "{\"filename\":\"main.go\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 254,
    "completion_tokens": 23,
    "total_tokens": 277
  }
}
<!-- gh-comment-id:3626841443 --> @rick-github commented on GitHub (Dec 8, 2025): Tool calls are available via the OpenAI compatibility endpoint. ```console $ curl -s localhost:11434/v1/chat/completions -d '{ "model":"qwen3-coder", "messages":[ {"role":"user","content":"what is in main.go?"} ], "tools":[{ "type":"function", "function":{ "name":"read_file", "description":"Read the contents of a file", "parameters":{"type":"object","properties":{}} } }],"stream":false}' | jq { "id": "chatcmpl-523", "object": "chat.completion", "created": 1765198478, "model": "qwen3-coder", "system_fingerprint": "fp_ollama", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "", "tool_calls": [ { "id": "call_51qx96al", "index": 0, "type": "function", "function": { "name": "read_file", "arguments": "{\"filename\":\"main.go\"}" } } ] }, "finish_reason": "tool_calls" } ], "usage": { "prompt_tokens": 254, "completion_tokens": 23, "total_tokens": 277 } } ```
Author
Owner

@pd95 commented on GitHub (Dec 10, 2025):

I think the problems are slowly coming up as OpenAI moves away from chat/completions API to responses. (see discussion at https://github.com/openai/codex/discussions/7782). Currently I'm not able to reliably use Codex CLI as of 0.64.0 with my Ollama setup (which is on latest version). I had to downgrade to codex 0.63.0...
But as I see it, the current chat/completions API will not be maintained anymore. So the question will be whether the new responses API will be/can be supported in an upcoming Ollama version.

<!-- gh-comment-id:3637577678 --> @pd95 commented on GitHub (Dec 10, 2025): I think the problems are slowly coming up as OpenAI moves away from `chat/completions` API to responses. (see discussion at https://github.com/openai/codex/discussions/7782). Currently I'm not able to reliably use Codex CLI as of 0.64.0 with my Ollama setup (which is on latest version). I had to downgrade to codex 0.63.0... But as I see it, the current `chat/completions` API will not be maintained anymore. So the question will be whether the new `responses` API will be/can be supported in an upcoming Ollama version.
Author
Owner

@rick-github commented on GitHub (Dec 10, 2025):

https://github.com/ollama/ollama/pull/13351

<!-- gh-comment-id:3637824663 --> @rick-github commented on GitHub (Dec 10, 2025): https://github.com/ollama/ollama/pull/13351
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#8831