API Reference

Create Completion

Creates a text completion for the provided prompt. Compatible with the OpenAI Completions API.

POST
/v1/completions

Authorization

ApiKeyAuth
AuthorizationBearer <token>

Your Yolo Router API key. Format: Bearer sk-...

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.yolorouter.com/v1/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-3.5-turbo-instruct",    "prompt": "Say hello in French."  }'
{
  "id": "string",
  "object": "text_completion",
  "created": 0,
  "model": "string",
  "choices": [
    {
      "index": 0,
      "text": "string",
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "message": "Invalid API key"
  }
}
{
  "error": {
    "type": "insufficient_quota",
    "code": "insufficient_quota",
    "message": "Quota exceeded"
  }
}