feat: add protocol= + base_url= for compatible APIs#241
Conversation
Add support for pointing celeste at any OpenAI-compatible or Anthropic-compatible API using protocol= and base_url= parameters. - Add Protocol enum (openresponses, chatcompletions) to core.py - Remove Provider.OPENRESPONSES (protocols aren't providers) - Separate provider and protocol as independent fields on ModalityClient - Wire base_url as instance field, used by _build_url() - Add protocol= and base_url= to create_client() and domain namespaces - Default to openresponses when base_url given without protocol - BYOA auth: protocol path defaults to NoAuth, accepts api_key or auth - Make Model.provider optional (None for protocol-path models) - Remove dead base_url plumbing from per-call method signatures - Fix credentials.get_auth to use api_key without registry entry - Clean up OllamaGenerateClient to use _build_url() pattern - Remove redundant .value on StrEnum in integration tests Closes #230
StrEnum values are already strings — the | str union on Modality, Operation, Protocol, and Provider parameters was unnecessary. Also remove isinstance(x, str) coercions that are no-ops on StrEnums.
Code reviewBug: When Before this PR the line read Fix: change line 279 to: provider=resolved_provider or resolved_model.provider, |
Summary
protocol=+base_url=parameters tocreate_client()and domain namespaces for pointing celeste at any compatible API (MiniMax, vLLM, Ollama, LocalAI, etc.)providerandprotocolas independent fields onModalityClient— a protocol is NOT a providerbase_urlthrough to_build_url()as a client instance attributeNoAuth, acceptsapi_key=orauth=)base_urlplumbing from per-call method signaturesUsage
Design decisions
protocolreplacesproviderfor the compatible API case — same concept (wire format identity) without naming a companyModalityClient.provider: Provider | None— None for protocol-only clientsModalityClient.protocol: Protocol | None— None for provider-only clientsModel.provider: Provider | None— None for protocol-path models (standard PythonOptionalpattern)base_urlwithoutprotocoldefaults toopenresponses(most common compatible format)Test plan
lfm2:latestviaprotocol="openresponses")provider="ollama") still worksCloses #230
Closes #237
Co-Authored-By: Xinyue 7869833+XinyueZ@users.noreply.github.com