Skip to content

Quickstart

Store the API route, API key, and model name in environment variables:

Terminal window
export OMROUTER_BASE_URL='https://api.omrouter.com/v1'
export OMROUTER_API_KEY='your-api-key'
export OMROUTER_MODEL_ID='model-name-from-pricing-page'

This guide uses the default Cloudflare route. To use EdgeOne instead, set OMROUTER_BASE_URL to https://eo.omrouter.com/v1. See API routes for the selection guidance.

Do not commit the real API key to Git or paste it into an agent prompt.

Terminal window
curl --silent --show-error \
"$OMROUTER_BASE_URL/chat/completions" \
--header "Authorization: Bearer $OMROUTER_API_KEY" \
--header 'Content-Type: application/json' \
--data "{
\"model\": \"$OMROUTER_MODEL_ID\",
\"messages\": [
{\"role\": \"user\", \"content\": \"Reply with one short sentence.\"}
]
}"

After a successful request, the model reply is usually in choices[0].message.content:

{
"choices": [
{
"message": {
"role": "assistant",
"content": "..."
}
}
]
}

Next, read OpenAI SDKs or Configure existing applications and tools.