Skip to main content
Running on Morph’s custom kernels and inference stack optimized for codegen. OpenAI-compatible. Base URL https://api.morphllm.com/v1. Throughput runs ~90–200 tok/s depending on model and load. All models support tools, response_format (JSON mode + JSON schema), structured outputs, logprobs, and reasoning. Per-token rates are on the pricing page and live at /api/models/json.

Quick Start

Tools and Structured Output

Reasoning is off by default. Enable with reasoning: { effort: "medium" } ("low" / "high"). Reasoning tokens bill as output. Automatic prefix caching is on for all models, with per-request TTL control. Use Model Router to pick automatically per request.

Service Tiers

GLM-5.2 supports the OpenAI service_tier parameter.
How standby works:
  • A standby request is admitted only while the fleet is under roughly a quarter of its serving capacity. When no region qualifies, you get 429 with error.code: "resource_unavailable" and a Retry-After header. Nothing is generated and nothing is billed. Expect most standby throughput off-peak.
  • On a 429, retry with exponential backoff. If you need the result now, resend with service_tier: "default".
  • The response echoes the tier that served it in a service_tier field (on the final usage chunk when streaming).
  • Streaming, tools, and structured output work the same as default.
  • Unknown tier values return 400 listing the accepted ones.
Use standby for evals, batch labeling, data generation, and anything a retry loop can absorb. Keep interactive and agent-loop traffic on default: under load, default requests are served in full while standby is shed in ~200ms. Standby bills at the standard per-token rates today. Available on GLM-5.2 (morph-glm52-744b); sending it to other models is a no-op.

Pitfalls

TPS numbers are generation throughput, not end-to-end. With 30k tokens of context, prefill dominates first-token wait even with caching. For agent loops, keep a smaller working context with Compact rather than filling the full window.
These models use OpenAI tool-call shape, not Anthropic tool_use blocks or Gemini functionDeclarations. Use the OpenAI SDK or @ai-sdk/openai pointed at our base URL.
Pass response_format: { type: "json_object" } and say “respond in JSON” in your prompt. For strict shape control: response_format: { type: "json_schema", json_schema: { ... } }.

See Also

  • Prompt Caching — automatic cached-input discounts, per-request TTL
  • Standby Requests — best-effort GLM-5.2 capacity for batch and background work
  • Model Router — auto-route between these and frontier models per request
  • Compact — shrink context before paying for it
  • WarpGrep — code search for retrieval when context is the bottleneck