LMU AI Docs
User Guide

API Protocols

LMU AI supports three inbound protocols — Anthropic, OpenAI Compatible, and Gemini native. One table to pick the right Base URL and endpoint and avoid errors.

LMU AI supports three inbound protocols: Anthropic, OpenAI Compatible, and Gemini native v1beta. Every endpoint uses your LMU AI sk- API key, and the models you can actually call are decided by the key's group.

Two things to keep straight first

  • "Which protocol" is decided by the client, SDK, and use case. The Anthropic SDK uses /v1/messages, the OpenAI SDK uses /v1/chat/completions or /v1/responses, and Gemini native image calls use /v1beta/models/{model}:generateContent.
  • "Which models you can call" is decided by your API key's group (the upstream account behind your subscription / top-up plan), which is a separate dimension from the inbound protocol.

In other words: the wrong protocol gives an outright 401 / 404; the right protocol with a model outside your group's range returns a model-unavailable error.

The most common error comes from the wrong protocol

  • The Anthropic protocol Base URL does not include the /v1 suffix
  • The OpenAI protocol SDK Base URL usually does include the /v1 suffix
  • The Gemini native protocol uses https://api.lmuai.com as the host and calls the full /v1beta/... path

Getting it wrong causes 400 / 401 / 404. Before configuring a tool or writing code, confirm which protocol the client expects.


Pick your protocol at a glance

ProtocolBase URLTypical tools
Anthropic protocolhttps://api.lmuai.comClaude Code (CLI / desktop / VS Code extension), the official anthropic SDK, Cherry Studio, Kilo Code with Claude / Chinese models, any Anthropic-compatible client
OpenAI Compatiblehttps://api.lmuai.com/v1Codex CLI, Codex App, Cursor / Cline / Roo Code / OpenCode, the official openai SDK, VS Code extensions with GPT, any OpenAI-compatible client
Gemini native v1betahttps://api.lmuai.comGemini native SDK / HTTP clients, Gemini text-to-image and image-to-image, model list and generateContent

All three protocols use the LMU AI key that starts with sk-:

  • Anthropic protocol: Authorization: Bearer <YOUR_API_KEY> or x-api-key: <YOUR_API_KEY>
  • OpenAI Compatible: Authorization: Bearer <YOUR_API_KEY>
  • Gemini native: x-goog-api-key: <YOUR_API_KEY> recommended, Bearer also accepted

Anthropic protocol

Base URL: https://api.lmuai.com (no /v1)

Endpoints:

  • POST /v1/messages — message conversation
  • POST /v1/messages/count_tokens — token counting
  • GET /v1/models — available model list

Python SDK example:

from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.lmuai.com",
    api_key="sk-xxxxxxxx",
)

resp = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.content[0].text)

curl example:

curl -X POST https://api.lmuai.com/v1/messages \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "messages": [{"role":"user","content":"Hello"}]
  }'

Why is the SDK base_url without /v1 but curl with /v1?

The Anthropic official SDK's base_url convention is to omit /v1; the SDK appends paths like /v1/messages internally. When you write curl by hand, you write the full path /v1/messages. Both point to the same endpoint.


OpenAI protocol

Base URL: https://api.lmuai.com/v1 (with /v1)

Endpoints:

  • POST /chat/completions — standard Chat Completions API
  • POST /responses — OpenAI Responses API (including the /responses/{id} sub-paths)
  • POST /images/generations, POST /images/edits — image generation / editing

Python SDK example:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.lmuai.com/v1",
    api_key="sk-xxxxxxxx",
)

resp = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

curl example:

curl -X POST https://api.lmuai.com/v1/chat/completions \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "messages": [{"role":"user","content":"Hello"}]
  }'

Gemini native protocol

Base URL: https://api.lmuai.com

Main endpoints:

  • GET /v1beta/models — list Gemini native models
  • GET /v1beta/models/{model} — query a specific model
  • POST /v1beta/models/{model}:generateContent — text generation, text-to-image, and image-to-image
  • POST /v1beta/models/{model}:streamGenerateContent?alt=sse — streaming generation

Authentication:

x-goog-api-key: YOUR_API_KEY

Minimal text-to-image example:

curl --request POST \
  'https://api.lmuai.com/v1beta/models/gemini-3.1-flash-image:generateContent' \
  -H 'x-goog-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{"text": "an orange cat wearing an astronaut helmet"}]
    }],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"],
      "imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}
    }
  }'

The Gemini image endpoint is not /v1/chat/completions

Gemini image models use the native generateContent. For full text-to-image, image-to-image, 1K / 2K / 4K, and Base64 parsing details, see the Gemini Image API.

For GPT image models see the GPT Image API, and for Grok image models see the Grok Image API. For large offline Gemini jobs see the Gemini Batch Image API.


Protocol and available models are two different things

Which models your key can call is decided entirely by the upstream account mounted on its group, independent of which protocol you call with:

The upstream on your groupThe models you can actually call
OpenAI account onlyGPT series only
Claude account onlyClaude series only (even if you call with the OpenAI protocol, the backend translates the protocol, but the model range is unchanged)
Chinese-model upstream only (e.g. GLM / Kimi)the corresponding Chinese models only
Model routing configured in the backend (multi-upstream group)routed by model name to different upstreams, can span brands — the exact range depends on the group config

So:

  • Choosing the Anthropic, OpenAI Compatible, or Gemini native protocol determines the inbound request format; the actual model range is still decided by the API key's group.
  • To see which models your current key can call, check the group's model list on the API Keys detail page or the Available Models page in the console.

About the Claude Max group

The Claude Max group supports the Anthropic protocol only

The Claude Max group is for Claude Code only, so it can only use the Anthropic protocol (https://api.lmuai.com).

If you are using a key from a Claude Max plan group:

  • ✅ It works in Claude Code (CLI / desktop / VS Code extension)
  • ❌ It cannot be used with Codex CLI, Cursor, Cherry Studio, or any tool that uses the OpenAI protocol
  • ❌ It cannot be entered as https://api.lmuai.com/v1

To use an OpenAI-protocol tool, switch to a key from a pay-as-you-go / regular subscription group (the exact available models still depend on the plan group you purchased).


Troubleshooting

SymptomUsual causeWhat to do
401 UnauthorizedBase URL uses the wrong protocol / key typo / IDE not restartedCheck the Base URL matches the tool's protocol; restart the IDE to reload config
404 Not FoundOpenAI-protocol URL missing /v1, Anthropic URL wrongly including /v1, or Gemini path not using /v1beta/models/...Re-check the Base URL and full endpoint against the table above
Model unavailable / No available accountsCalled a model outside your group's range (e.g. calling GPT with a Claude Max group)Confirm the models your group actually includes on the Available Models page, or switch to a group that includes the target model
429 Too Many RequestsDaily quota exhaustedSee the FAQ

For more troubleshooting see the FAQ.


Next steps

Once you have the protocol and Base URL right, pick the tool you want:

Last updated:

On this page