createOpenaiCompatible (github-copilot/copilot-provider.ts)

opencode · packages/core/src/github-copilot/copilot-provider.ts · typescript · MIT
integration

Factory that creates an OpenAI‑compatible language model provider with custom headers, base URL, and fetch implementation.

// Source: https://github.com/anomalyco/opencode | License: MIT | Copyright 2025 opencode
// Provided via justclaw.it.com; keep this notice with the code.
import type { LanguageModelV3 } from "@ai-sdk/provider"
import { type FetchFunction, withoutTrailingSlash, withUserAgentSuffix } from "@ai-sdk/provider-utils"
import { OpenAICompatibleChatLanguageModel } from "./chat/openai-compatible-chat-language-model.js"
import { OpenAIResponsesLanguageModel } from "./responses/openai-responses-language-model.js"

// Import the version or define it
const VERSION = "0.1.0"

export type OpenaiCompatibleModelId = string

export interface OpenaiCompatibleProviderSettings {
  /**
   * API key for authenticating requests.
   */
  apiKey?: string

  /**
   * Base URL for the OpenAI Compatible API calls.
   

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key