| 216 | } |
| 217 | |
| 218 | function remoteCost(input: NonNullable<(typeof ConfigProviderV1.Model.Type)["cost"]>) { |
| 219 | const base = { |
| 220 | input: input.input, |
| 221 | output: input.output, |
| 222 | cache: { read: input.cache_read ?? 0, write: input.cache_write ?? 0 }, |
| 223 | } |
| 224 | if (!input.context_over_200k) return [base] |
| 225 | return [ |
| 226 | base, |
| 227 | { |
| 228 | tier: { type: "context" as const, size: 200_000 }, |
| 229 | input: input.context_over_200k.input, |
| 230 | output: input.context_over_200k.output, |
| 231 | cache: { |
| 232 | read: input.context_over_200k.cache_read ?? 0, |
| 233 | write: input.context_over_200k.cache_write ?? 0, |
| 234 | }, |
| 235 | }, |
| 236 | ] |
| 237 | } |
| 238 | |
| 239 | function poll(http: HttpClient.HttpClient, server: string, deviceCode: string, interval: Duration.Duration) { |
| 240 | const loop = (wait: Duration.Duration): Effect.Effect<Credential.OAuth, unknown> => |