NewHow we catch a seller listing the wrong model, and refund you if one does.

Use the OpenAI Python SDK and LangChain with a cheaper API (MartLLM)

Set base_url="https://api.martllm.com/v1" and api_key to your MartLLM key in OpenAI(...) or ChatOpenAI(...), then pass any MartLLM model id. Chat, streaming, tool calls and JSON output keep working; your other code stays the same.

Steps (OpenAI Python SDK)

  1. Make a key on your keys page and add credit.
  2. Save it as an environment variable:
export UBERLLM_API_KEY=ull_your_key
  1. Point the client at MartLLM:
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.martllm.com/v1",
    api_key=os.environ["UBERLLM_API_KEY"],
)

resp = client.chat.completions.create(
    model="deepseek/deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Give me three names for a coffee shop."}],
)
print(resp.choices[0].message.content)

That is the whole change. client.chat.completions.create with stream=True, tools, response_format, temperature and max_tokens works as before. The async client (AsyncOpenAI) takes the same two arguments.

Without touching the code

The OpenAI SDK also reads two environment variables, so a script that calls OpenAI() with no arguments can be moved without editing it:

export OPENAI_BASE_URL=https://api.martllm.com/v1
export OPENAI_API_KEY=ull_your_key
python your_script.py

You still need to change the model= string to a MartLLM id such as deepseek/deepseek-v4.1-flash.

Steps (LangChain)

pip install langchain-openai
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="deepseek/deepseek-v4.1-flash",
    base_url="https://api.martllm.com/v1",
    api_key=os.environ["UBERLLM_API_KEY"],
)
print(llm.invoke("Say hello in one sentence.").content)

Chains, agents, bind_tools and .stream() work unchanged. Pass base_url in code rather than relying on environment variables: the argument always wins, so a stray OPENAI_API_BASE on the machine cannot send calls elsewhere.

LangChain.js is the same idea:

import { ChatOpenAI } from "@langchain/openai";

const llm = new ChatOpenAI({
  model: "deepseek/deepseek-v4.1-flash",
  apiKey: process.env.UBERLLM_API_KEY,
  configuration: { baseURL: "https://api.martllm.com/v1" },
});

Pick a cheaper model for each job

The point of one key for every model is that you can stop paying frontier prices for easy work. A common split:

  • Hard reasoning or customer-facing answers: a top model such as deepseek/deepseek-v4.1-flash.
  • Bulk summaries, tagging, extraction: google/gemma-3-27b-it or another model from the batch table below, often 50 to 100 times cheaper per token.

Change only the model= string to move a step from one to the other.

What is not there

MartLLM serves chat completions (/v1/chat/completions), the Responses API (client.responses.create, streaming and tool calls included) and the Anthropic messages route. It keeps no state between calls, so send the whole conversation in input instead of previous_response_id (Responses API reference). It does not serve embeddings or the Assistants API: keep those calls on their current provider.

Troubleshooting

  • openai.AuthenticationError (401): the key is wrong or empty. Print len(os.environ["UBERLLM_API_KEY"]); a key is ull_ plus 43 characters.
  • openai.NotFoundError (404) on /responses or /embeddings: those routes do not exist here, see above.
  • model_not_found: OpenAI-style ids like gpt-4o need the maker in front: openai/gpt-4o.
  • openai.RateLimitError (429): the key's per-minute limit (300 by default). Raise it on the keys page, or add retries with backoff.
  • 402 insufficient_credits: top up on the credits page.

Keep reading

Models to start with

The first one is in the code below. Each takes tool calls.

ModelModel id (paste this)Price now
DeepSeek V4.1 Flashdeepseek/deepseek-v4.1-flash$0.0075 in · $0.0282 out / 1M
Gemini 3.5 Flashgoogle/gemini-3.5-flash$0.0075 in · $0.0450 out / 1M
Claude Sonnet 5.5anthropic/claude-sonnet-5.5$0.3600 in · $1.80 out / 1M
GPT-5.5openai/gpt-5.5$1.25 in · $7.50 out / 1M
Kimi K3moonshotai/kimi-k3$0.0384 in · $0.2021 out / 1M
GLM 5.3z-ai/glm-5.3$0.0029 in · $0.0100 out / 1M
Gemma 3 27Bgoogle/gemma-3-27b-it$0.00079 in · $0.0020 out / 1M
Qwen3 VL 235B A22Bqwen/qwen3-vl-235b-a22b-instruct$0.0021 in · $0.0188 out / 1M

Prices at the last hourly build, no fee added · every model →

For big batch jobs

Lowest price per token for summarising, tagging and extraction at volume.

ModelModel id (paste this)Price now
Gemma 3 27Bgoogle/gemma-3-27b-it$0.00079 in · $0.0020 out / 1M
GPT-OSS 120Bopenai/gpt-oss-120b$0.000069 in · $0.00030 out / 1M
DeepSeek V3.2deepseek/deepseek-v3.2$0.0026 in · $0.0038 out / 1M
Qwen 3 235B A22B Instruct 2507qwen/qwen3-235b-a22b-2507$0.00057 in · $0.0035 out / 1M
Gemini 3.1 Flash Litegoogle/gemini-3.1-flash-lite$0.0013 in · $0.0075 out / 1M
DeepSeek V4.1 Flashdeepseek/deepseek-v4.1-flash$0.0075 in · $0.0282 out / 1M

Prices at the last hourly build, no fee added · every model →

FAQ

Can I use the official OpenAI Python SDK with MartLLM?

Yes. Pass base_url="https://api.martllm.com/v1" and your MartLLM key to OpenAI(), or set OPENAI_BASE_URL and OPENAI_API_KEY. chat.completions with streaming, tools and JSON output works for every chat model.

Does LangChain work with MartLLM?

Yes. ChatOpenAI from langchain-openai takes base_url and api_key; chains, agents and tool binding work unchanged against any MartLLM chat model.

Does MartLLM support embeddings or the Responses API?

The Responses API yes, embeddings no. MartLLM serves /v1/chat/completions, /v1/responses (client.responses.create, without previous_response_id: send the whole conversation each call) and the Anthropic /v1/messages route. Keep embeddings on their current provider.