Skip to content

Authentication

Every API request requires an API key in the Authorization header using the Bearer scheme.

Generate a key from console.subq.ai, store it outside your source tree, and send it with each request:

Terminal window
curl https://api.subq.ai/v1/chat/completions \
-H "Authorization: Bearer $SUBQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "subq-preview",
"messages": [
{ "role": "user", "content": "Summarize this repository." }
]
}'

Set the key in your local shell or deployment environment:

Terminal window
export SUBQ_API_KEY="sk-your-api-key"

Then read SUBQ_API_KEY from your application configuration and pass it to your HTTP client or OpenAI SDK.

  • Store securely. Keys are shown once at creation and cannot be retrieved later.
  • Rotate regularly. Create new keys and revoke old ones from the console.
  • Never commit to source control. Use environment variables or a secrets manager.
Authenticating...