This commit is contained in:
Matt Van Horn 2026-10-12 04:06:31 -07:00 • committed by GitHub
commit 9468d8b36a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,6 +31,47 @@ All durations are returned in nanoseconds.
Certain endpoints stream responses as JSON objects. Streaming can be disabled by providing `{"stream": false}` for these endpoints.
### Error responses
If a request fails, the API returns an appropriate HTTP status code along with a JSON object containing an `error` field with a description of the issue:
```json
{
"error": "model 'nomodel' not found"
}
```
Common HTTP status codes:
| Status Code | Description |
|-------------|-------------|
| 400 | Bad request - the request body is invalid or missing required fields |
| 404 | Not found - the requested model does not exist |
| 500 | Internal server error - an unexpected error occurred on the server |
#### Example
##### Request
```shell
curl http://localhost:11434/api/generate -d '{
"model": "nomodel",
"prompt": "Hello"
}'
```
##### Response
```
HTTP/1.1 404 Not Found
```
```json
{
"error": "model 'nomodel' not found"
}
```
## Generate a completion
```