Skip to content

Moderations and Legacy Completions ​

These two interfaces are primarily for compatibility with existing applications. For new projects that only need chat, prioritize using /v1/chat/completions.

Content Moderation - Moderations ​

Moderations are used to determine if input text triggers safety categories. Actual categories, thresholds, and return fields depend on the selected model or channel.

ConfigurationValue
Endpointhttps://api.corerouter.cloud/v1/moderations
HeaderAuthorization: Bearer sk-...
Required Fieldinput
Optional Fieldmodel

If model is not passed, the system may use a default moderation model. Production environments should explicitly fill in moderation model IDs from the console.

bash
export COREROUTER_API_KEY="sk-xxxxxxxxxxxxxxxx"

curl https://api.corerouter.cloud/v1/moderations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "model": "moderation-model-id",
    "input": "User input that needs to be moderated goes here."
  }'

Common uses:

  • Pre-publication review of user content.
  • Pre-check of conversation input.
  • Secondary review of model output.
  • Different blocking strategies for different business scenarios.

Legacy Completions ​

/v1/completions is the legacy text completion interface. Request field is typically prompt, not Chat Completions' messages.

ConfigurationValue
Endpointhttps://api.corerouter.cloud/v1/completions
HeaderAuthorization: Bearer sk-...
Required Fieldsmodel, prompt
RecommendationOnly for legacy application compatibility
bash
curl https://api.corerouter.cloud/v1/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "model": "completion-model-id",
    "prompt": "Complete this sentence: CoreRouter can help developers",
    "max_tokens": 128
  }'

Difference Between Chat Completions and Completions ​

InterfaceInput FieldSuitable Scenarios
/v1/chat/completionsmessagesNew applications, chat, multi-turn conversation, tool calling, vision understanding
/v1/completionspromptLegacy application compatibility, simple text continuation

Don't pass messages to /v1/completions, and don't use prompt as the main input for /v1/chat/completions.

Common Issues ​

  • field input is required: Moderations missing input.
  • field prompt is required: Completions missing prompt.
  • Moderation model unavailable: Check if console provides moderation models, or explicitly switch to an available model.
  • Legacy SDK error: Confirm it's calling /v1/completions; Base URL should be https://api.corerouter.cloud/v1.

Released under the MIT License.