MuseSpark
MuseSpark
LLM integration

LLM authentication

Configure API-key access for all three compatibility protocols.

Enable the llm_compat product on your API key.

OperationScope
Invoke a protocol operationllm:invoke
List or inspect a model with GET or HEADllm:model:list

The current invoke scope also permits model reads. Product and model access checks still apply.

Credential headers

Use Authorization: Bearer YOUR_API_KEY or X-API-Key: YOUR_API_KEY. When both are supplied, a nonempty trimmed X-API-Key wins. Use the exact Bearer prefix for compatibility routes.

Anthropic SDKs normally use x-api-key, which HTTP treats as the same header as X-API-Key. Gemini's x-goog-api-key and key= query parameter do not authenticate the public MuseSpark gateway. Configure a supported MuseSpark credential header explicitly.

Errors

HTTP 401 means authentication failed. HTTP 403 can indicate missing product access, a missing scope, or a model restriction. HTTP 402 indicates an account admission or balance issue.

Gateway rejections may use {"code":403,"msg":"..."}. Protocol execution errors can use the native protocol error object, so check both HTTP status and response body.

Keep credentials in server-side environment variables.