Эта страница ещё не переведена на Русский. Показан английский оригинал.

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/completions

Authentication

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.

modelstring

Model id. Omitted, the service default model is used.

modelsstring[]

Candidate chain, as on /chat/completions.

providerobject

Provider selection rules, as on /chat/completions.

streamboolean

true returns SSE.

max_tokensinteger

Maximum tokens to generate.

temperaturenumber

0.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

idstring

A generation id beginning with gen-, equal to the X-MyIP-Generation-Id header.

objectstring

Always "text_completion", including on streaming chunks.

createdinteger

Unix seconds.

modelstring

The model that actually answered.

providerstring

Display 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[].logprobsnull

Always null. Log probabilities are not supported.

usageobject

prompt_tokens, completion_tokens, total_tokens, plus the KRW cost and cost_details, exactly as on /chat/completions.

Response example

json
{
  "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

bash
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

Statuserror_typeRaised when
400invalid_requestBody is not a JSON object; prompt missing; prompt neither a string nor a string array
400model_not_foundUnknown model, or every id in models[] unknown
401invalid_api_keyKey missing, revoked, no header, or a management key
401expired_api_keyExpired key
402insufficient_creditsInsufficient balance, or a key suspended for lack of credit
402key_limit_exceededThe key's spend limit was exceeded
403key_suspendedAn administrator suspended the key
404no_endpoints_foundThe candidate chain came out empty
408timeoutThe upstream took too long
429rate_limit_exceededRequest rate limit exceeded
502provider_errorEvery candidate failed
503model_loadingA local slot could not start
500serverAnything else

Handling is covered in Errors and debugging.

Последнее обновление: 5 сент. 2026 г.