Skip to content

Align with modernized TS SDK: hosted default, OTARI_AI_TOKEN, logo, branding (+ User-Agent fix)#26

Open
khaledosman wants to merge 3 commits into
mainfrom
docs/clarify-api-token-and-logo
Open

Align with modernized TS SDK: hosted default, OTARI_AI_TOKEN, logo, branding (+ User-Agent fix)#26
khaledosman wants to merge 3 commits into
mainfrom
docs/clarify-api-token-and-logo

Conversation

@khaledosman
Copy link
Copy Markdown

@khaledosman khaledosman commented May 29, 2026

Brings the Rust SDK in line with the modernized TypeScript SDK (otari-sdk-ts#8 + #9), so the SDKs behave and read consistently.

Behavioral changes

  • Hosted-gateway default: in platform mode, the base URL now defaults to https://api.otari.ai when none is configured — so setting OTARI_AI_TOKEN is enough to use the hosted gateway with no api_base. Non-platform mode still requires an explicit base URL.
  • Env-var alignment (back-compatible): read canonical OTARI_AI_TOKEN / GATEWAY_API_BASE / GATEWAY_API_KEY first, with the prior OTARI_PLATFORM_TOKEN / OTARI_API_BASE / OTARI_API_KEY kept as legacy aliases (canonical wins). No public function signatures changed; added an additive Otari::api_base() getter.

Docs

  • Logo: add the otari seal + wordmark (assets/otari-logo.svg) to the README header.
  • Hosted-first README: Quickstart now leads with the hosted path (export OTARI_AI_TOKEN=... + CompletionOptions::default()); added an Authentication section with an env-var table (canonical + legacy aliases).
  • Branding cleanup: replace stale any-llm references (logo, nav links, gateway repo link, Docker image ghcr.io/mozilla-ai/otari/gateway, docs links) with their otari equivalents. (The "Based on the proven any-llm Python library" credit is kept — accurate provenance.)
  • Provider keys: note that the gateway needs a provider key configured to route upstream.

Bug found & fixed during end-to-end verification

Verified by building a sample app and completing against the live hosted gateway. This surfaced a real bug: the reqwest client sent no User-Agent, and the gateway edge rejects UA-less requests with HTTP 403 — so hosted calls failed while the TS/Python/Go SDKs (which send a default UA) succeeded. Fixed by setting a default otari-rust/<version> User-Agent. Added a regression test asserting the header is sent. The sample now returns a real completion against the hosted gateway.

Implementation note (error detail)

No error-handling change was needed — extract_error_message() already parses the gateway's {"detail": "..."} body, so typed OtariErrors carry the gateway detail. The TS fetch-wrapper fix was specific to the JS OpenAI SDK's "(no body)" quirk.

Verification

  • cargo build --all-features → clean
  • cargo test --all-features → all pass (incl. new env / hosted-default / User-Agent tests)
  • cargo fmt --check + cargo clippy --all-features -- -D warnings → clean
  • live hosted completion via a sample app → returns a real response

🤖 Generated with Claude Code

khaledosman and others added 2 commits May 29, 2026 15:19
Mirrors the otari-sdk-ts changes and brings the README in line with the
other SDKs:
- Add the otari logo (seal + wordmark) to the README header
- Note that the gateway needs a provider key configured to route upstream
- Replace stale any-llm references (logo, nav links, gateway image, docs
  links) with their otari equivalents

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Brings the Rust SDK to parity with the modernized otari-sdk-ts:
- In platform mode, default the base URL to https://api.otari.ai when none
  is configured, so setting OTARI_AI_TOKEN is enough to use the hosted
  gateway. Non-platform mode still requires an explicit base URL.
- Align env vars with the other SDKs: canonical OTARI_AI_TOKEN /
  GATEWAY_API_BASE / GATEWAY_API_KEY, with the prior OTARI_* names kept as
  legacy aliases (canonical wins).
- Add an Otari::api_base() getter and rewrite the README to be hosted-first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@khaledosman khaledosman changed the title docs: add otari logo; align README branding and provider-key note Align with modernized TS SDK: hosted-gateway default, OTARI_AI_TOKEN, logo, branding May 29, 2026
@khaledosman khaledosman requested a review from tbille May 29, 2026 13:41
End-to-end testing against the hosted gateway revealed that requests with
no User-Agent are rejected by the edge with HTTP 403. The reqwest client
sent no User-Agent, so hosted requests failed (403) while the TS/Python/Go
SDKs — which all send a default UA — succeeded.

Set a default User-Agent of otari-rust/<version> on the client. Adds a
regression test asserting the header is sent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@khaledosman khaledosman changed the title Align with modernized TS SDK: hosted-gateway default, OTARI_AI_TOKEN, logo, branding Align with modernized TS SDK: hosted default, OTARI_AI_TOKEN, logo, branding (+ User-Agent fix) May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant