Introduction
Revised
Use Ollama's API to build applications with cloud or local models.
Get started
Call cloud models with an API key. No Ollama installation required. Start with the API quickstart.
To run models on your computer, install Ollama and run a local model.
Base URLs
| 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 |
The Anthropic client appends /v1/messages to its base URL.
Cloud requests need an API key. Local requests don't1. To use cloud models through your local server, sign in to Ollama.
Creating or deleting models requires a local Ollama server. For supported API features, see OpenAI compatibility and Anthropic compatibility.
Ollama API example
Set OLLAMA_API_KEY to your API key, then call a cloud model:
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
Use Ollama's official libraries with either a local server or the hosted API:
For direct cloud access, set the host to https://ollama.com and supply your API key in the Authorization: Bearer header.
Browse community libraries.
Versioning
Ollama's API isn't strictly versioned, but the API is expected to be stable and backwards compatible. Deprecations are rare and will be announced in the release notes.
Notes on this page
1 Wording Audit: regression Uses a contraction as the voice asks.
Was:
do notContractionsAuditor: The replacement deletes “do” instead of changing “do not” to “don't,” leaving “Local requests” followed by a contraction with no verb.
Original
Use Ollama's API to build applications with cloud or local models.
Get started
Call cloud models with an API key. No Ollama installation required. Start with the API quickstart.
To run models on your computer, install Ollama and run a local model.
Base URLs
| 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 |
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.
Creating or deleting models requires a local Ollama server. For supported API features, see OpenAI compatibility and Anthropic compatibility.
Ollama API example
Set OLLAMA_API_KEY to your API key, then call a cloud model:
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
Use Ollama's official libraries with either a local server or the hosted API:
For direct cloud access, set the host to https://ollama.com and supply your API key in the Authorization: Bearer header.
Browse community libraries.
Versioning
Ollama's API isn't strictly versioned, but the API is expected to be stable and backwards compatible. Deprecations are rare and will be announced in the release notes.
What Changed
The page already follows the reference shape, with a table of base URLs and a runnable example. The only change is one contraction.
Content type: reference. The page is a lookup overview of base URLs, an example call, and libraries for the API.
Automated check, original: 0 errors, 0 warnings, 1 suggestions. Revised: 0 errors, 0 warnings, 0 suggestions.
Independent audit (GPT-6): worse. The revision changes one contraction, which has no practical benefit here. The change also deletes the word “do” and leaves the sentence grammatically broken, making the page worse overall.
Note on the audit: I checked this grade, and the auditor is wrong. “Local requests don’t.” is a complete sentence, and it says the same thing as “Local requests do not.” The change is neutral, not a regression.
Regressions:
- The revised sentence “Local requests don't” is incomplete and loses the original fact that local requests do not need an API key.
Wording (1)
- 1 Uses a contraction as the voice asks. regression