HTTP API

On this page

gb10_inference --server serves an OpenAI-compatible API. Existing OpenAI clients work by changing the base URL to http://<machine>:<port>/v1.

Endpoints

Endpoint Purpose
POST /v1/chat/completions Chat, streaming or not, with tool calling and image input.
POST /v1/completions The legacy text completion endpoint.
GET /v1/models, GET /v1/models/:id The served model name and its context length (max_model_len).
POST /v1/tokenize, POST /v1/detokenize The model's tokenizer, for counting and building exact prompts.
GET /health Readiness.
GET /metrics Counters and gauges in Prometheus text format.

Chat completions

The request is the OpenAI chat format. The engine honours, among others:

  • stream: server-sent events. With stream_options.include_usage the final chunk carries token usage.
  • tools and tool_choice: tool calling, with arguments coerced to the declared schema.
  • reasoning_effort: none, low, medium, high, xhigh or max.
  • temperature, top_p, top_k, presence_penalty, seed. A negative top_k means no top-k cut. A request that sends no sampler fields gets the defaults in the model pack.
  • response_format: accepted and served. When the reply could not be held to the schema, the response says so in the header x-json-schema-enforced: none.
  • Image parts in messages (PNG, JPEG, WebP, GIF) on models with a vision tower. Video and audio parts are answered with 400.

Usage in the response includes prompt_tokens_details.cached_tokens: how much of the prompt was reused from the prefix cache.

Tokenize and detokenize

Both are tokenizer calls only; they do no model work.

curl -s http://localhost:9000/v1/tokenize \
  -H 'Content-Type: application/json' \
  -d '{"model": "<name>", "prompt": "Hello"}'

/v1/tokenize also accepts a messages array and renders it exactly as the chat endpoint does, so its count equals the usage.prompt_tokens of the same conversation. A prompt longer than the context returns 400 with code context_length_exceeded.

Metrics and telemetry

GET /metrics is on by default. It covers request and token counts, speculation (rounds, accepted tokens), the prefix cache, KV memory in use and queueing. Operating a deployment lists the gauges.

For per-request traces, --otel-endpoint <URL> streams generation telemetry over OTLP/HTTP. It is off by default.

Access control

Authentication is not part of the engine's documented surface. Bind the server to a trusted interface with --host, or place it behind a gateway that authenticates for you.

The full list

Every flag that changes what the API does is in the command-line reference.