Docs · OpenAI SDK

One argument changes

FreeModel is an AI model gateway: one key for 477 models across dozens of providers, routed by task with free capacity tried first. If you already call the OpenAI API from code, you already know every line below. The only difference is where the client points.

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://freemodel.online/v1",
    api_key="sk-your-key",
)

r = client.chat.completions.create(
    model="auto/best-chat",
    messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)

Node

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://freemodel.online/v1",
  apiKey: "sk-your-key",
});

const r = await client.chat.completions.create({
  model: "auto/best-chat",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);

Note the spelling difference: the Python SDK takes base_url, the Node one takes baseURL. Both stop at /v1.

What still works

Because the shape is unchanged, everything you normally use keeps working:

What changes is which model answers. If you name one, you get it. If you name a route, the router picks per request and a provider failure moves the call on rather than raising.

Models worth using from code

RouteWhen
auto/best-codingCode generation, patches, refactors
auto/best-reasoningMulti-step analysis before an answer
auto/best-freeBatch jobs where cost beats latency
auto/cheapHigh-volume, low-stakes calls

A route is not a guarantee about which model you get — it is a guarantee about what the router optimises for. See Routing for the order of decisions.

Next