STATIC

API Reference

Binom.Router provides an API that is fully compatible with the OpenAI Chat Completions API. This allows you to use existing libraries and tools without needing to make any code changes.

Base URL

All API requests should be sent to: https://api.binom-router.com/v1

Authentication

Authentication is performed using a Bearer token in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Chat Completions

Creates a model response for the given conversation.

Endpoint: POST /chat/completions

Request Parameters

Field Type Description
model string Required. The ID of the model to use (e.g., gpt-4o, gemini-1.5-pro).
messages array Required. A list of messages comprising the conversation.
stream boolean Optional (defaults to false). If true, the response will be streamed as Server-Sent Events.
temperature number Optional. The sampling temperature (between 0 and 2).
max_tokens integer Optional. The maximum number of tokens to generate.

Message Structure (messages)

Each message in the array must have the following fields:

  • role: The role of the sender (system, user, assistant).
  • content: The text of the message.

Example Request

{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Tell a joke about programmers."}
  ],
  "stream": false
}

Response Structure (non-streaming)

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-4o",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Why do programmers confuse Halloween and Christmas? Because Oct 31 == Dec 25."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 20,
    "total_tokens": 35
  }
}

Error Handling

Binom.Router uses standard HTTP response codes:

  • 200 OK: The request was successful.
  • 401 Unauthorized: Invalid or missing API key.
  • 402 Payment Required: Insufficient funds in the balance.
  • 429 Too Many Requests: The rate limit has been exceeded.
  • 500 Internal Server Error: An internal server error occurred.
  • 503 Service Unavailable: No available workers to handle the request.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.