Sync ollama docs from eab97e9f on 2026-10-12
This commit is contained in:
@@ -2,9 +2,42 @@
|
||||
title: Anthropic compatibility
|
||||
---
|
||||
|
||||
Ollama provides compatibility with the [Anthropic Messages API](https://docs.anthropic.com/en/api/messages) to help connect existing applications to Ollama, including tools like Claude Code.
|
||||
Connect Anthropic clients and tools such as Claude Code to Ollama. Ollama supports a subset of the [Anthropic Messages API](https://platform.claude.com/docs/en/api/http/messages/create).
|
||||
|
||||
## Usage
|
||||
## Direct cloud access
|
||||
|
||||
Set your [API key](https://ollama.com/settings/keys) in `OLLAMA_API_KEY`. No Ollama installation required.
|
||||
|
||||
```shell
|
||||
export OLLAMA_API_KEY="your_api_key"
|
||||
```
|
||||
|
||||
Send a request with bearer authentication:
|
||||
|
||||
```shell
|
||||
curl https://ollama.com/v1/messages \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "anthropic-version: 2023-06-01" \
|
||||
-d '{
|
||||
"model": "gemma4:31b",
|
||||
"max_tokens": 1024,
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Say hello in one sentence."
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
Read text blocks from `content`. The cloud endpoint requires `Authorization: Bearer`; it does not accept `x-api-key` alone.
|
||||
|
||||
Compatible models support messages, streaming, and function calling. Tool-choice controls, deferred tools, and hosted web search are not fully supported.
|
||||
|
||||
## Local server usage
|
||||
|
||||
These examples connect to your local Ollama server. Use `ollama` as the placeholder API key. To use cloud models through this server, [sign in to Ollama](/api/authentication#signing-in).
|
||||
|
||||
### Environment variables
|
||||
|
||||
@@ -234,55 +267,7 @@ curl -X POST http://localhost:11434/v1/messages \
|
||||
|
||||
## Using with Claude Code
|
||||
|
||||
[Claude Code](https://code.claude.com/docs/en/overview) can be configured to use Ollama as its backend.
|
||||
|
||||
### Recommended models
|
||||
|
||||
For coding use cases, models like `glm-4.7`, `minimax-m2.1`, and `qwen3-coder` are recommended.
|
||||
|
||||
Download a model before use:
|
||||
|
||||
```shell
|
||||
ollama pull qwen3-coder
|
||||
```
|
||||
> Note: Qwen 3 coder is a 30B parameter model requiring at least 24GB of VRAM to run smoothly. More is required for longer context lengths.
|
||||
|
||||
```shell
|
||||
ollama pull glm-4.7:cloud
|
||||
```
|
||||
|
||||
### Quick setup
|
||||
|
||||
```shell
|
||||
ollama launch claude
|
||||
```
|
||||
|
||||
This will prompt you to select a model, configure Claude Code automatically, and launch it. To configure without launching:
|
||||
|
||||
```shell
|
||||
ollama launch claude --config
|
||||
```
|
||||
|
||||
### Manual setup
|
||||
|
||||
Set the environment variables and run Claude Code:
|
||||
|
||||
```shell
|
||||
ANTHROPIC_AUTH_TOKEN=ollama ANTHROPIC_BASE_URL=http://localhost:11434 claude --model qwen3-coder
|
||||
```
|
||||
|
||||
Or set the environment variables in your shell profile:
|
||||
|
||||
```shell
|
||||
export ANTHROPIC_AUTH_TOKEN=ollama
|
||||
export ANTHROPIC_BASE_URL=http://localhost:11434
|
||||
```
|
||||
|
||||
Then run Claude Code with any Ollama model:
|
||||
|
||||
```shell
|
||||
claude --model qwen3-coder
|
||||
```
|
||||
See the [Claude Code guide](/integrations/claude-code) for Ollama Launch and [direct cloud setup](/integrations/claude-code#connect-directly-to-ollama-cloud).
|
||||
|
||||
## Endpoints
|
||||
|
||||
@@ -318,6 +303,8 @@ claude --model qwen3-coder
|
||||
- [x] `stop_sequences`
|
||||
- [x] `tools`
|
||||
- [x] `thinking`
|
||||
- [x] `output_config`
|
||||
- [x] `effort` (model-defined names)
|
||||
- [ ] `tool_choice`
|
||||
- [ ] `metadata`
|
||||
|
||||
@@ -342,6 +329,8 @@ claude --model qwen3-coder
|
||||
- [x] `ping`
|
||||
- [x] `error`
|
||||
|
||||
Use `/api/show` to discover a model's supported thinking values and default. `thinking.type: "enabled"` and `"disabled"` act as explicit on/off controls. When a model uses its metadata to resolve named levels, supported `output_config.effort` names are applied exactly and unsupported names resolve to the model default. Models without metadata keep the existing compatibility behavior, which trims and lowercases effort names and maps `"xhigh"` to `"high"`.
|
||||
|
||||
## Models
|
||||
|
||||
Ollama supports both local and cloud models.
|
||||
@@ -360,12 +349,9 @@ Recommended local models:
|
||||
|
||||
### Cloud models
|
||||
|
||||
Cloud models are available immediately without pulling:
|
||||
Browse the [cloud model catalog](https://ollama.com/search?c=cloud). Through a signed-in Ollama server, use a cloud name such as `gemma4:cloud` without a separate pull. For direct cloud requests, use the hosted identifier, such as `gemma4:31b`.
|
||||
|
||||
- `glm-4.7:cloud` - High-performance cloud model
|
||||
- `minimax-m2.1:cloud` - Fast cloud model
|
||||
|
||||
### Default model names
|
||||
### Default model names on a local server
|
||||
|
||||
For tooling that relies on default Anthropic model names such as `claude-3-5-sonnet`, use `ollama cp` to copy an existing model name:
|
||||
|
||||
@@ -394,8 +380,8 @@ curl http://localhost:11434/v1/messages \
|
||||
|
||||
### Behavior differences
|
||||
|
||||
- API key is accepted but not validated
|
||||
- `anthropic-version` header is accepted but not used
|
||||
- The local server does not validate API keys. Direct cloud inference requires a valid bearer token.
|
||||
- The hosted endpoint rejects `anthropic-version` values older than `2023-06-01`. Use `2023-06-01` in requests.
|
||||
- Token counts are approximations based on the underlying model's tokenizer
|
||||
|
||||
### Not supported
|
||||
|
||||
+29
-35
@@ -2,34 +2,52 @@
|
||||
title: Authentication
|
||||
---
|
||||
|
||||
No authentication is required when accessing Ollama's API locally via `http://localhost:11434`.
|
||||
The local API at `http://localhost:11434` does not require authentication.
|
||||
|
||||
Authentication is required for the following:
|
||||
To use cloud models, publish models, or download private models, sign in to Ollama. For direct API access to ollama.com, use an API key.
|
||||
|
||||
* Running cloud models via ollama.com
|
||||
* Publishing models
|
||||
* Downloading private models
|
||||
## API keys
|
||||
|
||||
Ollama supports two authentication methods:
|
||||
Direct cloud inference at `https://ollama.com/api` and `https://ollama.com/v1` requires an API key. No Ollama installation or local server is required.
|
||||
|
||||
* **Signing in**: sign in from your local installation, and Ollama will automatically take care of authenticating requests to ollama.com when running commands
|
||||
* **API keys**: API keys for programmatic access to ollama.com's API
|
||||
Create an [API key](https://ollama.com/settings/keys), then set it in your terminal:
|
||||
|
||||
```shell
|
||||
export OLLAMA_API_KEY="your_api_key"
|
||||
```
|
||||
|
||||
Use the API key in the `Authorization: Bearer` header. This also applies to the hosted Anthropic-compatible `/v1/messages` endpoint; `x-api-key` alone is not supported.
|
||||
|
||||
```shell
|
||||
curl https://ollama.com/api/chat \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "gemma4:31b",
|
||||
"messages": [{"role": "user", "content": "Why is the sky blue?"}],
|
||||
"stream": false
|
||||
}'
|
||||
```
|
||||
|
||||
API keys do not expire. Revoke a key in [API keys settings](https://ollama.com/settings/keys).
|
||||
|
||||
Keep keys outside browser code and source control. See the [API quickstart](/quickstart#build-an-application) for shell setup and compatibility examples.
|
||||
|
||||
## Signing in
|
||||
|
||||
To sign in to ollama.com from your local installation of Ollama, run:
|
||||
Sign in from your terminal:
|
||||
|
||||
```
|
||||
ollama signin
|
||||
```
|
||||
|
||||
Once signed in, Ollama will automatically authenticate commands as required:
|
||||
Ollama then authenticates cloud requests for you:
|
||||
|
||||
```
|
||||
ollama run gpt-oss:120b-cloud
|
||||
```
|
||||
|
||||
Similarly, when accessing a local API endpoint that requires cloud access, Ollama will automatically authenticate the request:
|
||||
This also works through the local API:
|
||||
|
||||
```shell
|
||||
curl http://localhost:11434/api/generate -d '{
|
||||
@@ -37,27 +55,3 @@ curl http://localhost:11434/api/generate -d '{
|
||||
"prompt": "Why is the sky blue?"
|
||||
}'
|
||||
```
|
||||
|
||||
## API keys
|
||||
|
||||
For direct access to ollama.com's API served at `https://ollama.com/api`, authentication via API keys is required.
|
||||
|
||||
First, create an [API key](https://ollama.com/settings/keys), then set the `OLLAMA_API_KEY` environment variable:
|
||||
|
||||
```shell
|
||||
export OLLAMA_API_KEY=your_api_key
|
||||
```
|
||||
|
||||
Then use the API key in the Authorization header:
|
||||
|
||||
```shell
|
||||
curl https://ollama.com/api/generate \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY" \
|
||||
-d '{
|
||||
"model": "gpt-oss:120b",
|
||||
"prompt": "Why is the sky blue?",
|
||||
"stream": false
|
||||
}'
|
||||
```
|
||||
|
||||
API keys don't currently expire, however you can revoke them at any time in your [API keys settings](https://ollama.com/settings/keys).
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: Balance
|
||||
sidebarTitle: /api/balance
|
||||
openapi: /openapi.yaml GET /api/balance
|
||||
---
|
||||
|
||||
<RequestExample>
|
||||
|
||||
```shell Request
|
||||
curl https://ollama.com/api/balance \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY"
|
||||
```
|
||||
|
||||
</RequestExample>
|
||||
|
||||
<ResponseExample>
|
||||
|
||||
```json Response
|
||||
{
|
||||
"included": {
|
||||
"balance_usd": 72.5,
|
||||
"allowance_usd": 100,
|
||||
"period": {
|
||||
"from": "2026-09-15T09:30:00Z",
|
||||
"until": "2026-10-15T09:30:00Z"
|
||||
}
|
||||
},
|
||||
"purchased": {
|
||||
"balance_usd": 25
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</ResponseExample>
|
||||
|
||||
This endpoint takes no query parameters. For usage history, see [Cloud usage](/api/cloud-usage).
|
||||
|
||||
## Balances
|
||||
|
||||
The included period follows your plan's monthly reset schedule, including for annual subscriptions. Period timestamps are in UTC, with `from` inclusive and `until` exclusive.
|
||||
|
||||
The purchased balance includes only unexpired credits.
|
||||
|
||||
<Accordion title="Legacy plans">
|
||||
|
||||
Plans with session and weekly limits return `session` and `weekly` in `included`:
|
||||
|
||||
```json
|
||||
{
|
||||
"included": {
|
||||
"session": {
|
||||
"remaining_percent": 75,
|
||||
"resets_at": "2026-10-01T07:00:00Z"
|
||||
},
|
||||
"weekly": {
|
||||
"remaining_percent": 40,
|
||||
"resets_at": "2026-10-05T00:00:00Z"
|
||||
}
|
||||
},
|
||||
"purchased": {
|
||||
"balance_usd": 25
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`remaining_percent` ranges from `0` to `100`; `75` means 75% remains. `resets_at` is the next reset time in UTC.
|
||||
|
||||
</Accordion>
|
||||
|
||||
## Rate limits
|
||||
|
||||
This endpoint allows 10 requests per minute per user, shared across API keys and devices. We recommend polling once per minute. A `429` response includes a `Retry-After` header with the number of seconds to wait before retrying.
|
||||
|
||||
## Teams
|
||||
|
||||
All team members share the same included and purchased balances.
|
||||
|
||||
## Reference
|
||||
@@ -0,0 +1,120 @@
|
||||
---
|
||||
title: Cloud usage
|
||||
sidebarTitle: /api/usage
|
||||
openapi: /openapi.yaml GET /api/usage
|
||||
---
|
||||
|
||||
<RequestExample>
|
||||
|
||||
```shell Request
|
||||
curl 'https://ollama.com/api/usage?range=24h' \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY"
|
||||
```
|
||||
|
||||
</RequestExample>
|
||||
|
||||
<ResponseExample>
|
||||
|
||||
```json Response (22 empty buckets omitted)
|
||||
{
|
||||
"range": "24h",
|
||||
"scope": "self",
|
||||
"granularity": "hour",
|
||||
"from": "2026-09-30T02:00:00Z",
|
||||
"until": "2026-10-01T02:30:00Z",
|
||||
"totals": {
|
||||
"request_count": 15,
|
||||
"usage_usd": 0.01718,
|
||||
"input_tokens": 106000,
|
||||
"cached_input_tokens": 46000,
|
||||
"output_tokens": 13600
|
||||
},
|
||||
"buckets": [
|
||||
{
|
||||
"from": "2026-09-30T12:00:00Z",
|
||||
"until": "2026-09-30T13:00:00Z",
|
||||
"request_count": 4,
|
||||
"usage_usd": 0.0052,
|
||||
"input_tokens": 24000,
|
||||
"cached_input_tokens": 0,
|
||||
"output_tokens": 3200
|
||||
},
|
||||
{
|
||||
"from": "2026-10-01T00:00:00Z",
|
||||
"until": "2026-10-01T01:00:00Z",
|
||||
"request_count": 8,
|
||||
"usage_usd": 0.0088,
|
||||
"input_tokens": 64000,
|
||||
"cached_input_tokens": 40000,
|
||||
"output_tokens": 8000
|
||||
},
|
||||
{
|
||||
"from": "2026-10-01T02:00:00Z",
|
||||
"until": "2026-10-01T02:30:00Z",
|
||||
"partial": true,
|
||||
"request_count": 3,
|
||||
"usage_usd": 0.00318,
|
||||
"input_tokens": 18000,
|
||||
"cached_input_tokens": 6000,
|
||||
"output_tokens": 2400
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
</ResponseExample>
|
||||
|
||||
New usage may take time to appear.
|
||||
|
||||
For your remaining included and purchased credits, use [Balance](/api/balance).
|
||||
|
||||
Unsupported or repeated query parameters return `400`. Errors follow Ollama's [JSON error format](/api/errors#error-messages).
|
||||
|
||||
## Time ranges
|
||||
|
||||
| Range | Starts at | Bucket size | Buckets |
|
||||
| ----- | ------------------------------------------------- | ----------- | ------- |
|
||||
| `24h` | 24 hours before the start of the current UTC hour | Hour | 25 |
|
||||
| `7d` | Seven days ago at 00:00 UTC | Day | 8 |
|
||||
| `30d` | Thirty days ago at 00:00 UTC | Day | 31 |
|
||||
|
||||
Every range ends at the time of the request. For example, at 02:30 UTC on October 1, `24h` starts at 02:00 UTC on September 30. It returns 24 complete hourly buckets followed by the current 02:00–02:30 bucket. The `7d` and `30d` ranges return seven and thirty complete days, followed by today so far.
|
||||
|
||||
Buckets appear in chronological order, including zeroes for hours or days with no recorded requests. The final bucket covers the current hour or day and has `partial: true`.
|
||||
|
||||
All timestamps are in UTC. Each `from` is inclusive and each `until` is exclusive.
|
||||
|
||||
## Usage totals and buckets
|
||||
|
||||
`totals` summarizes usage across the entire range. `buckets` breaks that usage into hours or days.
|
||||
|
||||
`granularity` is set automatically: `hour` for `24h` and `day` for `7d` and `30d`. The top-level `from` and `until` describe the entire range; each bucket has its own boundaries.
|
||||
|
||||
`partial` indicates whether the hour or day is still in progress, rather than whether all usage has been recorded.
|
||||
|
||||
<Accordion title="Legacy plans">
|
||||
|
||||
For legacy plans, only request counts are available. If a bucket or total includes legacy requests, cost and token counts are omitted.
|
||||
|
||||
</Accordion>
|
||||
|
||||
## Rate limits
|
||||
|
||||
This endpoint allows 10 requests per minute per user, shared across API keys and devices. We recommend polling once per minute. A `429` response includes a `Retry-After` header with the number of seconds to wait before retrying.
|
||||
|
||||
## Team usage
|
||||
|
||||
By default, everyone sees their own usage (`scope=self`).
|
||||
|
||||
Team admins can use `scope=team` to see usage for the whole team:
|
||||
|
||||
```shell
|
||||
curl 'https://ollama.com/api/usage?range=7d&scope=team' \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY"
|
||||
```
|
||||
|
||||
## Coming soon
|
||||
|
||||
We plan to add custom time ranges, usage breakdowns by model and API key, and breakdowns by team member for team admins.
|
||||
|
||||
## Reference
|
||||
+29
-19
@@ -2,45 +2,55 @@
|
||||
title: Introduction
|
||||
---
|
||||
|
||||
Use Ollama's API to run and interact with models.
|
||||
Use Ollama's API to build applications with cloud or local models.
|
||||
|
||||
## Get started
|
||||
|
||||
Follow the [quickstart](/quickstart) to install Ollama and make your first request.
|
||||
Call cloud models with an [API key](https://ollama.com/settings/keys). No Ollama installation required. Start with the [API quickstart](/quickstart#build-an-application).
|
||||
|
||||
## Base URL
|
||||
To run models on your computer, [install Ollama and run a local model](/quickstart#run-a-model-locally).
|
||||
|
||||
After installation, Ollama's API is served by default at:
|
||||
## Base URLs
|
||||
|
||||
```
|
||||
http://localhost:11434/api
|
||||
```
|
||||
| API | Direct cloud access | Local Ollama server |
|
||||
| --- | --- | --- |
|
||||
| Ollama | `https://ollama.com/api` | `http://localhost:11434/api` |
|
||||
| OpenAI compatibility | `https://ollama.com/v1` | `http://localhost:11434/v1` |
|
||||
| Anthropic client base URL | `https://ollama.com` | `http://localhost:11434` |
|
||||
|
||||
For running cloud models on [ollama.com](https://ollama.com), the same API is available with the following base URL:
|
||||
The Anthropic client appends `/v1/messages` to its base URL.
|
||||
|
||||
```
|
||||
https://ollama.com/api
|
||||
```
|
||||
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).
|
||||
|
||||
## Example request
|
||||
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).
|
||||
|
||||
Once Ollama is running, its API is automatically available and can be accessed via `curl`:
|
||||
## Ollama API example
|
||||
|
||||
Set `OLLAMA_API_KEY` to your [API key](https://ollama.com/settings/keys), then call a cloud model:
|
||||
|
||||
```shell
|
||||
curl http://localhost:11434/api/generate -d '{
|
||||
"model": "gemma4",
|
||||
"prompt": "Why is the sky blue?"
|
||||
}'
|
||||
curl https://ollama.com/api/chat \
|
||||
-H "Authorization: Bearer $OLLAMA_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "gemma4:31b",
|
||||
"messages": [{"role": "user", "content": "Why is the sky blue?"}],
|
||||
"stream": false
|
||||
}'
|
||||
```
|
||||
|
||||
Read the answer from `message.content`. For local inference, use `http://localhost:11434/api/chat` with a downloaded model and omit the authorization header.
|
||||
|
||||
## Libraries
|
||||
|
||||
Ollama has official libraries for Python and JavaScript:
|
||||
Use Ollama's official libraries with either a local server or the hosted API:
|
||||
|
||||
- [Python](https://github.com/ollama/ollama-python)
|
||||
- [JavaScript](https://github.com/ollama/ollama-js)
|
||||
|
||||
Several community-maintained libraries are available for Ollama. For a full list, see the [Ollama GitHub repository](https://github.com/ollama/ollama?tab=readme-ov-file#libraries--sdks).
|
||||
For direct cloud access, set the host to `https://ollama.com` and supply your API key in the `Authorization: Bearer` header.
|
||||
|
||||
Browse [community libraries](https://github.com/ollama/ollama?tab=readme-ov-file#libraries--sdks).
|
||||
|
||||
## Versioning
|
||||
|
||||
|
||||
@@ -2,9 +2,43 @@
|
||||
title: OpenAI compatibility
|
||||
---
|
||||
|
||||
Ollama provides compatibility with parts of the [OpenAI API](https://platform.openai.com/docs/api-reference) to help connect existing applications to Ollama.
|
||||
Connect OpenAI clients to Ollama. Ollama supports a subset of the [OpenAI API](https://platform.openai.com/docs/api-reference).
|
||||
|
||||
## Usage
|
||||
## Direct cloud access
|
||||
|
||||
Set your [API key](https://ollama.com/settings/keys) in `OLLAMA_API_KEY`. Install the client with `pip install openai`. No Ollama installation required.
|
||||
|
||||
```python
|
||||
import os
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(
|
||||
base_url="https://ollama.com/v1",
|
||||
api_key=os.environ["OLLAMA_API_KEY"],
|
||||
)
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="gemma4:31b",
|
||||
messages=[{"role": "user", "content": "Say hello in one sentence."}],
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
The same client supports stateless Responses requests:
|
||||
|
||||
```python
|
||||
response = client.responses.create(
|
||||
model="gemma4:31b",
|
||||
input="Say hello in one sentence.",
|
||||
)
|
||||
print(response.output_text)
|
||||
```
|
||||
|
||||
Choose a [cloud model](https://ollama.com/search?c=cloud). The cloud API does not support stateful Responses, built-in web search through `/v1/responses`, or custom/freeform tool-call replay.
|
||||
|
||||
## Local server usage
|
||||
|
||||
These examples connect to your local Ollama server. The client requires an API key value, but Ollama ignores it. To use cloud models through this server, [sign in to Ollama](/api/authentication#signing-in).
|
||||
|
||||
### Simple `/v1/chat/completions` example
|
||||
|
||||
@@ -208,14 +242,16 @@ curl -X POST http://localhost:11434/v1/chat/completions \
|
||||
- [x] `top_p`
|
||||
- [x] `max_tokens`
|
||||
- [x] `tools`
|
||||
- [x] `reasoning_effort` (`"high"`, `"medium"`, `"low"`, `"max"`, `"none"`)
|
||||
- [x] `reasoning_effort` (model-defined names and compatibility aliases)
|
||||
- [x] `reasoning`
|
||||
- [x] `effort` (`"high"`, `"medium"`, `"low"`, `"max"`, `"none"`)
|
||||
- [x] `effort` (model-defined names and compatibility aliases)
|
||||
- [ ] `tool_choice`
|
||||
- [ ] `logit_bias`
|
||||
- [ ] `user`
|
||||
- [ ] `n`
|
||||
|
||||
`reasoning_effort` and `reasoning.effort` control model thinking. Use `/api/show` to discover each model's supported values and default. When a model uses its metadata to resolve named levels, supported names are applied exactly and unsupported names resolve to the model default. Boolean-only models that support enabling thinking map recognized compatibility efforts to `true`, while `"none"` requests `false`. Models without metadata retain the existing compatibility aliases: `"minimal"` maps to `"low"`, and `"xhigh"` or `"ultra"` map to `"max"`. GPT-OSS keeps its existing OpenAI compatibility conversion: `"minimal"` uses `"low"`, `"xhigh"` or `"ultra"` use `"high"`, and `"none"` requests no thinking output.
|
||||
|
||||
### `/v1/completions`
|
||||
|
||||
#### Supported features
|
||||
@@ -279,7 +315,9 @@ curl -X POST http://localhost:11434/v1/chat/completions \
|
||||
- [x] `dimensions`
|
||||
- [ ] `user`
|
||||
|
||||
### `/v1/responses`
|
||||
### Responses API
|
||||
|
||||
`POST /v1/responses`
|
||||
|
||||
> Note: Added in Ollama v0.13.3
|
||||
|
||||
@@ -302,19 +340,24 @@ Ollama supports the [OpenAI Responses API](https://platform.openai.com/docs/api-
|
||||
- [x] `temperature`
|
||||
- [x] `top_p`
|
||||
- [x] `max_output_tokens`
|
||||
- [x] `reasoning`
|
||||
- [x] `effort` (model-defined names and compatibility aliases)
|
||||
- [x] `think` (Ollama extension; boolean, model-defined string, or `null`)
|
||||
- [ ] `previous_response_id` (stateful v1/responses not supported)
|
||||
- [ ] `conversation` (stateful v1/responses not supported)
|
||||
- [ ] `truncation`
|
||||
|
||||
## Models
|
||||
|
||||
Before using a model, pull it locally `ollama pull`:
|
||||
For local inference, download a model before using it:
|
||||
|
||||
```shell
|
||||
ollama pull llama3.2
|
||||
```
|
||||
|
||||
### Default model names
|
||||
Direct cloud requests use the identifiers from `https://ollama.com/api/tags` and do not require a pull. Through a signed-in local server, select a cloud model such as `gemma4:cloud`.
|
||||
|
||||
### Default model names on a local server
|
||||
|
||||
For tooling that relies on default OpenAI model names such as `gpt-3.5-turbo`, use `ollama cp` to copy an existing model name to a temporary name:
|
||||
|
||||
@@ -338,7 +381,7 @@ curl http://localhost:11434/v1/chat/completions \
|
||||
}'
|
||||
```
|
||||
|
||||
### Setting the context size
|
||||
### Setting the local context size
|
||||
|
||||
The OpenAI API does not have a way of setting the context size for a model. If you need to change the context size, create a `Modelfile` which looks like:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user