|
| 1 | +--- |
| 2 | +title: Token |
| 3 | +description: Setting up token |
| 4 | +slug: "token" |
| 5 | +--- |
| 6 | + |
| 7 | +import Tabs from "@theme/Tabs"; |
| 8 | +import TabItem from "@theme/TabItem"; |
| 9 | + |
| 10 | +:::warning |
| 11 | +🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase. |
| 12 | +::: |
| 13 | + |
| 14 | +# Token Configuration Guide |
| 15 | + |
| 16 | +This document describes how to configure HuggingFace token settings for Cortex. |
| 17 | + |
| 18 | +## Command Line Interface (CLI) |
| 19 | + |
| 20 | +### Basic Usage |
| 21 | + |
| 22 | +```bash |
| 23 | +cortex config [OPTIONS] [COMMAND] |
| 24 | +``` |
| 25 | + |
| 26 | +### Commands |
| 27 | + |
| 28 | +- `status`: Display all current configurations |
| 29 | + |
| 30 | +```bash |
| 31 | +cortex config status |
| 32 | +``` |
| 33 | + |
| 34 | +Example Output: |
| 35 | + |
| 36 | +```bash |
| 37 | ++-----------------------+------------------------+ |
| 38 | +| Config name | Value | |
| 39 | ++-----------------------+------------------------+ |
| 40 | +| huggingface_token | | |
| 41 | ++-----------------------+------------------------+ |
| 42 | +``` |
| 43 | + |
| 44 | +### Options |
| 45 | + |
| 46 | +| Option | Description | Example | |
| 47 | +| ----------------------------------- | --------------------------- | ------------------------------------------------- | |
| 48 | +| `-h, --help` | Print help message and exit | |
| 49 | +| `--huggingface_token <token>` | Set HuggingFace token | `cortex config --huggingface_token token` | |
| 50 | + |
| 51 | +## Token API Configuration |
| 52 | + |
| 53 | +### Endpoints |
| 54 | + |
| 55 | +#### Get Current Configuration |
| 56 | + |
| 57 | +```http |
| 58 | +GET /v1/configs |
| 59 | +``` |
| 60 | + |
| 61 | +Retrieves the current configuration settings. |
| 62 | + |
| 63 | +##### Response |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "allowed_origins": [ |
| 68 | + "http://localhost:39281", |
| 69 | + "http://127.0.0.1:39281", |
| 70 | + "http://0.0.0.0:39281" |
| 71 | + ], |
| 72 | + "cors": true, |
| 73 | + "huggingface_token": "" |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +#### Update Configuration |
| 78 | + |
| 79 | +```http |
| 80 | +PATCH /v1/configs |
| 81 | +``` |
| 82 | + |
| 83 | +Updates HuggingFace token configuration settings. |
| 84 | + |
| 85 | +##### Request Headers |
| 86 | + |
| 87 | +``` |
| 88 | +Content-Type: application/json |
| 89 | +``` |
| 90 | + |
| 91 | +##### Request Body |
| 92 | + |
| 93 | +```json |
| 94 | +{ |
| 95 | + "huggingface_token": "token" |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +##### Parameters |
| 100 | + |
| 101 | +| Field | Type | Description | |
| 102 | +| ----------------------- | ------- | ------------------------------------------| |
| 103 | +| `huggingface_token` | string | HuggingFace token to pull models | |
| 104 | + |
| 105 | +##### Response |
| 106 | + |
| 107 | +```json |
| 108 | +{ |
| 109 | + "config": { |
| 110 | + "allowed_origins": [ |
| 111 | + "http://localhost:39281", |
| 112 | + "http://127.0.0.1:39281", |
| 113 | + "http://0.0.0.0:39281" |
| 114 | + ], |
| 115 | + "cors": true, |
| 116 | + "huggingface_token": "token" |
| 117 | + }, |
| 118 | + "message": "Configuration updated successfully" |
| 119 | +} |
| 120 | +``` |
0 commit comments