Skip to content

Quickstart

Store the API key and model name in environment variables:

Terminal window
export OMROUTER_API_KEY='your-api-key'
export OMROUTER_MODEL_ID='model-name-from-pricing-page'

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

Terminal window
curl --silent --show-error \
'https://omrouter.com/v1/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.