go2llm API documentation

Anthropic Messages

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

curl https://go2llm.tech/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-haiku-4-5",
    "system": "Be brief.",
    "max_tokens": 120,
    "messages": [{ "role": "user", "content": "Say OK" }]
  }'

JavaScript

import Anthropic from "@anthropic-ai/sdk";

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

const response = await client.messages.create({
  model: "claude-haiku-4-5",
  max_tokens: 120,
  messages: [{ role: "user", content: "Say OK" }],
});

console.log(response.content);

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

Streaming

Pass stream: true and read the response as text/event-stream until the regular final event. The final usage block carries cost_usd. Do not retry the request automatically once you have received the first meaningful SSE chunk.

Tools

The tools and tool_choice fields are passed through to the provider unchanged. A tool description must contain name, description and a JSON Schema in input_schema.

Check modalities.input in GET /v1/models: models that list image accept images in the standard Anthropic content blocks. For text-only models, the vision_companion field names an available multimodal model, usually from the same family. Document, audio, video and unknown binary blocks are rejected with HTTP 400 unsupported_content_type before the provider is ever called.