Download packages/llm/src/protocols/openai-compatible-chat.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 876 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/llm/src/protocols/openai-compatible-chat.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/llm/src/protocols/openai-compatible-chat.ts
-
curl -L -o openai-compatible-chat.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/llm/src/protocols/openai-compatible-chat.ts
876 Bytes
| import { Route, type RouteRoutedModelInput } from "../route/client" | |
| import { Endpoint } from "../route/endpoint" | |
| import { Framing } from "../route/framing" | |
| import * as OpenAIChat from "./openai-chat" | |
| const ADAPTER = "openai-compatible-chat" | |
| export type OpenAICompatibleChatModelInput = RouteRoutedModelInput | |
| /** | |
| * Route for non-OpenAI providers that expose an OpenAI Chat-compatible | |
| * `/chat/completions` endpoint. Reuses `OpenAIChat.protocol` end-to-end and | |
| * overrides only the route id so providers can be resolved per-family without | |
| * colliding with native OpenAI. Provider helpers configure the route endpoint | |
| * before model selection. | |
| */ | |
| export const route = Route.make({ | |
| id: ADAPTER, | |
| protocol: OpenAIChat.protocol, | |
| endpoint: Endpoint.path("/chat/completions"), | |
| framing: Framing.sse, | |
| }) | |
| export * as OpenAICompatibleChat from "./openai-compatible-chat" | |