LOT 1 - Optimizare script build -Instalare mono comanda
This commit is contained in:
parent
5380c3fc63
commit
42ff22bf85
127 changed files with 16163 additions and 532 deletions
|
|
@ -36,6 +36,7 @@ Authorization: Bearer <your-token>
|
|||
|
||||
**Protected endpoints (require auth when enabled):**
|
||||
- `POST /v1/chat/completions`
|
||||
- `POST /v1/completions`
|
||||
- `GET /v1/models`
|
||||
- `POST /v1/models/load`
|
||||
- `POST /v1/models/unload`
|
||||
|
|
@ -59,6 +60,8 @@ Backend services require their own API keys:
|
|||
- **LiteLLM**: `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, or `ANTHROPIC_API_KEY`
|
||||
- **vLLM**: Optional `LLM_VLLM_API_KEY` for vLLM server
|
||||
|
||||
> **Reasoning model note (`LLM_VLLM_DISABLE_THINKING`, default `true`):** the local model `Qwen/Qwen3.5-35B-A3B` (served as `qwen3.5`) is a reasoning model. By default the gateway injects `chat_template_kwargs={"enable_thinking": false}` on vLLM chat requests so the model returns the final answer directly instead of a `thinking` preamble — important for callers that parse JSON. Callers may override by passing their own `chat_template_kwargs` in the request body.
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
The API uses token bucket rate limiting:
|
||||
|
|
@ -193,6 +196,66 @@ curl -X POST http://localhost:14011/v1/chat/completions \
|
|||
|
||||
---
|
||||
|
||||
### Text Completions (legacy)
|
||||
|
||||
Create a non-streaming text completion from a raw prompt. OpenAI-compatible legacy `/v1/completions`. Routes to the model's backend (vLLM primary, cloud via LiteLLM). Backends that do not support text completion return `501`.
|
||||
|
||||
```
|
||||
POST /v1/completions
|
||||
```
|
||||
|
||||
#### Request Body
|
||||
|
||||
| Field | Type | Required | Default | Description |
|
||||
|-------|------|----------|---------|-------------|
|
||||
| `prompt` | string/array | Yes | - | Prompt(s) to complete |
|
||||
| `model` | string | No | server default | Model (alias) to use |
|
||||
| `temperature` | float | No | 0.7 | Sampling temperature (0.0-2.0) |
|
||||
| `max_tokens` | integer | No | null | Maximum tokens to generate (1-1,000,000) |
|
||||
| `backend` | string | No | null | Backend override: `litellm`, `vllm`, `llamacpp` |
|
||||
| `top_p` | float | No | null | Top-p sampling (0.0-1.0) |
|
||||
| `frequency_penalty` | float | No | null | Frequency penalty (-2.0 to 2.0) |
|
||||
| `presence_penalty` | float | No | null | Presence penalty (-2.0 to 2.0) |
|
||||
| `stop` | string/array | No | null | Stop sequences |
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "cmpl-abc123",
|
||||
"object": "text_completion",
|
||||
"created": 1704067200,
|
||||
"model": "qwen3.5",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"text": "Paris is the capital of France.",
|
||||
"finish_reason": "stop"
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"prompt_tokens": 8,
|
||||
"completion_tokens": 7,
|
||||
"total_tokens": 15
|
||||
},
|
||||
"backend": "vllm"
|
||||
}
|
||||
```
|
||||
|
||||
#### Example Request
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:14011/v1/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"prompt": "The capital of France is",
|
||||
"model": "qwen3.5",
|
||||
"max_tokens": 16
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### List Models
|
||||
|
||||
List available models across all or specific backends.
|
||||
|
|
@ -433,6 +496,22 @@ curl http://localhost:14011/ready
|
|||
|
||||
---
|
||||
|
||||
### Service Info (catalog)
|
||||
|
||||
Service metadata for cross-module catalog integration. Returns `resource`, `models` (from all enabled backends), and `functions` (API endpoint descriptors). Consumed by the catalog-api.
|
||||
|
||||
```
|
||||
GET /v1/info
|
||||
```
|
||||
|
||||
#### Example Request
|
||||
|
||||
```bash
|
||||
curl http://localhost:14011/v1/info
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Error Responses
|
||||
|
||||
All errors follow a consistent format:
|
||||
|
|
@ -507,9 +586,9 @@ Response includes `Retry-After` header with seconds to wait.
|
|||
|
||||
## Supported Backends
|
||||
|
||||
### LiteLLM (Default)
|
||||
### LiteLLM (cloud)
|
||||
|
||||
Supports 100+ LLM providers through a unified interface.
|
||||
Supports 100+ LLM providers through a unified interface. (`LLM_DEFAULT_BACKEND` is required and has no default; the DIDI deployment runs `vllm` with the local `qwen3.5` model and uses LiteLLM for cloud/premium models.)
|
||||
|
||||
**Popular models:**
|
||||
- `gpt-3.5-turbo`, `gpt-4`, `gpt-4-turbo` (OpenAI)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue