Variant Group · Test assignment

Generation API

One endpoint: send a prompt, get the letter back as a stream. The model key stays on our side — you authenticate with a personal token.

POSThttps://test-assignment-api.variant.net/v1/generate

Authentication

Your token comes with the assignment. Requests without one, or with a token we do not recognise, get 401.

Authorization: Bearer <your token>
Content-Type: application/json

Request

{
  "system": "instructions for the model",
  "prompt": "what to write",
  "maxTokens": 1500
}

Only prompt is required. system and maxTokens are optional.

Response

The response arrives as a stream of Server-Sent Events, Content-Type: text/event-stream. Each chunk contains one event.

← 200 OK  ·  text/event-stream

event: delta
data: {"text":"Dear "}
event: delta
data: {"text":"Notion "}
event: delta
data: {"text":"team,"}
← connection closed

Join the fragments in the order they arrive. The stream closes after the last delta event — there is no separate completion event.

Errors

On failure the service returns a 4xx or 5xx status code and a body of this shape:

{ "error": { "code": "...", "message": "..." } }
invalid_token
Token missing or not recognised
invalid_request
Malformed body or empty prompt
rate_limit_exceeded
Too many requests. The Retry-After header says how many seconds to wait
upstream_error
The model provider is unavailable

Limits

  • 6 requests per minute per token
  • 1,500 tokens per response
  • 24,000 characters per request

This specification was written a while ago and may have drifted from how the service actually behaves. If you find discrepancies, describe them in your README.