← Back
For builders

API reference.

Our API speaks the same format as OpenAI's — if you've built against that before, you already know most of this. This page covers the parts specific to us: the endpoint, what's yours to control, and how billing actually works.

THE BASICS

One endpoint, one header.

Every request is a POST to /v1/chat/completions on your Base URL, with your API key as a bearer token. Your dashboard has both ready to copy.

curl https://api.virtual.sex/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "eros",
    "messages": [
      { "role": "user", "content": "Say hello." }
    ],
    "stream": false
  }'

The response is a standard OpenAI-shape chat completion object — choices[0].message.content, a usage block with token counts, the works. Set "stream": true for server-sent-events streaming instead, same as OpenAI's own API.

WHAT'S YOURS TO CONTROL

Sampling is entirely your call.

Anything that shapes how the model samples its output is respected exactly as sent — we don't clamp or second-guess it.

messagesRequired. Standard role/content array — system, user, assistant.
streamBoolean. Defaults to non-streaming if omitted.
max_tokensDefaults to 10000 if you don't set it.
temperatureDefaults to 1.0 if you don't set it.
top_p, frequency_penalty,
presence_penalty, stop, seed
Passed straight through, untouched.
ERRORS & BILLING

Metered per token, nothing surprising.

A 401 means a missing or invalid key. A 402 means the balance is at zero — top up and retry. A 502 means something failed upstream; you're not charged for those. Every successful request is billed for the tokens actually used, prompt and completion, reflected in your dashboard balance right away.

Stopping a reply early still bills fairly. If your client cancels a streaming request partway through, you're only charged for what was actually generated up to that point — never the full reply.

QUICK ANSWERS

How big is the context window?

1M tokens. Send as much history as your use case needs — if a request ever comes in over budget, the oldest messages are trimmed automatically rather than the request failing.

Is there a rate limit?

60 requests per minute per key. That's well beyond any normal back-and-forth conversation; it's there to catch runaway loops and misbehaving clients, not real usage. If you're planning high-volume or production traffic, email us first so we can make sure it goes smoothly.

Can I use an existing OpenAI SDK/client library?

Yes — that's the point of being OpenAI-compatible. Point it at our Base URL with your API key and it should work the same way it does against OpenAI's own endpoint.

Something's not working.

Double-check the Base URL and key for stray spaces, and confirm your dashboard shows a positive balance — that covers most cases. Anything else, email contact@virtual.sex.

← Back