API reference
Headers
Send authentication and attribution headers and read cost headers.
Send Authorization: Bearer sk-pg-v1-....
The API accepts HTTP-Referer, X-OpenRouter-Title, and X-Title for app attribution.
Responses include X-Generation-Id and plaingateway only X-PG-Host, X-PG-Cost-USD, and X-PG-Request-Id.
X-PG-Host names the serving host, X-PG-Cost-USD is the cost in USD, and X-PG-Request-Id is the generation lookup ID.
Request
http
POST https://plaingateway.com/api/v1/chat/completions
Authorization: Bearer sk-pg-v1-...
Content-Type: application/json
{
"model": "openai/gpt-5.6-luna",
"messages": [
{
"role": "user",
"content": "Say hello in five words."
}
],
"max_tokens": 32
}Response
http
HTTP/1.1 200
{
"id": "gen-SCRUBBED-1",
"object": "chat.completion",
"created": 1700000000,
"model": "openai/gpt-5.6-luna",
"provider": "OpenAI",
"system_fingerprint": null,
"service_tier": "default",
"choices": [
{
"index": 0,
"logprobs": null,
"finish_reason": "stop",
"native_finish_reason": "completed",
"message": {
"role": "assistant",
"content": "Hello there, nice to meet!",
"refusal": null,
"reasoning": null
}
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 11,
"total_tokens": 23,
"cost": 1.56e-05,
"is_byok": false,
"prompt_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0,
"audio_tokens": 0,
"video_tokens": 0
},
"cost_details": {
"upstream_inference_cost": 1.56e-05,
"upstream_inference_prompt_cost": 2.4e-06,
"upstream_inference_completions_cost": 1.32e-05
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"image_tokens": 0,
"audio_tokens": 0
}
}
}