Aller au contenu principal

POST /api/zeq/llm/credentials

Create a new BYOK credential. The full key is echoed exactly once in the response — copy it now or recreate. After that, only the prefix is ever returned.

Auth

Authorization: Bearer zeq_ak_…. Paid-tier only.

Request

curl -X POST https://YOUR-FRAMEWORK/api/zeq/llm/credentials \
-H "Authorization: Bearer zeq_ak_..." \
-H "Content-Type: application/json" \
-d '{
"provider": "openai",
"label": "prod-key-2026-q2",
"api_key": "sk-proj-AbCd...",
"default_model": "gpt-4o",
"base_url": null
}'

Body

FieldTypeRequiredNotes
providerenumyesOne of openai, anthropic, deepseek, ollama, openrouter, together, groq, fireworks.
labelstring (1–64)yesHuman label for the dashboard.
api_keystring (8–512)yesThe provider key. Trimmed and stripped of trailing punctuation server-side.
default_modelstring (1–128)noOverride the provider default.
base_urlurlnoRequired for ollama. Optional for OpenAI-compat providers. Must start with http:// or https://.

Response · 201 Created

{
"id": "5b7a9c12-3f1d-...",
"provider": "openai",
"provider_name": "OpenAI",
"label": "prod-key-2026-q2",
"api_key_prefix": "sk-p…AbCd",
"base_url": null,
"default_model": "gpt-4o",
"active": true,
"created_at": "2026-05-10T13:08:32Z",
"api_key_one_time_echo": "sk-proj-AbCd..."
}

api_key_one_time_echo is the only place you'll ever see the full key. Subsequent reads return api_key_prefix only.

Errors

StatusCodeCause
400provider must be one of: ...Bad provider ID.
400api_key requiredMissing or empty.
400api_key invalid length: N chars (need 8..512)Out of range.
400label required (1..64 chars)Missing or out of range.
400base_url required for provider <id>Ollama without base_url.
400base_url must start with http:// or https://Bad URL.
402SUBSCRIPTION_REQUIREDFree-tier caller.
409label_takenSame label exists for this user.