Models
Models Overview
Grafilab Models is a hosted inference API. You create one API key, point your client at one base URL, and call text, embedding, image, and video models — in either the OpenAI dialect or the Anthropic dialect, whichever your tool already speaks.
What Models is
Section titled “What Models is”Models has two faces over the same catalogue and the same credit balance:
- Playground — the browser side, at Models Playground in the console. Browse every model with its context size and prices, run a prompt, generate an image or a video, and compare answers from several models side by side. No code. See Playground.
- Inference API — the programmatic side, at
https://llm.grafilab.ai. Everything the Playground does is an HTTP call you can make yourself. See Quickstart.
Both are authenticated by the same API keys and both spend the same credits as your GPU rentals — there is no separate inference plan to sign up for. Top up on the Billing page; see Credits & Billing.
Two compatible surfaces
Section titled “Two compatible surfaces”Grafilab exposes the same models through two request formats. Pick the one your tool or SDK already targets — you do not need to translate anything.
| Your tool speaks… | Base URL | Notes |
|---|---|---|
| OpenAI (chat completions, embeddings, images, videos, SDKs) | https://llm.grafilab.ai/v1 | Clients append /chat/completions, /models, and so on. |
| Anthropic (Messages API, Claude Code, Anthropic SDK) | https://llm.grafilab.ai | Clients append /v1/messages themselves — do not add /v1. |
The OpenAI surface is the full one: chat completions, embeddings, images, videos, and the model catalogue. Use it for the OpenAI SDKs, Cursor, Cline, Open WebUI, and anything else described as “OpenAI-compatible”.
The Anthropic surface implements the Messages API, including tool use and
streaming, for the Anthropic SDKs and Claude Code. It is a subset: server-side
tools, unknown content block types, and unknown message roles are rejected with
400 rather than silently dropped, and there is no model listing on this
surface — list models on the OpenAI surface instead. See
About Integrations for the full matrix.
What you can call
Section titled “What you can call”| Endpoint | What it does |
|---|---|
POST /v1/chat/completions | Text generation. Set stream: true for server-sent events; the stream ends with data: [DONE]. Add stream_options: {"include_usage": true} to get a usage frame before the terminator. |
POST /v1/embeddings | Embedding vectors. encoding_format is float or base64 (little-endian float32). |
POST /v1/images/generations | Synchronous image generation. response_format is url or b64_json; n is 1–10. |
POST /v1/images/edits | Multipart image editing. Needs an edit-capable model, otherwise 400 edit_unsupported. Up to 10 files, 20 MB each. |
POST /v1/videos | Creates an asynchronous job and returns it as queued. GET /v1/videos lists your jobs with cursor pagination. |
GET /v1/videos/{video_id} | Polls one job: queued, in_progress, completed, or failed. |
GET /v1/videos/{video_id}/content | Redirects (302) to the finished MP4. The redirect target needs no key, and the result is kept for seven days after completion. |
GET /v1/models | The live catalogue. GET /v1/models/{model} fetches one entry; ids containing / work unencoded. |
POST /v1/messages | Anthropic Messages, including tool use and streaming. max_tokens is required. |
Full request and response schemas live in the API reference at llm.grafilab.ai/docs.
Choosing a model
Section titled “Choosing a model”The catalogue is live, so this page does not list models. Read it in one of two
places, and treat the id you see as the exact string to send:
- Playground cards show Context, Input, Cached, and Output for each text model, plus per-generation or per-second rates for image and video models. A card may carry a Coming Soon or By Invitation ribbon; invite-only models are not callable until your account is granted access.
GET /v1/modelsreturns the same ids machine-readably, plus two Grafilab extensions on each entry:regionandtags.
Model ids are matched case-insensitively and may contain /. The response
echoes the catalogue’s canonical spelling, which can differ from what you sent —
compare ids case-insensitively if you match on them.
How pricing works
Section titled “How pricing works”You are billed from your credit balance in your account currency, per call:
- Text and embeddings — per token, quoted per 1M tokens, with separate rates for input, cached input, and output. Cached input tokens are a subset of input tokens, not an extra charge on top.
- Images — per generation.
- Video — per second of output, charged when the job is created, not when it finishes.
Current rates are on the Playground cards and in the pricing table on the API
page, so they always match what you will be charged. A model that has no price
in your account currency is not served to you: it is hidden from the catalogue
and returns 404 model_not_found.
Errors you’ll meet
Section titled “Errors you’ll meet”Failures always carry a matching HTTP status — the API never dresses an error as
a 200. The one exception is a stream that fails after its first frame: it stays
200 and delivers the error in-band, so streaming clients must treat an in-band
error frame as a failure.
| Status | code | Meaning and fix |
|---|---|---|
401 | invalid_api_key | The key is wrong, rotated, or pasted with whitespace. Copy it again from API. |
403 | billing_currency_unset | Your account has no billing currency. Set your country in your profile. |
404 | model_not_found | The id is misspelled, invite-only, or not priced in your currency. |
429 | insufficient_quota | Not a rate limit — your balance is too low. Top up on Billing. |
500 | server_error | Safe to retry, unless the response carries x-should-retry: false — that marks work that was already done and billed. |
Every response carries an X-Request-Id header (req_ followed by 24 hex
characters); the Anthropic surface repeats it as request_id in the error body.
Quote it when you contact support.

