Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Introduce clef and clef flash on cloud

Jonathan Bergd629978e4429
diff --git a/docs/api/introduction.mdx b/docs/api/introduction.mdx
index 2d7a73d4b..1c5dd4b50 100644
--- a/docs/api/introduction.mdx
+++ b/docs/api/introduction.mdx
@@ -22,7 +22,7 @@ The Anthropic client appends `/v1/messages` to its base URL.
Cloud requests need an API key. Local requests do not. To use cloud models through your local server, [sign in to Ollama](/api/authentication#signing-in).
-Creating or deleting models requires a local Ollama server. [System One](/capabilities/decision) also requires a local server and is not yet available on Ollama Cloud. For supported API features, see [OpenAI compatibility](/api/openai-compatibility) and [Anthropic compatibility](/api/anthropic-compatibility).
+Creating or deleting models requires a local Ollama server. [System One](/capabilities/decision) runs locally and on Ollama Cloud with `clef:cloud` and `clef-flash:cloud`. For supported API features, see [OpenAI compatibility](/api/openai-compatibility) and [Anthropic compatibility](/api/anthropic-compatibility).
## Ollama API example
diff --git a/docs/capabilities/decision.mdx b/docs/capabilities/decision.mdx
index 8e23702f7..316bf3729 100644
--- a/docs/capabilities/decision.mdx
+++ b/docs/capabilities/decision.mdx
@@ -4,7 +4,7 @@ description: Classify text, estimate yes/no probabilities, and score ordered cri
---
<Note>
-Currently available locally in Ollama.
+Available locally, and in [Ollama's cloud](/cloud) with `clef:cloud` and `clef-flash:cloud`.
</Note>
Use System One to classify text, answer yes/no questions, or score text against a rubric.
@@ -112,6 +112,45 @@ Example response:
}
```
+## Use a cloud model
+
+[Clef](https://ollama.com/library/clef) and [Clef Flash](https://ollama.com/library/clef-flash) also run in [Ollama's cloud](/cloud). Add `:cloud` to the model name to send the request through a local Ollama server signed in to ollama.com:
+
+```shell cloud.sh
+curl http://localhost:11434/v1/systemone \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "model": "clef-flash:cloud",
+ "state": "Our checkout has returned 500 errors since 9am.",
+ "questions": {
+ "urgent": {
+ "type": "noul",
+ "instructions": "Does this ticket need attention within the hour?"
+ }
+ }
+ }'
+```
+
+Or call ollama.com directly with an [API key](https://ollama.com/settings/keys):
+
+```shell cloud-direct.sh
+curl https://ollama.com/v1/systemone \
+ -H "Authorization: Bearer $OLLAMA_API_KEY" \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "model": "clef-flash",
+ "state": "Our checkout has returned 500 errors since 9am.",
+ "questions": {
+ "urgent": {
+ "type": "noul",
+ "instructions": "Does this ticket need attention within the hour?"
+ }
+ }
+ }'
+```
+
+Cloud requests accept up to 64 questions, up to 4 images of at most 4 MiB and 16 megapixels each, and `state` plus `questions` of at most 64 KiB. Input is limited to 24,000 tokens for `clef-flash` and 64,000 for `clef`; longer input returns `413`. Usage is billed per input token at the [listed price](https://ollama.com/pricing).
+
## Question types
| Type | Criteria | Result |
diff --git a/server/routes.go b/server/routes.go
index be7dfb597..5483219b8 100644
--- a/server/routes.go
+++ b/server/routes.go
@@ -987,7 +987,15 @@ func (s *Server) SystemOneHandler(c *gin.Context) {
return
}
if ref.Source == modelSourceCloud {
- c.JSON(http.StatusBadRequest, gin.H{"error": "System One requires a local decision model"})
+ // Forward the original body with the model name normalized — re-encoding
+ // the decoded request would add nulls upstream rejects (e.g. noul
+ // criteria).
+ normalized, err := replaceJSONModelField(body, ref.Base)
+ if err != nil {
+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
+ return
+ }
+ proxyCloudRequest(c, normalized, cloudErrRemoteInferenceUnavailable)
return
}
m, err := s.getExistingModelForRunner(ref.Name.String(), "")
diff --git a/server/systemone_test.go b/server/systemone_test.go
index cd29ab6d2..6b97a9c1f 100644
--- a/server/systemone_test.go
+++ b/server/systemone_test.go
@@ -7,6 +7,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ "io"
"net/http"
"net/http/httptest"
"strings"
@@ -202,7 +203,6 @@ func TestSystemOneHandler(t *testing.T) {
{"omitted model", `{"state":"x","questions":{"x":{"type":"noul","instructions":"q"}}}`, nil, 400, 0, false},
{"blank model", `{"model":" ","state":"x","questions":{"x":{"type":"noul","instructions":"q"}}}`, nil, 400, 0, false},
{"missing model", `{"model":"missing","state":"x","questions":{"x":{"type":"noul","instructions":"q"}}}`, nil, 404, 0, false},
- {"cloud", `{"model":"decision:cloud","state":"x","questions":{"x":{"type":"noul","instructions":"q"}}}`, nil, 400, 0, false},
{"safetensors success", `{"model":"safetensors-decision","state":"x","questions":{"refund":{"type":"noul","instructions":"q"}}}`, nil, 200, 1, false},
{"safetensors decision only", `{"model":"safetensors-decision-only","state":"x","questions":{"refund":{"type":"noul","instructions":"q"}}}`, nil, 200, 1, false},
{"Strands pointer head", `{"model":"safetensors-strands","state":"x","questions":{"refund":{"type":"noul","instructions":"q"}}}`, nil, 200, 1, false},
@@ -365,3 +365,69 @@ func TestSystemOneHandler(t *testing.T) {
})
}
}
+
+func TestSystemOneHandlerCloudPassthrough(t *testing.T) {
+ gin.SetMode(gin.TestMode)
+ t.Setenv("OLLAMA_MODELS", t.TempDir())
+
+ upstreamBody := `{"model":"clef-flash","answers":{"refund":{"type":"noul","noul":0.9}},"usage":{"input_tokens":42,"output_tokens":0}}`
+ var capturedPath, capturedBody string
+ upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ payload, _ := io.ReadAll(r.Body)
+ capturedPath = r.URL.Path
+ capturedBody = string(payload)
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ _, _ = w.Write([]byte(upstreamBody))
+ }))
+ defer upstream.Close()
+
+ original := cloudProxyBaseURL
+ cloudProxyBaseURL = upstream.URL
+ t.Cleanup(func() { cloudProxyBaseURL = original })
+
+ s := &Server{}
+ router, err := s.GenerateRoutes()
+ if err != nil {
+ t.Fatal(err)
+ }
+ local := httptest.NewServer(router)
+ defer local.Close()
+
+ resp, err := local.Client().Post(local.URL+"/v1/systemone", "application/json", strings.NewReader(
+ `{"model":"clef-flash:cloud","state":"refund please","questions":{"refund":{"type":"noul","instructions":"Refund requested?"}}}`,
+ ))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ body, _ := io.ReadAll(resp.Body)
+ if resp.StatusCode != http.StatusOK {
+ t.Fatalf("expected status 200, got %d (%s)", resp.StatusCode, string(body))
+ }
+
+ if capturedPath != "/v1/systemone" {
+ t.Fatalf("expected upstream path /v1/systemone, got %q", capturedPath)
+ }
+ if !strings.Contains(capturedBody, `"model":"clef-flash"`) {
+ t.Fatalf("expected normalized model in upstream body, got %q", capturedBody)
+ }
+ if strings.Contains(capturedBody, `:cloud`) {
+ t.Fatalf("expected no cloud suffix in upstream body, got %q", capturedBody)
+ }
+
+ var decisionResp struct {
+ Model string `json:"model"`
+ Answers map[string]any `json:"answers"`
+ Usage decision.Usage `json:"usage"`
+ }
+ if err := json.Unmarshal(body, &decisionResp); err != nil {
+ t.Fatalf("failed to parse response: %v (%s)", err, string(body))
+ }
+ if decisionResp.Model != "clef-flash" || decisionResp.Usage.InputTokens != 42 || decisionResp.Usage.OutputTokens != 0 {
+ t.Fatalf("unexpected response: %s", string(body))
+ }
+ if len(decisionResp.Answers) != 1 {
+ t.Fatalf("expected one answer, got %s", string(body))
+ }
+}