MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / from_config

Method from_config

crates/opencode-provider/src/openai.rs:232–297  ·  view source on GitHub ↗
(config: OpenAIConfig, legacy_only: bool)

Source from the content-addressed store, hash-verified

230 }
231
232 fn from_config(config: OpenAIConfig, legacy_only: bool) -> Self {
233 let models = vec![
234 ModelInfo {
235 id: "gpt-4o".to_string(),
236 name: "GPT-4o".to_string(),
237 provider: "openai".to_string(),
238 context_window: 128000,
239 max_output_tokens: 16384,
240 supports_vision: true,
241 supports_tools: true,
242 cost_per_million_input: 2.5,
243 cost_per_million_output: 10.0,
244 },
245 ModelInfo {
246 id: "gpt-4o-mini".to_string(),
247 name: "GPT-4o Mini".to_string(),
248 provider: "openai".to_string(),
249 context_window: 128000,
250 max_output_tokens: 16384,
251 supports_vision: true,
252 supports_tools: true,
253 cost_per_million_input: 0.15,
254 cost_per_million_output: 0.6,
255 },
256 ModelInfo {
257 id: "gpt-4-turbo".to_string(),
258 name: "GPT-4 Turbo".to_string(),
259 provider: "openai".to_string(),
260 context_window: 128000,
261 max_output_tokens: 4096,
262 supports_vision: true,
263 supports_tools: true,
264 cost_per_million_input: 10.0,
265 cost_per_million_output: 30.0,
266 },
267 ModelInfo {
268 id: "o1-preview".to_string(),
269 name: "o1 Preview".to_string(),
270 provider: "openai".to_string(),
271 context_window: 128000,
272 max_output_tokens: 32768,
273 supports_vision: false,
274 supports_tools: false,
275 cost_per_million_input: 15.0,
276 cost_per_million_output: 60.0,
277 },
278 ModelInfo {
279 id: "o1-mini".to_string(),
280 name: "o1 Mini".to_string(),
281 provider: "openai".to_string(),
282 context_window: 128000,
283 max_output_tokens: 65536,
284 supports_vision: false,
285 supports_tools: false,
286 cost_per_million_input: 3.0,
287 cost_per_million_output: 12.0,
288 },
289 ];

Callers

nothing calls this directly

Calls 1

newFunction · 0.85

Tested by

no test coverage detected