Open-Weight-Modelle per API nutzen: Was zu pruefen ist und wie der Aufruf klappt
Open-Weight-Modelle reichen inzwischen fuer viele Alltagsaufgaben wie Coding Agents, Tool-Nutzung und Zusammenfassungen. Die eigentliche Herausforderung liegt weniger im Modell als im Betrieb; der Artikel zeigt Wege zum Aufruf ueber das OpenAI- oder Anthropic SDK.

Open-weight models — models whose trained weights are published for anyone to download — are now good enough for a lot of everyday work: coding agents, tool use, extraction, summarising. The hard part is no longer the model. It is running it. This post covers the three ways to use an open-weight model, what to check before you pick a hosted API, and the few lines of code it takes to call one from the SDKs you already use.
"Open-weight" means the weights are public. It does not automatically mean the training data, the training code or a permissive licence are public too. Licences range from MIT and Apache 2.0 to custom licences with usage limits, so read the model card before you build a product on one. For calling a model through an API, what matters is that anyone can serve it — which is why the same open-weight model is often available from several providers at different prices and speeds.
The example below uses Tokener CA, a pay-as-you-go API for a short, curated list of open-weight models (I work on it — see the note at the end). The same pattern works with any provider that speaks these protocols. Keep the key and the model id in environment variables; model ids are listed on the models page.
export TOKENER_API_KEY = "your-api-key" export TOKENER_MODEL = "a-model-id-from-the-models-page" Enter fullscreen mode Exit fullscreen mode OpenAI SDK (Chat Completions) import os from openai import OpenAI client = OpenAI ( api_key = os. environ [ " TOKENER_API_KEY " ], base_url = " https://a.tokener.ca/v1 ", ) resp = client. chat. completions. create ( model = os. environ [ " TOKENER_MODEL " ], messages = [{ " role ": " user ", " content ": " Explain open-weight models in one sentence. " }], ) print ( resp. choices [ 0 ]. message. content ) print ( resp. usage ) # input, output and cached tokens: what you are billed for Enter fullscreen mode Exit fullscreen mode Streaming ( stream=True ), function tools and JSON output carry over unchanged. For usage on a streamed response, pass stream_options={"include_usage": True}.
import os import anthropic client = anthropic. Anthropic ( api_key = os. environ [ " TOKENER_API_KEY " ], base_url = " https://a.tokener.ca ", # no /v1: the SDK adds it ) message = client. messages. create ( model = os. environ [ " TOKENER_MODEL " ], max_tokens = 256, # required by the Messages protocol messages = [{ " role ": " user ", " content ": " Explain open-weight models in one sentence. " }], ) print ( message. content [ 0 ]. text ) Enter fullscreen mode Exit fullscreen mode curl curl https://a.tokener.ca/v1/chat/completions \ -H "Authorization: Bearer $TOKENER_API_KEY " \ -H "Content-Type: application/json" \ -d "{ \" model \": \" $TOKENER_MODEL \", \" messages \": [{ \" role \": \" user \", \" content \": \" Hello \" }]}" Enter fullscreen mode Exit fullscreen mode Using it from tools instead of code Most AI tools have an "OpenAI-compatible provider" or "custom base URL" setting, and the same three values (base URL, key, model id) are all they need.
Step-by-step guides: Claude Code (through the Anthropic-compatible endpoint), OpenCode, Cline, LiteLLM, Vercel AI SDK.
Do not move everything at once. Pick one well-understood task — a first-pass code review, ticket summaries, field extraction — and send it to an open-weight model for a week. Compare the outputs and the bill. If you do not want to write code first, a browser playground lets you try each model and see what a request costs ( quickstart without code ).
Disclosure: I work on Tokener CA, the API used in the examples. It is operated by ShowKey Information Systems Inc., a company incorporated in Ontario, Canada. Each model's price, context window, precision and measured performance are on its page at tokener.ca/models; the full API reference is at tokener.ca/docs/api-reference.
Expand DEV SUPPORTS DEV SUPPORTS DEV SUPPORTS Follow Joined Oct 9, 2026 • Oct 12 Dropdown menu Copy link Hide You need to verify your account. Enter fullscreen mode Exit fullscreen mode tr.ee/dev-to