adapter-openai-compatible

TextModel over the chat-completions wire, at any base URL: hosted or local.

With cargo

cargo add cratefield-adapter-openai-compatible

What it is

adapter-openai-compatible.

TextModel port over the chat-completions wire for the Cratefield harness (issue #560) — one adapter for every server that answers that wire, because the base URL is a constructor argument, not a constant: OpenAI itself, Workers AI's OpenAI-compatible endpoint, OpenRouter, and local servers like vLLM, llama.cpp and Ollama. Uses the runtime's HttpClient port — no reqwest, no vendor SDK — so it runs unchanged on Workers (worker::Fetch) and natively, and inherits that port's destination vetting, deadline and response-size caps.

From the crate’s own README.

Ports

Implements TextModel

Read more

History

Changelog.

From the crate’s CHANGELOG.md in the harness, as of 0c5560b. 5 versions recorded, newest first. Every published version is on crates.io.

  1. 0.2.3

    crates.ioReleaseDiff

    Other

    • updated the following local packages: cratefield-core
  2. 0.2.2

    crates.ioReleaseDiff

    Added

    • core Speech port — transcription and streamed synthesis, with Workers AI and OpenAI-compatible adapters (#861) (#868)
    • Speech over the OpenAI audio wire (issue #861): OpenAiCompatibleSpeech transcribes through audio/transcriptions and synthesizes through audio/speech at any base URL, under the same key and NotConfigured rules as the chat adapter, with the port's limits enforced before any request.
    • TextModel image inputs (issue #628): a Prompt's image Parts serialise into the request's content array ({"type":"image_url","image_url":{"url":"data:<media-type>;base64,…"}}), text-only messages keep their plain-string content, image input is opted into with OpenAiCompatible::with_images() (Capability::Images, off by default), an image prompt without it is refused with Unsupported before any request, and Prompt::check_images bounds are enforced locally first.

    Other

    • streaming completions (text, reasoning, tool-call and usage deltas) with idle/total timeouts and cancel-on-drop (#869)
3 earlier versions 0.1.0 to 0.2.1
  1. 0.2.1

    crates.ioReleaseDiff

    Other

    • schema-validated structured output (complete_json / complete_as) (#739)
  2. 0.2.0

    crates.ioReleaseDiff

    Changed

    • Breaking: requires cratefield-core 0.8 (was 0.7), and so a minor rather than a patch bump: a venture still on core 0.7 does not pick this release up through a caret requirement and end up with two copies of core (#712).

    Other

    • tool calling (ToolSpec, tool_calls, run_tool_loop) across the Anthropic and OpenAI-compatible adapters (#665) (#705)
  3. 0.1.0

    crates.ioRelease

    Other

    • OpenAI-compatible adapter, cached-token usage on every completion, shared TextModel conformance suite (#560) (#567)

One of 76 crates in the harness, all of them MIT and all of them in one repository.