Align with modernized TS SDK: hosted default, OTARI_AI_TOKEN, logo, branding (+ User-Agent fix)#26
Open
khaledosman wants to merge 3 commits into
Open
Align with modernized TS SDK: hosted default, OTARI_AI_TOKEN, logo, branding (+ User-Agent fix)#26khaledosman wants to merge 3 commits into
khaledosman wants to merge 3 commits into
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
https://api.otari.aiwhen none is configured — so settingOTARI_AI_TOKENis enough to use the hosted gateway with noapi_base. Non-platform mode still requires an explicit base URL.OTARI_AI_TOKEN/GATEWAY_API_BASE/GATEWAY_API_KEYfirst, with the priorOTARI_PLATFORM_TOKEN/OTARI_API_BASE/OTARI_API_KEYkept as legacy aliases (canonical wins). No public function signatures changed; added an additiveOtari::api_base()getter.Docs
assets/otari-logo.svg) to the README header.export OTARI_AI_TOKEN=...+CompletionOptions::default()); added an Authentication section with an env-var table (canonical + legacy aliases).any-llmreferences (logo, nav links, gateway repo link, Docker imageghcr.io/mozilla-ai/otari/gateway, docs links) with theirotariequivalents. (The "Based on the proven any-llm Python library" credit is kept — accurate provenance.)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
reqwestclient 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 defaultotari-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 typedOtariErrors 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→ cleancargo test --all-features→ all pass (incl. new env / hosted-default / User-Agent tests)cargo fmt --check+cargo clippy --all-features -- -D warnings→ clean🤖 Generated with Claude Code