go2llm API documentation

Chat Completions

Use POST /v1/chat/completions only for models whose GET /v1/models entry lists the chat.completions endpoint.

curl https://go2llm.tech/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "MODEL_ID_FROM_CATALOG",
    "messages": [
      { "role": "system", "content": "Be brief." },
      { "role": "user", "content": "Say OK" }
    ],
    "max_tokens": 120,
    "stream": false
  }'

JavaScript

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://go2llm.tech/v1",
});

const response = await client.chat.completions.create({
  model: process.env.GO2LLM_MODEL,
  messages: [{ role: "user", content: "Say OK" }],
});

console.log(response.choices[0].message.content);

The actual USD charge is in response.usage.cost_usd.

Python

import os
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://go2llm.tech/v1",
)

response = client.chat.completions.create(
    model=os.environ["GO2LLM_MODEL"],
    messages=[{"role": "user", "content": "Say OK"}],
)

print(response.choices[0].message.content)

Pass stream: true for SSE: the final usage block carries cost_usd. Image input is allowed only for models whose GET /v1/models entry lists image in modalities.input; for the rest, use the model named in vision_companion. Audio, video, PDF and other binary blocks return unsupported_content_type.