쿠키를 사용합니다. 쿠키와 브라우저 저장소는 로그인 상태를 유지하고 환경설정을 기억합니다. 동의하시면 사이트 이용 방식도 측정합니다. 언제든지 할 수 있습니다. 자세한 내용은 쿠키 정책을 참고하세요.

Completions

엔드포인트

Completions

채팅 템플릿 없이 prompt 문자열만 받는 레거시 POST /completions의 model, prompt, max_tokens, logprobs, stream 파라미터와 text_completion 응답, 오류 코드를 정리합니다.

플레이그라운드에서 사용해 보기

레거시 completions 엔드포인트는 원시 prompt 문자열을 받아 생성된 텍스트를 반환하며, 채팅 템플릿을 적용하지 않습니다. 베이스 모델, fill-in-the-middle, 기존 연동에 유용합니다. 새 코드에는 Chat completions를 사용하세요.

POST https://api14.com/api/v1/completions
Authorization: Bearer sk-api14-...
Content-Type: application/json

요청

파라미터타입설명
modelstring, 필수모델 id. 예: meta-llama/llama-3.1-8b-instruct.
promptstring, 필수이어서 생성할 텍스트.
max_tokensinteger생성할 토큰 수의 상한.
temperature, top_p, top_knumber샘플링 제어.
stopstring | string[]중단 시퀀스.
seedinteger가능한 범위에서 결정적인 샘플링.
logprobsinteger모델이 지원하면 상위 토큰의 로그 확률을 반환.
streambooleanSSE로 텍스트 청크를 스트리밍.
provider, models, transformsChat completions와 동일한 게이트웨이 확장.
curl https://api14.com/api/v1/completions \
  -H "Authorization: Bearer $API14_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-3.5-turbo-instruct",
    "prompt": "The three primary colors are",
    "max_tokens": 20
  }'
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const result = await client.chat.completions.create({
  "model": "openai/gpt-5-mini",
  "messages": [
    {
      "role": "user",
      "content": "Explain vector databases in two sentences."
    }
  ]
});
console.log(result.choices[0].message.content);

응답

{
  "id": "gen-1760000000-xyz789",
  "object": "text_completion",
  "created": 1760000000,
  "model": "openai/gpt-3.5-turbo-instruct",
  "choices": [
    { "index": 0, "text": " red, yellow and blue.", "finish_reason": "stop" }
  ],
  "usage": {
    "prompt_tokens": 6,
    "completion_tokens": 7,
    "total_tokens": 13,
    "cost": 0.0000195
  }
}

오류

400 model_required, 400 invalid_json, 401 invalid_api_key, 402 insufficient_balance, 403 model_not_allowed / plan_required, 404 model_not_found, 413 payload_too_large, 429 rate_limited, 502 upstream_unavailable. 제공자가 반환한 오류는 원래 상태 코드 그대로 전달됩니다. 오류를 참고하세요.