Skip to content

docs: publish canonical API reference for /anthropic/v1/messages compatibility endpoint #129

Description

@SGAfonso

Summary

Moonshot's agent-support docs document the env var
ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic for Claude Code integration,
and we can confirm the endpoint POST /anthropic/v1/messages works end-to-end.
However, the request/response contract, supported headers, and feature matrix for
this endpoint are not published anywhere we can find. We're asking for canonical
reference docs so we (and other agentic-tool builders) can pin against a stable
contract rather than empirical probing.

What works today (observed)

  • POST https://api.moonshot.ai/anthropic/v1/messages with an Anthropic-shape body
    accepts: model, messages, system, tools, tool_choice, max_tokens,
    temperature, stream.
  • Authorization: Bearer <moonshot_api_key> is accepted (claude-code-router's
    anthropic transformer uses UseBearer: true against this base URL).
  • Streaming (SSE) returns Anthropic event types (message_start, content_block_delta,
    message_delta, message_stop) compatible enough for Claude Code's SDK to consume.
  • Temperature is documented as rescaled: real_temperature = request_temperature * 0.6.
  • kimi-k2.5 and kimi-k2.6 both respond on this endpoint.

What is undocumented

  1. Endpoint contract. No published spec for request/response shape, only the
    env-var setup blurb. Is the contract guaranteed to match Anthropic Messages API
    v1? Which version?
  2. Header support. Is anthropic-version honored / required / ignored? Does
    anthropic-beta (e.g. tools-2024-04-04, prompt-caching-2024-07-31,
    extended-cache-ttl-2025-04-11) do anything?
  3. Feature matrix. Which Anthropic features are supported / translated /
    silently dropped?
    • cache_control blocks (prompt caching)
    • Vision ({type: image, source: ...} content blocks)
    • Document content blocks ({type: document, ...}) — we observe 400s and
      have to strip these client-side
    • thinking: {type: enabled} (we observe Kimi K2.6 supports thinking but
      400s in multi-turn tool-calling when prior assistant tool_use lacks
      reasoning_content — what's the contract here?)
    • tool_choice: {type: any|auto|tool} semantics
    • Stop sequences, parallel tool use
  4. Version skew + deprecation. Where is the changelog for this endpoint?
    How are breaking changes announced? Is there a way to pin to a specific
    API version (header)?
  5. Rate limits + error shapes. Are Anthropic-style error bodies
    ({type: error, error: {type, message}}) guaranteed, or is OpenAI-shape
    leakage possible?

Why it matters

We operate a federated AI control plane (SemanticGate fleet) where Kimi K2 is a
first-class cascade tier alongside Anthropic-native and DeepSeek's
/anthropic/v1/messages compat endpoint. Provider switches in our cascade
need a stable contract so we can:

  • Detect feature-availability deterministically (rather than empirical probing
    that's brittle across model upgrades).
  • Pin clients against documented behavior so model-version bumps on Moonshot's
    side don't silently break our agents.
  • Author transformers/shims with confidence (we currently maintain
    kimi-document-strip and kimi-tool-thinking-strip based on empirical
    probing — would prefer to map these to documented contracts).

What would help

A reference page under platform.kimi.ai/docs/api/anthropic/ covering:

  1. Endpoint URL + auth (Authorization: Bearer) + accepted headers
  2. Request body fields supported / unsupported / partial (with a clean
    "Anthropic feature → Kimi support" table)
  3. Response shape + streaming event types
  4. Error format
  5. Versioning policy + changelog link
  6. Known divergences from upstream Anthropic spec (e.g. the temperature
    rescaling note already in your migrating-from-anthropic-claude page)

Happy to contribute a docs PR if you'd accept community input on the page
structure.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions