Whakamahia a OpenCode me Shannon
Tāpirihia a Shannon hei kaiwhakarato i opencode.json, ā, ka whakamahere, ka whakatika, ka whakahaere waehere a OpenCode i runga i ngā model Shannon.
- I whakamātauria 7 Noe 2026
- OpenAI Chat Completions
- Tata ki te 3 meneti
Mō OpenCode
He kaitono waehere mātāmuri-tuwhera a OpenCode me tētahi atanga terminal, he taupānga papamahi me ngā toronga IDE. Ka mahi me ētahi kaiwhakarato model maha, ka whakamahere, ka whakatika waehere mā āna ake taputapu, ā, ka pupuri i ngā huihuinga ka taea te hoki atu. Ka tāpiri tētahi poraka kaiwhakarato i opencode.json i a Shannon ki te taha o ngā kaiwhakarato kei te whakamahia e koe.
Ngā mea e hiahiatia ana
- He API key Shannon
- Ngā kī me te whakamahinga
- URL pūtake
-
https://api.shannon-ai.com/v1Pito mutunga:/v1/chat/completions - Ka whai ia wāhanga waehere i raro iho i tō kōwhiringa.
Whakaritea
-
Kawea atu tō API key
Ka pānui te whirihora i a ia hei
{env:SHANNON_API_KEY}, nō reira ka noho te key ki waho i te kōnae.Shellexport SHANNON_API_KEY=YOUR_API_KEY -
Tāpirihia a Shannon hei kaiwhakarato
Whakanohoia tēnei ki
~/.config/opencode/opencode.jsonmō ia kaupapa, kiopencode.jsonrānei i te pūtake o tētahi kaupapa. Ka kī telimit.contextki a OpenCode ā hea whakapoto ai i te kōrero.~/.config/opencode/opencode.json{ "$schema": "https://opencode.ai/config.json", "provider": { "shannon": { "npm": "@ai-sdk/openai-compatible", "name": "Shannon", "options": { "baseURL": "https://api.shannon-ai.com/v1", "apiKey": "{env:SHANNON_API_KEY}" }, "models": { "Kimi-K3-uncensored-NVFP4": { "name": "Kimi-K3-uncensored-NVFP4", "limit": { "context": 1022976, "output": 262144 } } } } }, "model": "shannon/Kimi-K3-uncensored-NVFP4" } -
Whakahaerehia a OpenCode
Tīmataria
opencodei tō kaupapa, hoatu rānei he mahi kotahi māopencode run. Ka whakawhiti te/modelsi waenga i ngā id i rārangihia e koe.Shellopencode run "Run the tests and fix what fails."
He rere tūturu i runga i a OpenCode 1.19.5: kua whakahaerehia ngā whakamātautau, e rua ngā whakatika, ngā whakamātautau katoa e whiti ana.
Tirohia kei te mahi
Tukuna: He aha tā tēnei kaupapa e mahi ai?
Me kite koe i: Ka pānui a OpenCode i ō kōnae, ā, ka whakautu; ka whakaatu te rārangi tūnga i te shannon/<id>.
Ngā model e hāngai ana ki OpenCode
Ka tutuki i ia id i raro iho ngā hiahia o OpenCode. Ko te tuatahi te taunoa i ngā wāhanga waehere.
| Id tauira | Matapihi horopaki | Output nui rawa | Input whakaahua |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | Āe |
shannon-coder-1 | 131,072 | 65,536 | Kāo |
Kimi-K3.1-Pro-uncensored-NVFP4 | 1,022,976 | 262,144 | Āe |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | Āe |
shannon-3 | 196,608 | 65,536 | Āe |
Ngā tautuhinga model
Ka tono a OpenCode i ēnei uara. Ka whai rātou i te model i kōwhiria e koe.
| Tautuhinga | Uara | He aha ai |
|---|---|---|
limit.context | 1022976 | Te matapihi o te model; ka whakapoto a OpenCode i mua i a ia. |
limit.output | 262144 | Te whakautu roa rawa. |
He pai kia mōhio
- Ka pānui a OpenCode 1.19 i te poraka
providere whakaaturia ana i konei. Ka tāmia te āhuaproviders/package/settingshou i te kaupapa tuihono a OpenCode e 1.19 ("Omitted native setting"), ā, ka tatari a OpenCode me te kore model. - I roto i tētahi tuhinga, katia te tāuru paerewa:
opencode run "…" < /dev/null. Mēnā kāore he terminal, ka tatari tuatahi teopencode runmō te tāuru. - Rārangitia ētahi id ki raro i te
modelshei whakawhiti i waenga i a rātou mā te/models.
Ngā tohutohu
- Whakanohoia te kaiwhakarato ki
~/.config/opencode/opencode.jsonhei whakamahi i ia kaupapa, kiopencode.jsonrānei i te pūtake o te kaupapa mō tētahi kaupapa kotahi. - Patohia
/modelsi te atanga hei whakawhiti i waenga i ngā id kua rārangihia i raro i te kaiwhakarato. - Whakaritea te
limit.contextme telimit.outputmō ia model kia mōhio a OpenCode ā hea whakapoto ai. - Ka whakahaere te
opencode run "…" < /dev/nulli tētahi mahi me te kore atanga, mō ngā tuhinga.
Te whakatika raruraru
| Tohu | Take | Whakatika |
|---|---|---|
| Ka tīmata a OpenCode, ā, ka tatari mō ake tonu | Ka whakamahi te whirihora i te providers (tini), ka whakarerea e tēnei putanga, nō reira kāore he model kua kōwhiria; he tatari rānei te opencode run i te tāuru paerewa. | Whakamahia te provider me te npm, options me te models pēnei i runga ake nei; i ngā tuhinga tāpirihia te < /dev/null. |
401 | Kāore i whakaritea te SHANNON_API_KEY i te wāhi e tīmata ai a OpenCode. | Kawea atu, tuhia rānei te key ki te options.apiKey. |
| "Model not found" | Kāore te uara model e rite ki tētahi kaiwhakarato me te id model. | Tuhia hei shannon/<id>, me te id pēnei tonu i te rārangi i raro i te models. |
401 Unauthorized | Kei te ngaro te key, kua hē te pato, kua hurihia rānei. | Tāruatia anō te key mai i Keys & usage; ka tīmata ki te sk-. |
context_length_exceeded, te karere "prompt is too long" rānei | He roa ake te kōrero i te matapihi horopaki o te model. | Tīmatahia he kōrerorero hou, tukuna te taputapu kia whakamāmā, kōwhiria rānei he model he nui ake te matapihi. |
insufficient_quota | Kāore e rawaka tō toenga hei utu i te tono. | Tāpiri nama, huri mahere rānei; kāore te tono e ngana anō ko ia anake. |
Ngā pātai
Ka mahi a OpenCode me Shannon?
Āe, hei kaiwhakarato ritenga me te package @ai-sdk/openai-compatible me te base URL https://api.shannon-ai.com/v1.
Ko tēhea model hei whakamahi mā OpenCode?
He model he karanga taputapu, he matapihi roa hoki, pērā i te Kimi-K3-uncensored-NVFP4; e tau ana te shannon-coder-1 mō ngā mahi poto ake.