API Reference
Auto-generated
User
API reference for user endpoints.
Auto-generated
This page was generated from the OpenAPI spec. Run
make generate-docs to refresh after spec changes.POST /api/v1/user/llm-keys
POST
/api/v1/user/llm-keysRegister a BYOK LLM API key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| provider | "openai" | "anthropic" | "openrouter" | "groq" | Required | LLM provider for this key. |
| raw_key | string | Required | The plaintext LLM API key. Encrypted at rest immediately on receipt. Never stored or returned in plaintext. |
| key_alias | string | Optional | key_alias |
| model_override | string | Optional | model_override |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/user/llm-keys \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "...",
"raw_key": "example_raw_key"
}'Response Example
JSON
{
"status": "ok"
}GET /api/v1/user/llm-keys
GET
/api/v1/user/llm-keysList BYOK LLM API keys
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/user/llm-keys \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}POST /api/v1/user/llm-keys/openrouter/exchange
POST
/api/v1/user/llm-keys/openrouter/exchangeExchange OpenRouter OAuth PKCE code for an API key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| code | string | Required | The authorization code received from the OpenRouter OAuth callback. |
| code_verifier | string | Required | The PKCE code verifier that was used to generate the code challenge. |
| state | string | Optional | state |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/user/llm-keys/openrouter/exchange \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "example_code",
"code_verifier": "example_code_verifier"
}'Response Example
JSON
{
"status": "ok"
}DELETE /api/v1/user/llm-keys/{key_id}
DELETE
/api/v1/user/llm-keys/{key_id}Delete a BYOK LLM API key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key_id | string | Required | key_id |
Request Example
Bash
curl -X DELETE https://api.alterlab.io/api/v1/user/llm-keys/<key_id> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}PUT /api/v1/user/llm-keys/{key_id}
PUT
/api/v1/user/llm-keys/{key_id}Update a BYOK LLM API key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key_id | string | Required | key_id |
| raw_key | string | Optional | raw_key |
| key_alias | string | Optional | key_alias |
| model_override | string | Optional | model_override |
Request Example
Bash
curl -X PUT https://api.alterlab.io/api/v1/user/llm-keys/<key_id> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"id": "example",
"provider": "example",
"key_alias": "example",
"key_hint": "example",
"model_override": "example",
"is_oauth": true
}GET /api/v1/user/llm-keys/{key_id}/models
GET
/api/v1/user/llm-keys/{key_id}/modelsList available models for a BYOK LLM key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key_id | string | Required | key_id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/user/llm-keys/<key_id>/models \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}POST /api/v1/user/llm-keys/{key_id}/validate
POST
/api/v1/user/llm-keys/{key_id}/validateValidate a BYOK LLM API key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key_id | string | Required | key_id |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/user/llm-keys/<key_id>/validate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"id": "example",
"provider": "example",
"key_alias": "example",
"key_hint": "example",
"model_override": "example",
"is_oauth": true
}