यह पृष्ठ अभी तक हिन्दी में अनूदित नहीं है। अंग्रेज़ी मूल दिखाया जा रहा है।
POST /completions
Legacy text completions
The older interface: one prompt string instead of a message array, in OpenAI's legacy completions shape.
POST https://openrouter.myip.co.kr/api/v1/completionsAuthentication
Requires an inference key (sk-mo-v1-). A management key here is 401 invalid_api_key.
Request parameters
promptstring | string[]आवश्यकThe prompt. A string array is joined with \n into a single user message. Anything that is neither a string nor a string array is 400 invalid_request.
modelstringModel id. Omitted, the service default model is used.
modelsstring[]Candidate chain, as on /chat/completions.
providerobjectProvider selection rules, as on /chat/completions.
streambooleantrue returns SSE.
max_tokensintegerMaximum tokens to generate.
temperaturenumber0.0–2.0.
stopstring | string[]Strings that stop generation.
The sampling parameters listed in Request parameters all apply. A messages field sent here is ignored; only prompt is read.
Request example
curl https://openrouter.myip.co.kr/api/v1/completions \
-H "Authorization: Bearer $MYIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lgai/exaone-4.0-32b",
"prompt": "Translate into English: 오늘 서울은 맑고 바람이 분다.",
"max_tokens": 64,
"temperature": 0.2
}'Response
idstringA generation id beginning with gen-, equal to the X-MyIP-Generation-Id header.
objectstringAlways "text_completion", including on streaming chunks.
createdintegerUnix seconds.
modelstringThe model that actually answered.
providerstringDisplay name of the provider that actually answered.
choicesobject[]Each entry has index, text, finish_reason and logprobs. There is no message field — this is the chat response converted back to text form. When the upstream supplies native_finish_reason, that field comes along too.
choices[].logprobsnullAlways null. Log probabilities are not supported.
usageobjectprompt_tokens, completion_tokens, total_tokens, plus the KRW cost and cost_details, exactly as on /chat/completions.
Response example
{
"id": "gen-4mVpQz8LrXtB6nKwYsHdE2cJf9",
"object": "text_completion",
"created": 1788452411,
"model": "lgai/exaone-4.0-32b",
"provider": "MyIP Local GPU",
"choices": [
{
"index": 0,
"text": " Seoul is clear and windy today.",
"finish_reason": "stop",
"logprobs": null,
"native_finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 9,
"total_tokens": 40,
"cost": 0.002280,
"cost_details": { "upstream_inference_cost": 0.000437 }
}
}Response headers are the same as on /chat/completions: a non-streaming call carries X-MyIP-Cost-KRW and X-MyIP-Credit-Balance.
Streaming
curl -N https://openrouter.myip.co.kr/api/v1/completions \
-H "Authorization: Bearer $MYIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lgai/exaone-4.0-32b",
"prompt": "Count from one to three.",
"stream": true,
"max_tokens": 24
}'data: {"id":"gen-4mV…","object":"text_completion","created":1788452411,"model":"lgai/exaone-4.0-32b","provider":"MyIP Local GPU","choices":[{"index":0,"text":"One","finish_reason":null,"logprobs":null}]}
data: {"id":"gen-4mV…","object":"text_completion","created":1788452411,"model":"lgai/exaone-4.0-32b","provider":"MyIP Local GPU","choices":[{"index":0,"text":", two","finish_reason":null,"logprobs":null}]}
data: {"id":"gen-4mV…","object":"text_completion","created":1788452412,"model":"lgai/exaone-4.0-32b","provider":"MyIP Local GPU","choices":[],"usage":{"prompt_tokens":14,"completion_tokens":8,"total_tokens":22,"cost":0.001620,"cost_details":{"upstream_inference_cost":0.000312}}}
data: [DONE]The only difference from Streaming is that deltas arrive in choices[].text rather than delta.content; the usage chunk and the [DONE] terminator are identical.
How it appears in usage records
Requests made here are visible through GET /generation as well. The api_type field records "chat", the same as /chat/completions, because both use the same pipeline internally.
Errors
| Status | error_type | Raised when |
|---|---|---|
| 400 | invalid_request | Body is not a JSON object; prompt missing; prompt neither a string nor a string array |
| 400 | model_not_found | Unknown model, or every id in models[] unknown |
| 401 | invalid_api_key | Key missing, revoked, no header, or a management key |
| 401 | expired_api_key | Expired key |
| 402 | insufficient_credits | Insufficient balance, or a key suspended for lack of credit |
| 402 | key_limit_exceeded | The key's spend limit was exceeded |
| 403 | key_suspended | An administrator suspended the key |
| 404 | no_endpoints_found | The candidate chain came out empty |
| 408 | timeout | The upstream took too long |
| 429 | rate_limit_exceeded | Request rate limit exceeded |
| 502 | provider_error | Every candidate failed |
| 503 | model_loading | A local slot could not start |
| 500 | server | Anything else |
Handling is covered in Errors and debugging.
अंतिम अद्यतन 5 सित॰ 2026