Skip to content

[DOCS] Add Cloudflare D1 conversation storage backend to cli.md #273

Closed

Description

Summary

Follow-up to inference-gateway/cli#646, which adds a d1 conversation storage backend (Cloudflare D1 over its HTTP query API). The CLI write path now supports D1, but cli.md does not mention it yet. This issue tracks updating the storage-backends documentation to cover Cloudflare D1 alongside the existing backends (config keys, env vars, and notes).

Why D1

Headless infer on ephemeral GitHub Actions runners needs an external, control-plane-readable conversation store:

  • sqlite / jsonl / memory live on the runner's disk, which is wiped on recycle and unreadable externally.
  • postgres / redis speak wire protocols D1 does not.
  • D1 is external to the runner, and the gateway already reads it back via its native binding. PR [DOCS] Update go version references to 1.26.7 #646 adds the CLI write path.

What to update in cli.md

  1. Storage Backends list - Configuration overview (currently SQLite, PostgreSQL, Redis, In-memory). Add a Cloudflare D1 entry, e.g. Cloudflare D1 - external SQLite-compatible store over HTTP (for ephemeral CI runners). (Side note: JSONL is also missing from this particular list while it is present in the Conversation Management list - worth aligning.)

  2. Storage Backends list - Conversation Management (SQLite, PostgreSQL, Redis, JSONL, In-memory). Add **Cloudflare D1**: External SQLite over Cloudflare's HTTP query API.

  3. Backend-agnostic inspection note - the line that reads "works the same across jsonl, sqlite, postgres, redis, and memory" should include d1.

  4. Config keys - document the storage.d1 block:

storage:
  enabled: true
  type: d1
  d1:
    account_id: "<cloudflare-account-id>"
    database_id: "<d1-database-id>"
    api_token: "<api-token-with-d1-edit>"   # inject via INFER_STORAGE_D1_API_TOKEN
    base_url: "https://api.cloudflare.com/client/v4"  # optional
  1. Environment variables - add to the env-var reference:

    • INFER_STORAGE_D1_ACCOUNT_ID
    • INFER_STORAGE_D1_DATABASE_ID
    • INFER_STORAGE_D1_API_TOKEN (secret - inject, never commit)
    • INFER_STORAGE_D1_BASE_URL (optional; defaults to https://api.cloudflare.com/client/v4)
  2. Migrations - the infer migrate docs should note that Cloudflare D1 creates its schema automatically on connect (no manual migration step), matching jsonl/redis/memory in not requiring an explicit migration run.

Notes worth capturing

  • Schema parity: the D1 driver runs the SQLite migrations verbatim over HTTP, so conversations / session_groups stay byte-for-byte compatible with the SQLite backend - either side can initialise the database.
  • Timestamps are stored as UTC RFC3339 for stable lexical ORDER BY updated_at DESC across runners in any timezone and unambiguous external reads.
  • Secret handling: api_token follows the existing plaintext-config + env-override convention (like the Postgres password) and is never logged; inject via INFER_STORAGE_D1_API_TOKEN.

References

Activity

  1. added
    documentation
    bot
    on Jun 23, 2026
  2. edenreich commented on Jun 23, 2026

    @edenreich
    Contributor

    @claude Can you document it?

  3. moved this to Todo in 2026on Jun 23, 2026
  4. added theissue type on Jun 23, 2026
  5. inference-gateway-maintainer commented on Jun 23, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Claude finished @edenreich's task in 5m 45s —— View job • docs/issue-273-20260623-1819 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-273-20260623-1819?quick_pull=1&title=Issue%20%23273%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23273%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Documented the Cloudflare D1 storage backend

    All updates from the issue are implemented in cli.md and pushed.

    • Read cli.md and locate the storage backend sections
    • Add Cloudflare D1 to the Storage Backends list (Configuration overview) + align JSONL
    • Add Cloudflare D1 to the Storage Backends list (Conversation Management)
    • Add d1 to the backend-agnostic inspection note
    • Document the storage.d1 config block
    • Add INFER_STORAGE_D1_* environment variables
    • Note D1 auto-creates schema (no manual migration)
    • Run lint:md and format:check (and build) - all pass
    • Commit and open PR

    What changed

    A new Cloudflare D1 backend subsection was added under Conversation Management, plus three smaller edits to keep the existing lists/notes consistent:

    1. Storage Backends overview list - added Cloudflare D1 - external SQLite-compatible store over HTTP (for ephemeral CI runners), and also added the previously-missing JSONL entry to align this list with the Conversation Management one.
    2. Conversation Management storage list - added **Cloudflare D1**: External SQLite over Cloudflare's HTTP query API.
    3. Backend-agnostic inspection note - now reads jsonl, sqlite, postgres, redis, d1, and memory.
    4. storage.d1 config block - documented account_id, database_id, api_token, and optional base_url.
    5. Environment variables - INFER_STORAGE_D1_ACCOUNT_ID, INFER_STORAGE_D1_DATABASE_ID, INFER_STORAGE_D1_API_TOKEN (secret), INFER_STORAGE_D1_BASE_URL (optional).
    6. Notes - no manual migration (schema auto-created on connect), schema parity with SQLite, UTC RFC3339 timestamps, and api_token secret handling.

    Notes on the approach

    • cli.md had no pre-existing storage: YAML block, INFER_STORAGE_* reference, or infer migrate section, so the migration guidance is captured as a "No manual migration" note inside the new D1 subsection rather than inventing an infer migrate command/page that isn't documented here.
    • YAML in the example uses single quotes to match the existing code blocks in this file (the issue snippet used double quotes); the env var table was auto-aligned by Prettier.
    • Verified locally: bun run format:check, bun run lint:md, and bun run build all pass.

    PR: inference-gateway/docs#274 (Closes #273)

    • branch docs/issue-273-20260623-1819
  6. moved this from Todo to In progress in 2026on Jun 23, 2026
  7. moved this from In progress to QA in 2026on Jun 23, 2026
  8. moved this from QA to Done in 2026on Jun 24, 2026
  9. inference-gateway-releaser commented on Jun 24, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.6.113 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

    botdocumentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions