Skip to content

[DOCS] Python SDK: Responses API + zai provider #420

Closed

Description

Summary

The Python SDK (inference-gateway) gained support for the OpenAI-compatible Responses API and the zai provider in inference-gateway/python-sdk#77 (syncs to schemas v0.6.2). The docs should cover the new client surface so users can discover it.

New user-facing API:

  • InferenceGatewayClient.create_response(model, input, provider=None, max_output_tokens=None, tools=None, **kwargs) -> Response (POST /responses).
  • InferenceGatewayClient.create_response_stream(...) -> yields SSEvent (callers json.loads(chunk.data) and validate against ResponseStreamEvent, mirroring the chat streaming example).
  • New provider value zai.
  • New public models: CreateResponseRequest, Response, ResponseStreamEvent, ResponseInputItem, ResponseTool, ResponseToolChoice, ResponseReasoning, ResponseTextConfig, and related output/usage types.

Affected pages: Python SDK reference / usage docs (client methods, streaming example, provider list).

Source PR: inference-gateway/python-sdk#77

Acceptance Criteria

  • Document create_response and create_response_stream with a usage example (including the streaming SSEvent -> ResponseStreamEvent decode pattern).
  • Add zai to the documented provider list.
  • Note that the Responses API is provider-dependent (unsupported providers return 400; use chat completions instead).

Activity

  1. added
    documentation
    on Jul 18, 2026
  2. added theissue type on Jul 18, 2026
  3. moved this to Todo in 2026on Jul 18, 2026
  4. edenreich commented on Jul 18, 2026

    @edenreich
    Contributor

    @claude Can you work on this? mention this is currently only supported using OpenAI.

    Please also validate if the endpoint is implemented on the inference-gateway - because I think it's not yet implemented.

  5. inference-gateway-maintainer commented on Jul 18, 2026

    @inference-gateway-maintainer
    ContributorAuthor

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


    Done - Python Responses API documented + gateway support validated

    Opened PR: inference-gateway/docs#423

    • Read current Python SDK docs (sdks.md) and provider list
    • Validated whether /responses is implemented on the gateway
    • Confirmed zai handling (already generated from schema)
    • Verified exact SDK signatures + model shapes from python-sdk source
    • Wrote ### Responses API subsection (usage + streaming decode + OpenAI-only + not-yet-routed note)
    • format / lint:md / build / bun test all pass
    • Committed + opened PR + updated Roadmap board (QA) + filed gateway follow-up

    Answer to your two asks

    1. "Mention this is currently only supported using OpenAI" - done. The new note reads: the Responses API is provider-dependent and today only the OpenAI provider implements it; other providers return 400 Bad Request, so use create_chat_completion for those.

    2. "Validate if the endpoint is implemented on the inference-gateway - I think it's not yet" - you're right, it is not. Evidence:

    • Canonical schemas/openapi.yaml@main does define POST /responses (that's why the Python SDK could generate create_response / create_response_stream + the Response* models in v0.6.2).
    • But the gateway (inference-gateway/inference-gateway@main) only registers these routes in cmd/gateway/main.go:
      GET /health, ANY /proxy/:provider/*path, GET /v1/models, GET /v1/mcp/tools, POST /v1/chat/completions, POST /v1/metrics.
    • There is no POST /v1/responses route and no ResponsesHandler (not on the Router interface in api/routes.go; 0 symbol matches; no open gateway PR). A call today falls through to NoRoute -> 404.

    So the docs document the real SDK surface but add an honest caveat that the endpoint is not routed by the gateway yet (returns 404) until a gateway release ships the handler.

    What was documented (sdks.md, Python section)

    • create_response(model, input, provider=None, max_output_tokens=None, tools=None, **kwargs) -> Response, with an example walking response.output for output_text parts.
    • create_response_stream(...) -> yields SSEvent; streaming example does json.loads(chunk.data) -> ResponseStreamEvent.model_validate(...) and reads response.output_text.delta events (mirrors the chat streaming example).
    • Notes on the flattened ResponseTool function shape and string-or-items input.

    Notes / scope

    • zai needed no change - it is already in the schema Provider enum and renders in every generated region (supported-providers.md, the sdks-provider-list in sdks.md, etc.).
    • Scoped to the Python SDK as the issue asks; the TypeScript SDK exposes no Responses helper, so I did not add a capability-matrix row (avoids an unverifiable claim across the other SDKs).
    • Downstream follow-up filed: inference-gateway/inference-gateway#454 to implement the POST /v1/responses handler; the docs caveat should be removed once it ships.
    • branch docs/issue-420-20260718-2016 - PR #423
  6. moved this from Todo to In progress in 2026on Jul 18, 2026
  7. moved this from In progress to QA in 2026on Jul 18, 2026
  8. moved this from QA to Done in 2026on Jul 18, 2026
  9. inference-gateway-releaser commented on Jul 18, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.2 🎉

    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

    documentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions